@opentelemetry/otlp-exporter-base 0.52.1 → 0.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/esm/OTLPExporterBase.d.ts +0 -5
- package/build/esm/OTLPExporterBase.js +0 -8
- package/build/esm/OTLPExporterBase.js.map +1 -1
- package/build/esm/configuration/otlp-http-configuration.d.ts +13 -0
- package/build/esm/configuration/otlp-http-configuration.js +67 -0
- package/build/esm/configuration/otlp-http-configuration.js.map +1 -0
- package/build/esm/configuration/otlp-http-env-configuration.d.ts +9 -0
- package/build/esm/configuration/otlp-http-env-configuration.js +104 -0
- package/build/esm/configuration/otlp-http-env-configuration.js.map +1 -0
- package/build/esm/configuration/shared-configuration.d.ts +22 -0
- package/build/esm/configuration/shared-configuration.js +44 -0
- package/build/esm/configuration/shared-configuration.js.map +1 -0
- package/build/esm/configuration/shared-env-configuration.d.ts +3 -0
- package/build/esm/configuration/shared-env-configuration.js +44 -0
- package/build/esm/configuration/shared-env-configuration.js.map +1 -0
- package/build/esm/export-response.d.ts +14 -0
- package/build/esm/export-response.js +17 -0
- package/build/esm/export-response.js.map +1 -0
- package/build/esm/exporter-transport.d.ts +6 -0
- package/build/esm/exporter-transport.js +17 -0
- package/build/esm/exporter-transport.js.map +1 -0
- package/build/esm/index.d.ts +5 -1
- package/build/esm/index.js +6 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/is-export-retryable.d.ts +3 -0
- package/build/esm/is-export-retryable.js +35 -0
- package/build/esm/is-export-retryable.js.map +1 -0
- package/build/esm/platform/browser/OTLPExporterBrowserBase.d.ts +7 -9
- package/build/esm/platform/browser/OTLPExporterBrowserBase.js +49 -32
- package/build/esm/platform/browser/OTLPExporterBrowserBase.js.map +1 -1
- package/build/esm/platform/browser/index.d.ts +0 -1
- package/build/esm/platform/browser/index.js +0 -1
- package/build/esm/platform/browser/index.js.map +1 -1
- package/build/esm/platform/browser/send-beacon-transport.d.ts +10 -0
- package/build/esm/platform/browser/send-beacon-transport.js +47 -0
- package/build/esm/platform/browser/send-beacon-transport.js.map +1 -0
- package/build/esm/platform/browser/xhr-transport.d.ts +11 -0
- package/build/esm/platform/browser/xhr-transport.js +101 -0
- package/build/esm/platform/browser/xhr-transport.js.map +1 -0
- package/build/esm/platform/index.d.ts +2 -2
- package/build/esm/platform/index.js +2 -2
- package/build/esm/platform/index.js.map +1 -1
- package/build/esm/platform/node/OTLPExporterNodeBase.d.ts +6 -13
- package/build/esm/platform/node/OTLPExporterNodeBase.js +45 -14
- package/build/esm/platform/node/OTLPExporterNodeBase.js.map +1 -1
- package/build/esm/platform/node/convert-legacy-agent-options.d.ts +12 -0
- package/build/esm/platform/node/convert-legacy-agent-options.js +27 -0
- package/build/esm/platform/node/convert-legacy-agent-options.js.map +1 -0
- package/build/esm/platform/node/http-exporter-transport.d.ts +4 -0
- package/build/esm/platform/node/http-exporter-transport.js +87 -0
- package/build/esm/platform/node/http-exporter-transport.js.map +1 -0
- package/build/esm/platform/node/http-transport-types.d.ts +12 -0
- package/build/esm/platform/node/http-transport-types.js +17 -0
- package/build/esm/platform/node/http-transport-types.js.map +1 -0
- package/build/esm/platform/node/http-transport-utils.d.ts +16 -0
- package/build/esm/platform/node/http-transport-utils.js +127 -0
- package/build/esm/platform/node/http-transport-utils.js.map +1 -0
- package/build/esm/platform/node/index.d.ts +0 -1
- package/build/esm/platform/node/index.js +0 -1
- package/build/esm/platform/node/index.js.map +1 -1
- package/build/esm/retrying-transport.d.ts +8 -0
- package/build/esm/retrying-transport.js +119 -0
- package/build/esm/retrying-transport.js.map +1 -0
- package/build/esm/types.d.ts +1 -2
- package/build/esm/types.js.map +1 -1
- package/build/esm/util.d.ts +1 -27
- package/build/esm/util.js +1 -89
- package/build/esm/util.js.map +1 -1
- package/build/esm/version.d.ts +1 -1
- package/build/esm/version.js +1 -1
- package/build/esm/version.js.map +1 -1
- package/build/esnext/OTLPExporterBase.d.ts +0 -5
- package/build/esnext/OTLPExporterBase.js +0 -8
- package/build/esnext/OTLPExporterBase.js.map +1 -1
- package/build/esnext/configuration/otlp-http-configuration.d.ts +13 -0
- package/build/esnext/configuration/otlp-http-configuration.js +56 -0
- package/build/esnext/configuration/otlp-http-configuration.js.map +1 -0
- package/build/esnext/configuration/otlp-http-env-configuration.d.ts +9 -0
- package/build/esnext/configuration/otlp-http-env-configuration.js +93 -0
- package/build/esnext/configuration/otlp-http-env-configuration.js.map +1 -0
- package/build/esnext/configuration/shared-configuration.d.ts +22 -0
- package/build/esnext/configuration/shared-configuration.js +44 -0
- package/build/esnext/configuration/shared-configuration.js.map +1 -0
- package/build/esnext/configuration/shared-env-configuration.d.ts +3 -0
- package/build/esnext/configuration/shared-env-configuration.js +44 -0
- package/build/esnext/configuration/shared-env-configuration.js.map +1 -0
- package/build/esnext/export-response.d.ts +14 -0
- package/build/esnext/export-response.js +17 -0
- package/build/esnext/export-response.js.map +1 -0
- package/build/esnext/exporter-transport.d.ts +6 -0
- package/build/esnext/exporter-transport.js +17 -0
- package/build/esnext/exporter-transport.js.map +1 -0
- package/build/esnext/index.d.ts +5 -1
- package/build/esnext/index.js +6 -1
- package/build/esnext/index.js.map +1 -1
- package/build/esnext/is-export-retryable.d.ts +3 -0
- package/build/esnext/is-export-retryable.js +35 -0
- package/build/esnext/is-export-retryable.js.map +1 -0
- package/build/esnext/platform/browser/OTLPExporterBrowserBase.d.ts +7 -9
- package/build/esnext/platform/browser/OTLPExporterBrowserBase.js +49 -21
- package/build/esnext/platform/browser/OTLPExporterBrowserBase.js.map +1 -1
- package/build/esnext/platform/browser/index.d.ts +0 -1
- package/build/esnext/platform/browser/index.js +0 -1
- package/build/esnext/platform/browser/index.js.map +1 -1
- package/build/esnext/platform/browser/send-beacon-transport.d.ts +10 -0
- package/build/esnext/platform/browser/send-beacon-transport.js +45 -0
- package/build/esnext/platform/browser/send-beacon-transport.js.map +1 -0
- package/build/esnext/platform/browser/xhr-transport.d.ts +11 -0
- package/build/esnext/platform/browser/xhr-transport.js +82 -0
- package/build/esnext/platform/browser/xhr-transport.js.map +1 -0
- package/build/esnext/platform/index.d.ts +2 -2
- package/build/esnext/platform/index.js +2 -2
- package/build/esnext/platform/index.js.map +1 -1
- package/build/esnext/platform/node/OTLPExporterNodeBase.d.ts +6 -13
- package/build/esnext/platform/node/OTLPExporterNodeBase.js +45 -14
- package/build/esnext/platform/node/OTLPExporterNodeBase.js.map +1 -1
- package/build/esnext/platform/node/convert-legacy-agent-options.d.ts +12 -0
- package/build/esnext/platform/node/convert-legacy-agent-options.js +27 -0
- package/build/esnext/platform/node/convert-legacy-agent-options.js.map +1 -0
- package/build/esnext/platform/node/http-exporter-transport.d.ts +4 -0
- package/build/esnext/platform/node/http-exporter-transport.js +47 -0
- package/build/esnext/platform/node/http-exporter-transport.js.map +1 -0
- package/build/esnext/platform/node/http-transport-types.d.ts +12 -0
- package/build/esnext/platform/node/http-transport-types.js +17 -0
- package/build/esnext/platform/node/http-transport-types.js.map +1 -0
- package/build/esnext/platform/node/http-transport-utils.d.ts +16 -0
- package/build/esnext/platform/node/http-transport-utils.js +116 -0
- package/build/esnext/platform/node/http-transport-utils.js.map +1 -0
- package/build/esnext/platform/node/index.d.ts +0 -1
- package/build/esnext/platform/node/index.js +0 -1
- package/build/esnext/platform/node/index.js.map +1 -1
- package/build/esnext/retrying-transport.d.ts +8 -0
- package/build/esnext/retrying-transport.js +69 -0
- package/build/esnext/retrying-transport.js.map +1 -0
- package/build/esnext/types.d.ts +1 -2
- package/build/esnext/types.js.map +1 -1
- package/build/esnext/util.d.ts +1 -27
- package/build/esnext/util.js +1 -89
- package/build/esnext/util.js.map +1 -1
- package/build/esnext/version.d.ts +1 -1
- package/build/esnext/version.js +1 -1
- package/build/esnext/version.js.map +1 -1
- package/build/src/OTLPExporterBase.d.ts +0 -5
- package/build/src/OTLPExporterBase.js +0 -8
- package/build/src/OTLPExporterBase.js.map +1 -1
- package/build/src/configuration/otlp-http-configuration.d.ts +13 -0
- package/build/src/configuration/otlp-http-configuration.js +61 -0
- package/build/src/configuration/otlp-http-configuration.js.map +1 -0
- package/build/src/configuration/otlp-http-env-configuration.d.ts +9 -0
- package/build/src/configuration/otlp-http-env-configuration.js +97 -0
- package/build/src/configuration/otlp-http-env-configuration.js.map +1 -0
- package/build/src/configuration/shared-configuration.d.ts +22 -0
- package/build/src/configuration/shared-configuration.js +50 -0
- package/build/src/configuration/shared-configuration.js.map +1 -0
- package/build/src/configuration/shared-env-configuration.d.ts +3 -0
- package/build/src/configuration/shared-env-configuration.js +48 -0
- package/build/src/configuration/shared-env-configuration.js.map +1 -0
- package/build/src/export-response.d.ts +14 -0
- package/build/src/export-response.js +18 -0
- package/build/src/export-response.js.map +1 -0
- package/build/src/exporter-transport.d.ts +6 -0
- package/build/src/exporter-transport.js +18 -0
- package/build/src/exporter-transport.js.map +1 -0
- package/build/src/index.d.ts +5 -1
- package/build/src/index.js +21 -17
- package/build/src/index.js.map +1 -1
- package/build/src/is-export-retryable.d.ts +3 -0
- package/build/src/is-export-retryable.js +40 -0
- package/build/src/is-export-retryable.js.map +1 -0
- package/build/src/platform/browser/OTLPExporterBrowserBase.d.ts +7 -9
- package/build/src/platform/browser/OTLPExporterBrowserBase.js +49 -21
- package/build/src/platform/browser/OTLPExporterBrowserBase.js.map +1 -1
- package/build/src/platform/browser/index.d.ts +0 -1
- package/build/src/platform/browser/index.js +1 -3
- package/build/src/platform/browser/index.js.map +1 -1
- package/build/src/platform/browser/send-beacon-transport.d.ts +10 -0
- package/build/src/platform/browser/send-beacon-transport.js +49 -0
- package/build/src/platform/browser/send-beacon-transport.js.map +1 -0
- package/build/src/platform/browser/xhr-transport.d.ts +11 -0
- package/build/src/platform/browser/xhr-transport.js +86 -0
- package/build/src/platform/browser/xhr-transport.js.map +1 -0
- package/build/src/platform/index.d.ts +2 -2
- package/build/src/platform/index.js +1 -5
- package/build/src/platform/index.js.map +1 -1
- package/build/src/platform/node/OTLPExporterNodeBase.d.ts +6 -13
- package/build/src/platform/node/OTLPExporterNodeBase.js +45 -14
- package/build/src/platform/node/OTLPExporterNodeBase.js.map +1 -1
- package/build/src/platform/node/convert-legacy-agent-options.d.ts +12 -0
- package/build/src/platform/node/convert-legacy-agent-options.js +31 -0
- package/build/src/platform/node/convert-legacy-agent-options.js.map +1 -0
- package/build/src/platform/node/http-exporter-transport.d.ts +4 -0
- package/build/src/platform/node/http-exporter-transport.js +51 -0
- package/build/src/platform/node/http-exporter-transport.js.map +1 -0
- package/build/src/platform/node/http-transport-types.d.ts +12 -0
- package/build/src/platform/node/http-transport-types.js +18 -0
- package/build/src/platform/node/http-transport-types.js.map +1 -0
- package/build/src/platform/node/http-transport-utils.d.ts +16 -0
- package/build/src/platform/node/http-transport-utils.js +121 -0
- package/build/src/platform/node/http-transport-utils.js.map +1 -0
- package/build/src/platform/node/index.d.ts +0 -1
- package/build/src/platform/node/index.js +1 -5
- package/build/src/platform/node/index.js.map +1 -1
- package/build/src/retrying-transport.d.ts +8 -0
- package/build/src/retrying-transport.js +73 -0
- package/build/src/retrying-transport.js.map +1 -0
- package/build/src/types.d.ts +1 -2
- package/build/src/types.js.map +1 -1
- package/build/src/util.d.ts +1 -27
- package/build/src/util.js +3 -97
- package/build/src/util.js.map +1 -1
- package/build/src/version.d.ts +1 -1
- package/build/src/version.js +1 -1
- package/build/src/version.js.map +1 -1
- package/package.json +13 -17
- package/build/esm/platform/browser/util.d.ts +0 -21
- package/build/esm/platform/browser/util.js +0 -152
- package/build/esm/platform/browser/util.js.map +0 -1
- package/build/esm/platform/node/util.d.ts +0 -19
- package/build/esm/platform/node/util.js +0 -194
- package/build/esm/platform/node/util.js.map +0 -1
- package/build/esnext/platform/browser/util.d.ts +0 -21
- package/build/esnext/platform/browser/util.js +0 -122
- package/build/esnext/platform/browser/util.js.map +0 -1
- package/build/esnext/platform/node/util.d.ts +0 -19
- package/build/esnext/platform/node/util.js +0 -181
- package/build/esnext/platform/node/util.js.map +0 -1
- package/build/src/platform/browser/util.d.ts +0 -21
- package/build/src/platform/browser/util.js +0 -127
- package/build/src/platform/browser/util.js.map +0 -1
- package/build/src/platform/node/util.d.ts +0 -19
- package/build/src/platform/node/util.js +0 -187
- package/build/src/platform/node/util.js.map +0 -1
package/build/esnext/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C;;;GAGG;AACH,MAAM,UAAU,2BAA2B,CACzC,iBAAmD,EAAE;IAErD,MAAM,OAAO,GAA2B,EAAE,CAAC;IAC3C,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACtD,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;YAChC,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;SAC9B;aAAM;YACL,IAAI,CAAC,IAAI,CACP,WAAW,GAAG,wBAAwB,KAAK,uBAAuB,CACnE,CAAC;SACH;IACH,CAAC,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { diag } from '@opentelemetry/api';\n\n/**\n * Parses headers from config leaving only those that have defined values\n * @param partialHeaders\n */\nexport function validateAndNormalizeHeaders(\n partialHeaders: Partial<Record<string, unknown>> = {}\n): Record<string, string> {\n const headers: Record<string, string> = {};\n Object.entries(partialHeaders).forEach(([key, value]) => {\n if (typeof value !== 'undefined') {\n headers[key] = String(value);\n } else {\n diag.warn(\n `Header \"${key}\" has invalid value (${value}) and will be ignored`\n );\n }\n });\n return headers;\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.54.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/build/esnext/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.54.0';\n"]}
|
|
@@ -4,9 +4,6 @@ import { OTLPExporterError, OTLPExporterConfigBase } from './types';
|
|
|
4
4
|
* Collector Exporter abstract base class
|
|
5
5
|
*/
|
|
6
6
|
export declare abstract class OTLPExporterBase<T extends OTLPExporterConfigBase, ExportItem> {
|
|
7
|
-
readonly url: string;
|
|
8
|
-
readonly hostname: string | undefined;
|
|
9
|
-
readonly timeoutMillis: number;
|
|
10
7
|
protected _concurrencyLimit: number;
|
|
11
8
|
protected _sendingPromises: Promise<unknown>[];
|
|
12
9
|
protected _shutdownOnce: BindOnceFuture<void>;
|
|
@@ -34,8 +31,6 @@ export declare abstract class OTLPExporterBase<T extends OTLPExporterConfigBase,
|
|
|
34
31
|
*/
|
|
35
32
|
private _shutdown;
|
|
36
33
|
abstract onShutdown(): void;
|
|
37
|
-
abstract onInit(config: T): void;
|
|
38
34
|
abstract send(items: ExportItem[], onSuccess: () => void, onError: (error: OTLPExporterError) => void): void;
|
|
39
|
-
abstract getDefaultUrl(config: T): string;
|
|
40
35
|
}
|
|
41
36
|
//# sourceMappingURL=OTLPExporterBase.d.ts.map
|
|
@@ -18,7 +18,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
exports.OTLPExporterBase = void 0;
|
|
19
19
|
const api_1 = require("@opentelemetry/api");
|
|
20
20
|
const core_1 = require("@opentelemetry/core");
|
|
21
|
-
const util_1 = require("./util");
|
|
22
21
|
/**
|
|
23
22
|
* Collector Exporter abstract base class
|
|
24
23
|
*/
|
|
@@ -28,19 +27,12 @@ class OTLPExporterBase {
|
|
|
28
27
|
*/
|
|
29
28
|
constructor(config = {}) {
|
|
30
29
|
this._sendingPromises = [];
|
|
31
|
-
this.url = this.getDefaultUrl(config);
|
|
32
|
-
if (typeof config.hostname === 'string') {
|
|
33
|
-
this.hostname = config.hostname;
|
|
34
|
-
}
|
|
35
30
|
this.shutdown = this.shutdown.bind(this);
|
|
36
31
|
this._shutdownOnce = new core_1.BindOnceFuture(this._shutdown, this);
|
|
37
32
|
this._concurrencyLimit =
|
|
38
33
|
typeof config.concurrencyLimit === 'number'
|
|
39
34
|
? config.concurrencyLimit
|
|
40
35
|
: 30;
|
|
41
|
-
this.timeoutMillis = (0, util_1.configureExporterTimeout)(config.timeoutMillis);
|
|
42
|
-
// platform dependent
|
|
43
|
-
this.onInit(config);
|
|
44
36
|
}
|
|
45
37
|
/**
|
|
46
38
|
* Export items.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OTLPExporterBase.js","sourceRoot":"","sources":["../../src/OTLPExporterBase.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4CAA0C;AAC1C,8CAI6B;
|
|
1
|
+
{"version":3,"file":"OTLPExporterBase.js","sourceRoot":"","sources":["../../src/OTLPExporterBase.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4CAA0C;AAC1C,8CAI6B;AAO7B;;GAEG;AACH,MAAsB,gBAAgB;IAQpC;;OAEG;IACH,YAAY,SAAY,EAAO;QANrB,qBAAgB,GAAuB,EAAE,CAAC;QAOlD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,aAAa,GAAG,IAAI,qBAAc,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAE9D,IAAI,CAAC,iBAAiB;YACpB,OAAO,MAAM,CAAC,gBAAgB,KAAK,QAAQ;gBACzC,CAAC,CAAC,MAAM,CAAC,gBAAgB;gBACzB,CAAC,CAAC,EAAE,CAAC;IACX,CAAC;IAED;;;;OAIG;IACH,MAAM,CACJ,KAAmB,EACnB,cAA8C;QAE9C,IAAI,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE;YAC/B,cAAc,CAAC;gBACb,IAAI,EAAE,uBAAgB,CAAC,MAAM;gBAC7B,KAAK,EAAE,IAAI,KAAK,CAAC,4BAA4B,CAAC;aAC/C,CAAC,CAAC;YACH,OAAO;SACR;QAED,IAAI,IAAI,CAAC,gBAAgB,CAAC,MAAM,IAAI,IAAI,CAAC,iBAAiB,EAAE;YAC1D,cAAc,CAAC;gBACb,IAAI,EAAE,uBAAgB,CAAC,MAAM;gBAC7B,KAAK,EAAE,IAAI,KAAK,CAAC,iCAAiC,CAAC;aACpD,CAAC,CAAC;YACH,OAAO;SACR;QAED,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;aAChB,IAAI,CAAC,GAAG,EAAE;YACT,cAAc,CAAC,EAAE,IAAI,EAAE,uBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC;QACrD,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,KAAyB,EAAE,EAAE;YACnC,cAAc,CAAC,EAAE,IAAI,EAAE,uBAAgB,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;IACP,CAAC;IAEO,OAAO,CAAC,KAAmB;QACjC,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC3C,IAAI;gBACF,UAAI,CAAC,KAAK,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;gBACtC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;aACnC;YAAC,OAAO,CAAC,EAAE;gBACV,MAAM,CAAC,CAAC,CAAC,CAAC;aACX;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,UAAU;QACR,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;YAClD,6BAA6B;QAC/B,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACK,SAAS;QACf,UAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;QAC/B,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;IAC3B,CAAC;CAQF;AAjGD,4CAiGC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { diag } from '@opentelemetry/api';\nimport {\n ExportResult,\n ExportResultCode,\n BindOnceFuture,\n} from '@opentelemetry/core';\nimport {\n OTLPExporterError,\n OTLPExporterConfigBase,\n ExportServiceError,\n} from './types';\n\n/**\n * Collector Exporter abstract base class\n */\nexport abstract class OTLPExporterBase<\n T extends OTLPExporterConfigBase,\n ExportItem,\n> {\n protected _concurrencyLimit: number;\n protected _sendingPromises: Promise<unknown>[] = [];\n protected _shutdownOnce: BindOnceFuture<void>;\n\n /**\n * @param config\n */\n constructor(config: T = {} as T) {\n this.shutdown = this.shutdown.bind(this);\n this._shutdownOnce = new BindOnceFuture(this._shutdown, this);\n\n this._concurrencyLimit =\n typeof config.concurrencyLimit === 'number'\n ? config.concurrencyLimit\n : 30;\n }\n\n /**\n * Export items.\n * @param items\n * @param resultCallback\n */\n export(\n items: ExportItem[],\n resultCallback: (result: ExportResult) => void\n ): void {\n if (this._shutdownOnce.isCalled) {\n resultCallback({\n code: ExportResultCode.FAILED,\n error: new Error('Exporter has been shutdown'),\n });\n return;\n }\n\n if (this._sendingPromises.length >= this._concurrencyLimit) {\n resultCallback({\n code: ExportResultCode.FAILED,\n error: new Error('Concurrent export limit reached'),\n });\n return;\n }\n\n this._export(items)\n .then(() => {\n resultCallback({ code: ExportResultCode.SUCCESS });\n })\n .catch((error: ExportServiceError) => {\n resultCallback({ code: ExportResultCode.FAILED, error });\n });\n }\n\n private _export(items: ExportItem[]): Promise<unknown> {\n return new Promise<void>((resolve, reject) => {\n try {\n diag.debug('items to be sent', items);\n this.send(items, resolve, reject);\n } catch (e) {\n reject(e);\n }\n });\n }\n\n /**\n * Shutdown the exporter.\n */\n shutdown(): Promise<void> {\n return this._shutdownOnce.call();\n }\n\n /**\n * Exports any pending spans in the exporter\n */\n forceFlush(): Promise<void> {\n return Promise.all(this._sendingPromises).then(() => {\n /** ignore resolved values */\n });\n }\n\n /**\n * Called by _shutdownOnce with BindOnceFuture\n */\n private _shutdown(): Promise<void> {\n diag.debug('shutdown started');\n this.onShutdown();\n return this.forceFlush();\n }\n\n abstract onShutdown(): void;\n abstract send(\n items: ExportItem[],\n onSuccess: () => void,\n onError: (error: OTLPExporterError) => void\n ): void;\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { OtlpSharedConfiguration } from './shared-configuration';
|
|
2
|
+
export interface OtlpHttpConfiguration extends OtlpSharedConfiguration {
|
|
3
|
+
url: string;
|
|
4
|
+
headers: Record<string, string>;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* @param userProvidedConfiguration Configuration options provided by the user in code.
|
|
8
|
+
* @param fallbackConfiguration Fallback to use when the {@link userProvidedConfiguration} does not specify an option.
|
|
9
|
+
* @param defaultConfiguration The defaults as defined by the exporter specification
|
|
10
|
+
*/
|
|
11
|
+
export declare function mergeOtlpHttpConfigurationWithDefaults(userProvidedConfiguration: Partial<OtlpHttpConfiguration>, fallbackConfiguration: Partial<OtlpHttpConfiguration>, defaultConfiguration: OtlpHttpConfiguration): OtlpHttpConfiguration;
|
|
12
|
+
export declare function getHttpConfigurationDefaults(requiredHeaders: Record<string, string>, signalResourcePath: string): OtlpHttpConfiguration;
|
|
13
|
+
//# sourceMappingURL=otlp-http-configuration.d.ts.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright The OpenTelemetry Authors
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.getHttpConfigurationDefaults = exports.mergeOtlpHttpConfigurationWithDefaults = void 0;
|
|
19
|
+
const shared_configuration_1 = require("./shared-configuration");
|
|
20
|
+
const util_1 = require("../util");
|
|
21
|
+
function mergeHeaders(userProvidedHeaders, fallbackHeaders, defaultHeaders) {
|
|
22
|
+
const requiredHeaders = Object.assign({}, defaultHeaders);
|
|
23
|
+
const headers = {};
|
|
24
|
+
// add fallback ones first
|
|
25
|
+
if (fallbackHeaders != null) {
|
|
26
|
+
Object.assign(headers, fallbackHeaders);
|
|
27
|
+
}
|
|
28
|
+
// override with user-provided ones
|
|
29
|
+
if (userProvidedHeaders != null) {
|
|
30
|
+
Object.assign(headers, userProvidedHeaders);
|
|
31
|
+
}
|
|
32
|
+
// override required ones.
|
|
33
|
+
return Object.assign(headers, requiredHeaders);
|
|
34
|
+
}
|
|
35
|
+
function validateUserProvidedUrl(url) {
|
|
36
|
+
if (url == null) {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
new URL(url);
|
|
41
|
+
return url;
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
throw new Error(`Configuration: Could not parse user-provided export URL: '${url}'`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* @param userProvidedConfiguration Configuration options provided by the user in code.
|
|
49
|
+
* @param fallbackConfiguration Fallback to use when the {@link userProvidedConfiguration} does not specify an option.
|
|
50
|
+
* @param defaultConfiguration The defaults as defined by the exporter specification
|
|
51
|
+
*/
|
|
52
|
+
function mergeOtlpHttpConfigurationWithDefaults(userProvidedConfiguration, fallbackConfiguration, defaultConfiguration) {
|
|
53
|
+
var _a, _b;
|
|
54
|
+
return Object.assign(Object.assign({}, (0, shared_configuration_1.mergeOtlpSharedConfigurationWithDefaults)(userProvidedConfiguration, fallbackConfiguration, defaultConfiguration)), { headers: mergeHeaders((0, util_1.validateAndNormalizeHeaders)(userProvidedConfiguration.headers), fallbackConfiguration.headers, defaultConfiguration.headers), url: (_b = (_a = validateUserProvidedUrl(userProvidedConfiguration.url)) !== null && _a !== void 0 ? _a : fallbackConfiguration.url) !== null && _b !== void 0 ? _b : defaultConfiguration.url });
|
|
55
|
+
}
|
|
56
|
+
exports.mergeOtlpHttpConfigurationWithDefaults = mergeOtlpHttpConfigurationWithDefaults;
|
|
57
|
+
function getHttpConfigurationDefaults(requiredHeaders, signalResourcePath) {
|
|
58
|
+
return Object.assign(Object.assign({}, (0, shared_configuration_1.getSharedConfigurationDefaults)()), { headers: requiredHeaders, url: 'http://localhost:4318/' + signalResourcePath });
|
|
59
|
+
}
|
|
60
|
+
exports.getHttpConfigurationDefaults = getHttpConfigurationDefaults;
|
|
61
|
+
//# sourceMappingURL=otlp-http-configuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otlp-http-configuration.js","sourceRoot":"","sources":["../../../src/configuration/otlp-http-configuration.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,iEAIgC;AAChC,kCAAsD;AAOtD,SAAS,YAAY,CACnB,mBAA8D,EAC9D,eAA0D,EAC1D,cAAsC;IAEtC,MAAM,eAAe,qBAChB,cAAc,CAClB,CAAC;IACF,MAAM,OAAO,GAAG,EAAE,CAAC;IAEnB,0BAA0B;IAC1B,IAAI,eAAe,IAAI,IAAI,EAAE;QAC3B,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;KACzC;IAED,mCAAmC;IACnC,IAAI,mBAAmB,IAAI,IAAI,EAAE;QAC/B,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;KAC7C;IAED,0BAA0B;IAC1B,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;AACjD,CAAC;AAED,SAAS,uBAAuB,CAAC,GAAuB;IACtD,IAAI,GAAG,IAAI,IAAI,EAAE;QACf,OAAO,SAAS,CAAC;KAClB;IACD,IAAI;QACF,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QACb,OAAO,GAAG,CAAC;KACZ;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,IAAI,KAAK,CACb,6DAA6D,GAAG,GAAG,CACpE,CAAC;KACH;AACH,CAAC;AAED;;;;GAIG;AACH,SAAgB,sCAAsC,CACpD,yBAAyD,EACzD,qBAAqD,EACrD,oBAA2C;;IAE3C,uCACK,IAAA,+DAAwC,EACzC,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,CACrB,KACD,OAAO,EAAE,YAAY,CACnB,IAAA,kCAA2B,EAAC,yBAAyB,CAAC,OAAO,CAAC,EAC9D,qBAAqB,CAAC,OAAO,EAC7B,oBAAoB,CAAC,OAAO,CAC7B,EACD,GAAG,EACD,MAAA,MAAA,uBAAuB,CAAC,yBAAyB,CAAC,GAAG,CAAC,mCACtD,qBAAqB,CAAC,GAAG,mCACzB,oBAAoB,CAAC,GAAG,IAC1B;AACJ,CAAC;AArBD,wFAqBC;AAED,SAAgB,4BAA4B,CAC1C,eAAuC,EACvC,kBAA0B;IAE1B,uCACK,IAAA,qDAA8B,GAAE,KACnC,OAAO,EAAE,eAAe,EACxB,GAAG,EAAE,wBAAwB,GAAG,kBAAkB,IAClD;AACJ,CAAC;AATD,oEASC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n getSharedConfigurationDefaults,\n mergeOtlpSharedConfigurationWithDefaults,\n OtlpSharedConfiguration,\n} from './shared-configuration';\nimport { validateAndNormalizeHeaders } from '../util';\n\nexport interface OtlpHttpConfiguration extends OtlpSharedConfiguration {\n url: string;\n headers: Record<string, string>;\n}\n\nfunction mergeHeaders(\n userProvidedHeaders: Record<string, string> | undefined | null,\n fallbackHeaders: Record<string, string> | undefined | null,\n defaultHeaders: Record<string, string>\n): Record<string, string> {\n const requiredHeaders = {\n ...defaultHeaders,\n };\n const headers = {};\n\n // add fallback ones first\n if (fallbackHeaders != null) {\n Object.assign(headers, fallbackHeaders);\n }\n\n // override with user-provided ones\n if (userProvidedHeaders != null) {\n Object.assign(headers, userProvidedHeaders);\n }\n\n // override required ones.\n return Object.assign(headers, requiredHeaders);\n}\n\nfunction validateUserProvidedUrl(url: string | undefined): string | undefined {\n if (url == null) {\n return undefined;\n }\n try {\n new URL(url);\n return url;\n } catch (e) {\n throw new Error(\n `Configuration: Could not parse user-provided export URL: '${url}'`\n );\n }\n}\n\n/**\n * @param userProvidedConfiguration Configuration options provided by the user in code.\n * @param fallbackConfiguration Fallback to use when the {@link userProvidedConfiguration} does not specify an option.\n * @param defaultConfiguration The defaults as defined by the exporter specification\n */\nexport function mergeOtlpHttpConfigurationWithDefaults(\n userProvidedConfiguration: Partial<OtlpHttpConfiguration>,\n fallbackConfiguration: Partial<OtlpHttpConfiguration>,\n defaultConfiguration: OtlpHttpConfiguration\n): OtlpHttpConfiguration {\n return {\n ...mergeOtlpSharedConfigurationWithDefaults(\n userProvidedConfiguration,\n fallbackConfiguration,\n defaultConfiguration\n ),\n headers: mergeHeaders(\n validateAndNormalizeHeaders(userProvidedConfiguration.headers),\n fallbackConfiguration.headers,\n defaultConfiguration.headers\n ),\n url:\n validateUserProvidedUrl(userProvidedConfiguration.url) ??\n fallbackConfiguration.url ??\n defaultConfiguration.url,\n };\n}\n\nexport function getHttpConfigurationDefaults(\n requiredHeaders: Record<string, string>,\n signalResourcePath: string\n): OtlpHttpConfiguration {\n return {\n ...getSharedConfigurationDefaults(),\n headers: requiredHeaders,\n url: 'http://localhost:4318/' + signalResourcePath,\n };\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { OtlpHttpConfiguration } from './otlp-http-configuration';
|
|
2
|
+
/**
|
|
3
|
+
* Reads and returns configuration from the environment
|
|
4
|
+
*
|
|
5
|
+
* @param signalIdentifier all caps part in environment variables that identifies the signal (e.g.: METRICS, TRACES, LOGS)
|
|
6
|
+
* @param signalResourcePath signal resource path to append if necessary (e.g.: v1/metrics, v1/traces, v1/logs)
|
|
7
|
+
*/
|
|
8
|
+
export declare function getHttpConfigurationFromEnvironment(signalIdentifier: string, signalResourcePath: string): Partial<OtlpHttpConfiguration>;
|
|
9
|
+
//# sourceMappingURL=otlp-http-env-configuration.d.ts.map
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getHttpConfigurationFromEnvironment = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright The OpenTelemetry Authors
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
const core_1 = require("@opentelemetry/core");
|
|
20
|
+
const api_1 = require("@opentelemetry/api");
|
|
21
|
+
const shared_env_configuration_1 = require("./shared-env-configuration");
|
|
22
|
+
function getHeadersFromEnv(signalIdentifier) {
|
|
23
|
+
var _a, _b;
|
|
24
|
+
const signalSpecificRawHeaders = (_a = process.env[`OTEL_EXPORTER_OTLP_${signalIdentifier}_HEADERS`]) === null || _a === void 0 ? void 0 : _a.trim();
|
|
25
|
+
const nonSignalSpecificRawHeaders = (_b = process.env['OTEL_EXPORTER_OTLP_HEADERS']) === null || _b === void 0 ? void 0 : _b.trim();
|
|
26
|
+
const signalSpecificHeaders = core_1.baggageUtils.parseKeyPairsIntoRecord(signalSpecificRawHeaders);
|
|
27
|
+
const nonSignalSpecificHeaders = core_1.baggageUtils.parseKeyPairsIntoRecord(nonSignalSpecificRawHeaders);
|
|
28
|
+
if (Object.keys(signalSpecificHeaders).length === 0 &&
|
|
29
|
+
Object.keys(nonSignalSpecificHeaders).length === 0) {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
// headers are combined instead of overwritten, with the specific headers taking precedence over
|
|
33
|
+
// the non-specific ones.
|
|
34
|
+
return Object.assign({}, core_1.baggageUtils.parseKeyPairsIntoRecord(nonSignalSpecificRawHeaders), core_1.baggageUtils.parseKeyPairsIntoRecord(signalSpecificRawHeaders));
|
|
35
|
+
}
|
|
36
|
+
function appendRootPathToUrlIfNeeded(url) {
|
|
37
|
+
try {
|
|
38
|
+
const parsedUrl = new URL(url);
|
|
39
|
+
// This will automatically append '/' if there's no root path.
|
|
40
|
+
return parsedUrl.toString();
|
|
41
|
+
}
|
|
42
|
+
catch (_a) {
|
|
43
|
+
api_1.diag.warn(`Configuration: Could not parse environment-provided export URL: '${url}', falling back to undefined`);
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function appendResourcePathToUrl(url, path) {
|
|
48
|
+
try {
|
|
49
|
+
// just try to parse, if it fails we catch and warn.
|
|
50
|
+
new URL(url);
|
|
51
|
+
}
|
|
52
|
+
catch (_a) {
|
|
53
|
+
api_1.diag.warn(`Configuration: Could not parse environment-provided export URL: '${url}', falling back to undefined`);
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
if (!url.endsWith('/')) {
|
|
57
|
+
url = url + '/';
|
|
58
|
+
}
|
|
59
|
+
url += path;
|
|
60
|
+
try {
|
|
61
|
+
// just try to parse, if it fails we catch and warn.
|
|
62
|
+
new URL(url);
|
|
63
|
+
}
|
|
64
|
+
catch (_b) {
|
|
65
|
+
api_1.diag.warn(`Configuration: Provided URL appended with '${path}' is not a valid URL, using 'undefined' instead of '${url}'`);
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
return url;
|
|
69
|
+
}
|
|
70
|
+
function getNonSpecificUrlFromEnv(signalResourcePath) {
|
|
71
|
+
var _a;
|
|
72
|
+
const envUrl = (_a = process.env.OTEL_EXPORTER_OTLP_ENDPOINT) === null || _a === void 0 ? void 0 : _a.trim();
|
|
73
|
+
if (envUrl == null || envUrl === '') {
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
return appendResourcePathToUrl(envUrl, signalResourcePath);
|
|
77
|
+
}
|
|
78
|
+
function getSpecificUrlFromEnv(signalIdentifier) {
|
|
79
|
+
var _a;
|
|
80
|
+
const envUrl = (_a = process.env[`OTEL_EXPORTER_OTLP_${signalIdentifier}_ENDPOINT`]) === null || _a === void 0 ? void 0 : _a.trim();
|
|
81
|
+
if (envUrl == null || envUrl === '') {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
return appendRootPathToUrlIfNeeded(envUrl);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Reads and returns configuration from the environment
|
|
88
|
+
*
|
|
89
|
+
* @param signalIdentifier all caps part in environment variables that identifies the signal (e.g.: METRICS, TRACES, LOGS)
|
|
90
|
+
* @param signalResourcePath signal resource path to append if necessary (e.g.: v1/metrics, v1/traces, v1/logs)
|
|
91
|
+
*/
|
|
92
|
+
function getHttpConfigurationFromEnvironment(signalIdentifier, signalResourcePath) {
|
|
93
|
+
var _a;
|
|
94
|
+
return Object.assign(Object.assign({}, (0, shared_env_configuration_1.getSharedConfigurationFromEnvironment)(signalIdentifier)), { url: (_a = getSpecificUrlFromEnv(signalIdentifier)) !== null && _a !== void 0 ? _a : getNonSpecificUrlFromEnv(signalResourcePath), headers: getHeadersFromEnv(signalIdentifier) });
|
|
95
|
+
}
|
|
96
|
+
exports.getHttpConfigurationFromEnvironment = getHttpConfigurationFromEnvironment;
|
|
97
|
+
//# sourceMappingURL=otlp-http-env-configuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otlp-http-env-configuration.js","sourceRoot":"","sources":["../../../src/configuration/otlp-http-env-configuration.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,8CAAmD;AACnD,4CAA0C;AAC1C,yEAAmF;AAGnF,SAAS,iBAAiB,CAAC,gBAAwB;;IACjD,MAAM,wBAAwB,GAC5B,MAAA,OAAO,CAAC,GAAG,CAAC,sBAAsB,gBAAgB,UAAU,CAAC,0CAAE,IAAI,EAAE,CAAC;IACxE,MAAM,2BAA2B,GAC/B,MAAA,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,0CAAE,IAAI,EAAE,CAAC;IAEpD,MAAM,qBAAqB,GAAG,mBAAY,CAAC,uBAAuB,CAChE,wBAAwB,CACzB,CAAC;IACF,MAAM,wBAAwB,GAAG,mBAAY,CAAC,uBAAuB,CACnE,2BAA2B,CAC5B,CAAC;IAEF,IACE,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,MAAM,KAAK,CAAC;QAC/C,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,MAAM,KAAK,CAAC,EAClD;QACA,OAAO,SAAS,CAAC;KAClB;IAED,gGAAgG;IAChG,yBAAyB;IACzB,OAAO,MAAM,CAAC,MAAM,CAClB,EAAE,EACF,mBAAY,CAAC,uBAAuB,CAAC,2BAA2B,CAAC,EACjE,mBAAY,CAAC,uBAAuB,CAAC,wBAAwB,CAAC,CAC/D,CAAC;AACJ,CAAC;AAED,SAAS,2BAA2B,CAAC,GAAW;IAC9C,IAAI;QACF,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,8DAA8D;QAC9D,OAAO,SAAS,CAAC,QAAQ,EAAE,CAAC;KAC7B;IAAC,WAAM;QACN,UAAI,CAAC,IAAI,CACP,oEAAoE,GAAG,8BAA8B,CACtG,CAAC;QACF,OAAO,SAAS,CAAC;KAClB;AACH,CAAC;AAED,SAAS,uBAAuB,CAC9B,GAAW,EACX,IAAY;IAEZ,IAAI;QACF,oDAAoD;QACpD,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;KACd;IAAC,WAAM;QACN,UAAI,CAAC,IAAI,CACP,oEAAoE,GAAG,8BAA8B,CACtG,CAAC;QACF,OAAO,SAAS,CAAC;KAClB;IAED,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACtB,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;KACjB;IACD,GAAG,IAAI,IAAI,CAAC;IAEZ,IAAI;QACF,oDAAoD;QACpD,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;KACd;IAAC,WAAM;QACN,UAAI,CAAC,IAAI,CACP,8CAA8C,IAAI,uDAAuD,GAAG,GAAG,CAChH,CAAC;QACF,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,wBAAwB,CAC/B,kBAA0B;;IAE1B,MAAM,MAAM,GAAG,MAAA,OAAO,CAAC,GAAG,CAAC,2BAA2B,0CAAE,IAAI,EAAE,CAAC;IAC/D,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,KAAK,EAAE,EAAE;QACnC,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,uBAAuB,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;AAC7D,CAAC;AAED,SAAS,qBAAqB,CAAC,gBAAwB;;IACrD,MAAM,MAAM,GACV,MAAA,OAAO,CAAC,GAAG,CAAC,sBAAsB,gBAAgB,WAAW,CAAC,0CAAE,IAAI,EAAE,CAAC;IACzE,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,KAAK,EAAE,EAAE;QACnC,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,2BAA2B,CAAC,MAAM,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;GAKG;AACH,SAAgB,mCAAmC,CACjD,gBAAwB,EACxB,kBAA0B;;IAE1B,uCACK,IAAA,gEAAqC,EAAC,gBAAgB,CAAC,KAC1D,GAAG,EACD,MAAA,qBAAqB,CAAC,gBAAgB,CAAC,mCACvC,wBAAwB,CAAC,kBAAkB,CAAC,EAC9C,OAAO,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,IAC5C;AACJ,CAAC;AAXD,kFAWC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { baggageUtils } from '@opentelemetry/core';\nimport { diag } from '@opentelemetry/api';\nimport { getSharedConfigurationFromEnvironment } from './shared-env-configuration';\nimport { OtlpHttpConfiguration } from './otlp-http-configuration';\n\nfunction getHeadersFromEnv(signalIdentifier: string) {\n const signalSpecificRawHeaders =\n process.env[`OTEL_EXPORTER_OTLP_${signalIdentifier}_HEADERS`]?.trim();\n const nonSignalSpecificRawHeaders =\n process.env['OTEL_EXPORTER_OTLP_HEADERS']?.trim();\n\n const signalSpecificHeaders = baggageUtils.parseKeyPairsIntoRecord(\n signalSpecificRawHeaders\n );\n const nonSignalSpecificHeaders = baggageUtils.parseKeyPairsIntoRecord(\n nonSignalSpecificRawHeaders\n );\n\n if (\n Object.keys(signalSpecificHeaders).length === 0 &&\n Object.keys(nonSignalSpecificHeaders).length === 0\n ) {\n return undefined;\n }\n\n // headers are combined instead of overwritten, with the specific headers taking precedence over\n // the non-specific ones.\n return Object.assign(\n {},\n baggageUtils.parseKeyPairsIntoRecord(nonSignalSpecificRawHeaders),\n baggageUtils.parseKeyPairsIntoRecord(signalSpecificRawHeaders)\n );\n}\n\nfunction appendRootPathToUrlIfNeeded(url: string): string | undefined {\n try {\n const parsedUrl = new URL(url);\n // This will automatically append '/' if there's no root path.\n return parsedUrl.toString();\n } catch {\n diag.warn(\n `Configuration: Could not parse environment-provided export URL: '${url}', falling back to undefined`\n );\n return undefined;\n }\n}\n\nfunction appendResourcePathToUrl(\n url: string,\n path: string\n): string | undefined {\n try {\n // just try to parse, if it fails we catch and warn.\n new URL(url);\n } catch {\n diag.warn(\n `Configuration: Could not parse environment-provided export URL: '${url}', falling back to undefined`\n );\n return undefined;\n }\n\n if (!url.endsWith('/')) {\n url = url + '/';\n }\n url += path;\n\n try {\n // just try to parse, if it fails we catch and warn.\n new URL(url);\n } catch {\n diag.warn(\n `Configuration: Provided URL appended with '${path}' is not a valid URL, using 'undefined' instead of '${url}'`\n );\n return undefined;\n }\n\n return url;\n}\n\nfunction getNonSpecificUrlFromEnv(\n signalResourcePath: string\n): string | undefined {\n const envUrl = process.env.OTEL_EXPORTER_OTLP_ENDPOINT?.trim();\n if (envUrl == null || envUrl === '') {\n return undefined;\n }\n return appendResourcePathToUrl(envUrl, signalResourcePath);\n}\n\nfunction getSpecificUrlFromEnv(signalIdentifier: string): string | undefined {\n const envUrl =\n process.env[`OTEL_EXPORTER_OTLP_${signalIdentifier}_ENDPOINT`]?.trim();\n if (envUrl == null || envUrl === '') {\n return undefined;\n }\n return appendRootPathToUrlIfNeeded(envUrl);\n}\n\n/**\n * Reads and returns configuration from the environment\n *\n * @param signalIdentifier all caps part in environment variables that identifies the signal (e.g.: METRICS, TRACES, LOGS)\n * @param signalResourcePath signal resource path to append if necessary (e.g.: v1/metrics, v1/traces, v1/logs)\n */\nexport function getHttpConfigurationFromEnvironment(\n signalIdentifier: string,\n signalResourcePath: string\n): Partial<OtlpHttpConfiguration> {\n return {\n ...getSharedConfigurationFromEnvironment(signalIdentifier),\n url:\n getSpecificUrlFromEnv(signalIdentifier) ??\n getNonSpecificUrlFromEnv(signalResourcePath),\n headers: getHeadersFromEnv(signalIdentifier),\n };\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration shared across all OTLP exporters
|
|
3
|
+
*
|
|
4
|
+
* Implementation note: anything added here MUST be
|
|
5
|
+
* - platform-agnostic
|
|
6
|
+
* - signal-agnostic
|
|
7
|
+
* - transport-agnostic
|
|
8
|
+
*/
|
|
9
|
+
export interface OtlpSharedConfiguration {
|
|
10
|
+
timeoutMillis: number;
|
|
11
|
+
concurrencyLimit: number;
|
|
12
|
+
compression: 'gzip' | 'none';
|
|
13
|
+
}
|
|
14
|
+
export declare function validateTimeoutMillis(timeoutMillis: number): number;
|
|
15
|
+
/**
|
|
16
|
+
* @param userProvidedConfiguration Configuration options provided by the user in code.
|
|
17
|
+
* @param fallbackConfiguration Fallback to use when the {@link userProvidedConfiguration} does not specify an option.
|
|
18
|
+
* @param defaultConfiguration The defaults as defined by the exporter specification
|
|
19
|
+
*/
|
|
20
|
+
export declare function mergeOtlpSharedConfigurationWithDefaults(userProvidedConfiguration: Partial<OtlpSharedConfiguration>, fallbackConfiguration: Partial<OtlpSharedConfiguration>, defaultConfiguration: OtlpSharedConfiguration): OtlpSharedConfiguration;
|
|
21
|
+
export declare function getSharedConfigurationDefaults(): OtlpSharedConfiguration;
|
|
22
|
+
//# sourceMappingURL=shared-configuration.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright The OpenTelemetry Authors
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.getSharedConfigurationDefaults = exports.mergeOtlpSharedConfigurationWithDefaults = exports.validateTimeoutMillis = void 0;
|
|
19
|
+
function validateTimeoutMillis(timeoutMillis) {
|
|
20
|
+
if (!Number.isNaN(timeoutMillis) &&
|
|
21
|
+
Number.isFinite(timeoutMillis) &&
|
|
22
|
+
timeoutMillis > 0) {
|
|
23
|
+
return timeoutMillis;
|
|
24
|
+
}
|
|
25
|
+
throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${timeoutMillis}')`);
|
|
26
|
+
}
|
|
27
|
+
exports.validateTimeoutMillis = validateTimeoutMillis;
|
|
28
|
+
/**
|
|
29
|
+
* @param userProvidedConfiguration Configuration options provided by the user in code.
|
|
30
|
+
* @param fallbackConfiguration Fallback to use when the {@link userProvidedConfiguration} does not specify an option.
|
|
31
|
+
* @param defaultConfiguration The defaults as defined by the exporter specification
|
|
32
|
+
*/
|
|
33
|
+
function mergeOtlpSharedConfigurationWithDefaults(userProvidedConfiguration, fallbackConfiguration, defaultConfiguration) {
|
|
34
|
+
var _a, _b, _c, _d, _e, _f;
|
|
35
|
+
return {
|
|
36
|
+
timeoutMillis: validateTimeoutMillis((_b = (_a = userProvidedConfiguration.timeoutMillis) !== null && _a !== void 0 ? _a : fallbackConfiguration.timeoutMillis) !== null && _b !== void 0 ? _b : defaultConfiguration.timeoutMillis),
|
|
37
|
+
concurrencyLimit: (_d = (_c = userProvidedConfiguration.concurrencyLimit) !== null && _c !== void 0 ? _c : fallbackConfiguration.concurrencyLimit) !== null && _d !== void 0 ? _d : defaultConfiguration.concurrencyLimit,
|
|
38
|
+
compression: (_f = (_e = userProvidedConfiguration.compression) !== null && _e !== void 0 ? _e : fallbackConfiguration.compression) !== null && _f !== void 0 ? _f : defaultConfiguration.compression,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
exports.mergeOtlpSharedConfigurationWithDefaults = mergeOtlpSharedConfigurationWithDefaults;
|
|
42
|
+
function getSharedConfigurationDefaults() {
|
|
43
|
+
return {
|
|
44
|
+
timeoutMillis: 10000,
|
|
45
|
+
concurrencyLimit: 30,
|
|
46
|
+
compression: 'none',
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
exports.getSharedConfigurationDefaults = getSharedConfigurationDefaults;
|
|
50
|
+
//# sourceMappingURL=shared-configuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-configuration.js","sourceRoot":"","sources":["../../../src/configuration/shared-configuration.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAgBH,SAAgB,qBAAqB,CAAC,aAAqB;IACzD,IACE,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC;QAC5B,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC;QAC9B,aAAa,GAAG,CAAC,EACjB;QACA,OAAO,aAAa,CAAC;KACtB;IACD,MAAM,IAAI,KAAK,CACb,qFAAqF,aAAa,IAAI,CACvG,CAAC;AACJ,CAAC;AAXD,sDAWC;AAED;;;;GAIG;AACH,SAAgB,wCAAwC,CACtD,yBAA2D,EAC3D,qBAAuD,EACvD,oBAA6C;;IAE7C,OAAO;QACL,aAAa,EAAE,qBAAqB,CAClC,MAAA,MAAA,yBAAyB,CAAC,aAAa,mCACrC,qBAAqB,CAAC,aAAa,mCACnC,oBAAoB,CAAC,aAAa,CACrC;QACD,gBAAgB,EACd,MAAA,MAAA,yBAAyB,CAAC,gBAAgB,mCAC1C,qBAAqB,CAAC,gBAAgB,mCACtC,oBAAoB,CAAC,gBAAgB;QACvC,WAAW,EACT,MAAA,MAAA,yBAAyB,CAAC,WAAW,mCACrC,qBAAqB,CAAC,WAAW,mCACjC,oBAAoB,CAAC,WAAW;KACnC,CAAC;AACJ,CAAC;AApBD,4FAoBC;AAED,SAAgB,8BAA8B;IAC5C,OAAO;QACL,aAAa,EAAE,KAAK;QACpB,gBAAgB,EAAE,EAAE;QACpB,WAAW,EAAE,MAAM;KACpB,CAAC;AACJ,CAAC;AAND,wEAMC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Configuration shared across all OTLP exporters\n *\n * Implementation note: anything added here MUST be\n * - platform-agnostic\n * - signal-agnostic\n * - transport-agnostic\n */\nexport interface OtlpSharedConfiguration {\n timeoutMillis: number;\n concurrencyLimit: number;\n compression: 'gzip' | 'none';\n}\n\nexport function validateTimeoutMillis(timeoutMillis: number) {\n if (\n !Number.isNaN(timeoutMillis) &&\n Number.isFinite(timeoutMillis) &&\n timeoutMillis > 0\n ) {\n return timeoutMillis;\n }\n throw new Error(\n `Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${timeoutMillis}')`\n );\n}\n\n/**\n * @param userProvidedConfiguration Configuration options provided by the user in code.\n * @param fallbackConfiguration Fallback to use when the {@link userProvidedConfiguration} does not specify an option.\n * @param defaultConfiguration The defaults as defined by the exporter specification\n */\nexport function mergeOtlpSharedConfigurationWithDefaults(\n userProvidedConfiguration: Partial<OtlpSharedConfiguration>,\n fallbackConfiguration: Partial<OtlpSharedConfiguration>,\n defaultConfiguration: OtlpSharedConfiguration\n): OtlpSharedConfiguration {\n return {\n timeoutMillis: validateTimeoutMillis(\n userProvidedConfiguration.timeoutMillis ??\n fallbackConfiguration.timeoutMillis ??\n defaultConfiguration.timeoutMillis\n ),\n concurrencyLimit:\n userProvidedConfiguration.concurrencyLimit ??\n fallbackConfiguration.concurrencyLimit ??\n defaultConfiguration.concurrencyLimit,\n compression:\n userProvidedConfiguration.compression ??\n fallbackConfiguration.compression ??\n defaultConfiguration.compression,\n };\n}\n\nexport function getSharedConfigurationDefaults(): OtlpSharedConfiguration {\n return {\n timeoutMillis: 10000,\n concurrencyLimit: 30,\n compression: 'none',\n };\n}\n"]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSharedConfigurationFromEnvironment = void 0;
|
|
4
|
+
const api_1 = require("@opentelemetry/api");
|
|
5
|
+
function parseAndValidateTimeoutFromEnv(timeoutEnvVar) {
|
|
6
|
+
var _a;
|
|
7
|
+
const envTimeout = (_a = process.env[timeoutEnvVar]) === null || _a === void 0 ? void 0 : _a.trim();
|
|
8
|
+
if (envTimeout != null && envTimeout !== '') {
|
|
9
|
+
const definedTimeout = Number(envTimeout);
|
|
10
|
+
if (!Number.isNaN(definedTimeout) &&
|
|
11
|
+
Number.isFinite(definedTimeout) &&
|
|
12
|
+
definedTimeout > 0) {
|
|
13
|
+
return definedTimeout;
|
|
14
|
+
}
|
|
15
|
+
api_1.diag.warn(`Configuration: ${timeoutEnvVar} is invalid, expected number greater than 0 (actual: ${envTimeout})`);
|
|
16
|
+
}
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
function getTimeoutFromEnv(signalIdentifier) {
|
|
20
|
+
const specificTimeout = parseAndValidateTimeoutFromEnv(`OTEL_EXPORTER_OTLP_${signalIdentifier}_TIMEOUT`);
|
|
21
|
+
const nonSpecificTimeout = parseAndValidateTimeoutFromEnv('OTEL_EXPORTER_OTLP_TIMEOUT');
|
|
22
|
+
return specificTimeout !== null && specificTimeout !== void 0 ? specificTimeout : nonSpecificTimeout;
|
|
23
|
+
}
|
|
24
|
+
function parseAndValidateCompressionFromEnv(compressionEnvVar) {
|
|
25
|
+
var _a;
|
|
26
|
+
const compression = (_a = process.env[compressionEnvVar]) === null || _a === void 0 ? void 0 : _a.trim();
|
|
27
|
+
if (compression === '') {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
if (compression == null || compression === 'none' || compression === 'gzip') {
|
|
31
|
+
return compression;
|
|
32
|
+
}
|
|
33
|
+
api_1.diag.warn(`Configuration: ${compressionEnvVar} is invalid, expected 'none' or 'gzip' (actual: '${compression}')`);
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
function getCompressionFromEnv(signalIdentifier) {
|
|
37
|
+
const specificCompression = parseAndValidateCompressionFromEnv(`OTEL_EXPORTER_OTLP_${signalIdentifier}_COMPRESSION`);
|
|
38
|
+
const nonSpecificCompression = parseAndValidateCompressionFromEnv('OTEL_EXPORTER_OTLP_COMPRESSION');
|
|
39
|
+
return specificCompression !== null && specificCompression !== void 0 ? specificCompression : nonSpecificCompression;
|
|
40
|
+
}
|
|
41
|
+
function getSharedConfigurationFromEnvironment(signalIdentifier) {
|
|
42
|
+
return {
|
|
43
|
+
timeoutMillis: getTimeoutFromEnv(signalIdentifier),
|
|
44
|
+
compression: getCompressionFromEnv(signalIdentifier),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
exports.getSharedConfigurationFromEnvironment = getSharedConfigurationFromEnvironment;
|
|
48
|
+
//# sourceMappingURL=shared-env-configuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-env-configuration.js","sourceRoot":"","sources":["../../../src/configuration/shared-env-configuration.ts"],"names":[],"mappings":";;;AAgBA,4CAA0C;AAE1C,SAAS,8BAA8B,CACrC,aAAqB;;IAErB,MAAM,UAAU,GAAG,MAAA,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,0CAAE,IAAI,EAAE,CAAC;IACtD,IAAI,UAAU,IAAI,IAAI,IAAI,UAAU,KAAK,EAAE,EAAE;QAC3C,MAAM,cAAc,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;QAC1C,IACE,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC;YAC7B,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC;YAC/B,cAAc,GAAG,CAAC,EAClB;YACA,OAAO,cAAc,CAAC;SACvB;QACD,UAAI,CAAC,IAAI,CACP,kBAAkB,aAAa,wDAAwD,UAAU,GAAG,CACrG,CAAC;KACH;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,iBAAiB,CAAC,gBAAwB;IACjD,MAAM,eAAe,GAAG,8BAA8B,CACpD,sBAAsB,gBAAgB,UAAU,CACjD,CAAC;IACF,MAAM,kBAAkB,GAAG,8BAA8B,CACvD,4BAA4B,CAC7B,CAAC;IAEF,OAAO,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,kBAAkB,CAAC;AAC/C,CAAC;AAED,SAAS,kCAAkC,CACzC,iBAAyB;;IAEzB,MAAM,WAAW,GAAG,MAAA,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,0CAAE,IAAI,EAAE,CAAC;IAC3D,IAAI,WAAW,KAAK,EAAE,EAAE;QACtB,OAAO,SAAS,CAAC;KAClB;IAED,IAAI,WAAW,IAAI,IAAI,IAAI,WAAW,KAAK,MAAM,IAAI,WAAW,KAAK,MAAM,EAAE;QAC3E,OAAO,WAAW,CAAC;KACpB;IAED,UAAI,CAAC,IAAI,CACP,kBAAkB,iBAAiB,oDAAoD,WAAW,IAAI,CACvG,CAAC;IACF,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,qBAAqB,CAC5B,gBAAwB;IAExB,MAAM,mBAAmB,GAAG,kCAAkC,CAC5D,sBAAsB,gBAAgB,cAAc,CACrD,CAAC;IACF,MAAM,sBAAsB,GAAG,kCAAkC,CAC/D,gCAAgC,CACjC,CAAC;IAEF,OAAO,mBAAmB,aAAnB,mBAAmB,cAAnB,mBAAmB,GAAI,sBAAsB,CAAC;AACvD,CAAC;AAED,SAAgB,qCAAqC,CACnD,gBAAwB;IAExB,OAAO;QACL,aAAa,EAAE,iBAAiB,CAAC,gBAAgB,CAAC;QAClD,WAAW,EAAE,qBAAqB,CAAC,gBAAgB,CAAC;KACrD,CAAC;AACJ,CAAC;AAPD,sFAOC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { OtlpSharedConfiguration } from './shared-configuration';\nimport { diag } from '@opentelemetry/api';\n\nfunction parseAndValidateTimeoutFromEnv(\n timeoutEnvVar: string\n): number | undefined {\n const envTimeout = process.env[timeoutEnvVar]?.trim();\n if (envTimeout != null && envTimeout !== '') {\n const definedTimeout = Number(envTimeout);\n if (\n !Number.isNaN(definedTimeout) &&\n Number.isFinite(definedTimeout) &&\n definedTimeout > 0\n ) {\n return definedTimeout;\n }\n diag.warn(\n `Configuration: ${timeoutEnvVar} is invalid, expected number greater than 0 (actual: ${envTimeout})`\n );\n }\n return undefined;\n}\n\nfunction getTimeoutFromEnv(signalIdentifier: string) {\n const specificTimeout = parseAndValidateTimeoutFromEnv(\n `OTEL_EXPORTER_OTLP_${signalIdentifier}_TIMEOUT`\n );\n const nonSpecificTimeout = parseAndValidateTimeoutFromEnv(\n 'OTEL_EXPORTER_OTLP_TIMEOUT'\n );\n\n return specificTimeout ?? nonSpecificTimeout;\n}\n\nfunction parseAndValidateCompressionFromEnv(\n compressionEnvVar: string\n): 'none' | 'gzip' | undefined {\n const compression = process.env[compressionEnvVar]?.trim();\n if (compression === '') {\n return undefined;\n }\n\n if (compression == null || compression === 'none' || compression === 'gzip') {\n return compression;\n }\n\n diag.warn(\n `Configuration: ${compressionEnvVar} is invalid, expected 'none' or 'gzip' (actual: '${compression}')`\n );\n return undefined;\n}\n\nfunction getCompressionFromEnv(\n signalIdentifier: string\n): 'none' | 'gzip' | undefined {\n const specificCompression = parseAndValidateCompressionFromEnv(\n `OTEL_EXPORTER_OTLP_${signalIdentifier}_COMPRESSION`\n );\n const nonSpecificCompression = parseAndValidateCompressionFromEnv(\n 'OTEL_EXPORTER_OTLP_COMPRESSION'\n );\n\n return specificCompression ?? nonSpecificCompression;\n}\n\nexport function getSharedConfigurationFromEnvironment(\n signalIdentifier: string\n): Partial<OtlpSharedConfiguration> {\n return {\n timeoutMillis: getTimeoutFromEnv(signalIdentifier),\n compression: getCompressionFromEnv(signalIdentifier),\n };\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface ExportResponseSuccess {
|
|
2
|
+
status: 'success';
|
|
3
|
+
data?: Uint8Array;
|
|
4
|
+
}
|
|
5
|
+
export interface ExportResponseFailure {
|
|
6
|
+
status: 'failure';
|
|
7
|
+
error: Error;
|
|
8
|
+
}
|
|
9
|
+
export interface ExportResponseRetryable {
|
|
10
|
+
status: 'retryable';
|
|
11
|
+
retryInMillis?: number;
|
|
12
|
+
}
|
|
13
|
+
export declare type ExportResponse = ExportResponseSuccess | ExportResponseFailure | ExportResponseRetryable;
|
|
14
|
+
//# sourceMappingURL=export-response.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright The OpenTelemetry Authors
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
//# sourceMappingURL=export-response.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-response.js","sourceRoot":"","sources":["../../src/export-response.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport interface ExportResponseSuccess {\n status: 'success';\n data?: Uint8Array;\n}\n\nexport interface ExportResponseFailure {\n status: 'failure';\n error: Error;\n}\n\nexport interface ExportResponseRetryable {\n status: 'retryable';\n retryInMillis?: number;\n}\n\nexport type ExportResponse =\n | ExportResponseSuccess\n | ExportResponseFailure\n | ExportResponseRetryable;\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright The OpenTelemetry Authors
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
//# sourceMappingURL=exporter-transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exporter-transport.js","sourceRoot":"","sources":["../../src/exporter-transport.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ExportResponse } from './export-response';\n\nexport interface IExporterTransport {\n send(data: Uint8Array, timeoutMillis: number): Promise<ExportResponse>;\n shutdown(): void;\n}\n"]}
|
package/build/src/index.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export * from './platform';
|
|
2
2
|
export { OTLPExporterBase } from './OTLPExporterBase';
|
|
3
3
|
export { OTLPExporterError, OTLPExporterConfigBase, ExportServiceError, } from './types';
|
|
4
|
-
export {
|
|
4
|
+
export { validateAndNormalizeHeaders } from './util';
|
|
5
|
+
export { ExportResponse, ExportResponseFailure, ExportResponseSuccess, ExportResponseRetryable, } from './export-response';
|
|
6
|
+
export { IExporterTransport } from './exporter-transport';
|
|
7
|
+
export { OtlpSharedConfiguration, mergeOtlpSharedConfigurationWithDefaults, getSharedConfigurationDefaults, } from './configuration/shared-configuration';
|
|
8
|
+
export { getSharedConfigurationFromEnvironment } from './configuration/shared-env-configuration';
|
|
5
9
|
//# sourceMappingURL=index.d.ts.map
|