@opentelemetry/otlp-exporter-base 0.57.2 → 0.200.0-dev.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.js +10 -11
- package/build/esm/OTLPExporterBase.js.map +1 -1
- package/build/esm/bounded-queue-export-promise-handler.js +15 -61
- package/build/esm/bounded-queue-export-promise-handler.js.map +1 -1
- package/build/esm/configuration/convert-legacy-node-http-options.js +1 -1
- package/build/esm/configuration/convert-legacy-node-http-options.js.map +1 -1
- package/build/esm/configuration/create-legacy-browser-delegate.js +2 -2
- package/build/esm/configuration/create-legacy-browser-delegate.js.map +1 -1
- package/build/esm/configuration/legacy-node-configuration.d.ts +1 -0
- package/build/esm/configuration/otlp-http-configuration.d.ts +1 -0
- package/build/esm/configuration/otlp-http-configuration.js +22 -18
- package/build/esm/configuration/otlp-http-configuration.js.map +1 -1
- package/build/esm/configuration/otlp-http-env-configuration.js +21 -31
- package/build/esm/configuration/otlp-http-env-configuration.js.map +1 -1
- package/build/esm/configuration/shared-configuration.js +12 -9
- package/build/esm/configuration/shared-configuration.js.map +1 -1
- package/build/esm/configuration/shared-env-configuration.js +12 -16
- package/build/esm/configuration/shared-env-configuration.js.map +1 -1
- package/build/esm/export-response.d.ts +1 -1
- package/build/esm/is-export-retryable.js +3 -3
- package/build/esm/is-export-retryable.js.map +1 -1
- package/build/esm/logging-response-handler.js +1 -1
- package/build/esm/logging-response-handler.js.map +1 -1
- package/build/esm/otlp-export-delegate.js +26 -70
- package/build/esm/otlp-export-delegate.js.map +1 -1
- package/build/esm/otlp-network-export-delegate.js +1 -1
- package/build/esm/otlp-network-export-delegate.js.map +1 -1
- package/build/esm/retrying-transport.js +36 -86
- package/build/esm/retrying-transport.js.map +1 -1
- package/build/esm/transport/http-exporter-transport.js +28 -64
- package/build/esm/transport/http-exporter-transport.js.map +1 -1
- package/build/esm/transport/http-transport-types.d.ts +2 -1
- package/build/esm/transport/http-transport-utils.d.ts +1 -0
- package/build/esm/transport/http-transport-utils.js +24 -33
- package/build/esm/transport/http-transport-utils.js.map +1 -1
- package/build/esm/transport/send-beacon-transport.js +10 -11
- package/build/esm/transport/send-beacon-transport.js.map +1 -1
- package/build/esm/transport/xhr-transport.js +17 -35
- package/build/esm/transport/xhr-transport.js.map +1 -1
- package/build/esm/types.js +9 -26
- package/build/esm/types.js.map +1 -1
- package/build/esm/util.js +4 -22
- 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.js +1 -0
- package/build/esnext/OTLPExporterBase.js.map +1 -1
- package/build/esnext/bounded-queue-export-promise-handler.js +2 -1
- package/build/esnext/bounded-queue-export-promise-handler.js.map +1 -1
- package/build/esnext/configuration/convert-legacy-node-http-options.js +1 -1
- package/build/esnext/configuration/convert-legacy-node-http-options.js.map +1 -1
- package/build/esnext/configuration/legacy-node-configuration.d.ts +1 -0
- package/build/esnext/configuration/otlp-http-configuration.d.ts +1 -0
- package/build/esnext/configuration/otlp-http-configuration.js +19 -4
- package/build/esnext/configuration/otlp-http-configuration.js.map +1 -1
- package/build/esnext/configuration/otlp-http-env-configuration.js +17 -16
- package/build/esnext/configuration/otlp-http-env-configuration.js.map +1 -1
- package/build/esnext/configuration/shared-configuration.js +10 -7
- package/build/esnext/configuration/shared-configuration.js.map +1 -1
- package/build/esnext/configuration/shared-env-configuration.js +5 -9
- package/build/esnext/configuration/shared-env-configuration.js.map +1 -1
- package/build/esnext/export-response.d.ts +1 -1
- package/build/esnext/otlp-export-delegate.js +6 -0
- package/build/esnext/otlp-export-delegate.js.map +1 -1
- package/build/esnext/retrying-transport.js +2 -2
- package/build/esnext/retrying-transport.js.map +1 -1
- package/build/esnext/transport/http-exporter-transport.js +18 -14
- package/build/esnext/transport/http-exporter-transport.js.map +1 -1
- package/build/esnext/transport/http-transport-types.d.ts +2 -1
- package/build/esnext/transport/http-transport-utils.d.ts +1 -0
- package/build/esnext/transport/http-transport-utils.js +4 -2
- package/build/esnext/transport/http-transport-utils.js.map +1 -1
- package/build/esnext/transport/send-beacon-transport.js +1 -0
- package/build/esnext/transport/send-beacon-transport.js.map +1 -1
- package/build/esnext/transport/xhr-transport.js +1 -0
- package/build/esnext/transport/xhr-transport.js.map +1 -1
- package/build/esnext/types.js +3 -1
- package/build/esnext/types.js.map +1 -1
- package/build/esnext/util.js +1 -2
- 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.js +1 -0
- package/build/src/OTLPExporterBase.js.map +1 -1
- package/build/src/bounded-queue-export-promise-handler.js +2 -1
- package/build/src/bounded-queue-export-promise-handler.js.map +1 -1
- package/build/src/configuration/convert-legacy-node-http-options.js +1 -1
- package/build/src/configuration/convert-legacy-node-http-options.js.map +1 -1
- package/build/src/configuration/legacy-node-configuration.d.ts +1 -0
- package/build/src/configuration/otlp-http-configuration.d.ts +1 -0
- package/build/src/configuration/otlp-http-configuration.js +19 -4
- package/build/src/configuration/otlp-http-configuration.js.map +1 -1
- package/build/src/configuration/otlp-http-env-configuration.js +16 -15
- package/build/src/configuration/otlp-http-env-configuration.js.map +1 -1
- package/build/src/configuration/shared-configuration.js +10 -7
- package/build/src/configuration/shared-configuration.js.map +1 -1
- package/build/src/configuration/shared-env-configuration.js +5 -9
- package/build/src/configuration/shared-env-configuration.js.map +1 -1
- package/build/src/export-response.d.ts +1 -1
- package/build/src/otlp-export-delegate.js +6 -0
- package/build/src/otlp-export-delegate.js.map +1 -1
- package/build/src/retrying-transport.js +2 -2
- package/build/src/retrying-transport.js.map +1 -1
- package/build/src/transport/http-exporter-transport.js +18 -14
- package/build/src/transport/http-exporter-transport.js.map +1 -1
- package/build/src/transport/http-transport-types.d.ts +2 -1
- package/build/src/transport/http-transport-utils.d.ts +1 -0
- package/build/src/transport/http-transport-utils.js +4 -2
- package/build/src/transport/http-transport-utils.js.map +1 -1
- package/build/src/transport/send-beacon-transport.js +1 -0
- package/build/src/transport/send-beacon-transport.js.map +1 -1
- package/build/src/transport/xhr-transport.js +1 -0
- package/build/src/transport/xhr-transport.js.map +1 -1
- package/build/src/types.js +3 -1
- package/build/src/types.js.map +1 -1
- package/build/src/util.js +1 -2
- 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 -27
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
export class OTLPExporterBase {
|
|
17
|
+
_delegate;
|
|
18
|
+
constructor(_delegate) {
|
|
18
19
|
this._delegate = _delegate;
|
|
19
20
|
}
|
|
20
21
|
/**
|
|
@@ -22,16 +23,14 @@ var OTLPExporterBase = /** @class */ (function () {
|
|
|
22
23
|
* @param items
|
|
23
24
|
* @param resultCallback
|
|
24
25
|
*/
|
|
25
|
-
|
|
26
|
+
export(items, resultCallback) {
|
|
26
27
|
this._delegate.export(items, resultCallback);
|
|
27
|
-
}
|
|
28
|
-
|
|
28
|
+
}
|
|
29
|
+
forceFlush() {
|
|
29
30
|
return this._delegate.forceFlush();
|
|
30
|
-
}
|
|
31
|
-
|
|
31
|
+
}
|
|
32
|
+
shutdown() {
|
|
32
33
|
return this._delegate.shutdown();
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
}());
|
|
36
|
-
export { OTLPExporterBase };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
37
36
|
//# sourceMappingURL=OTLPExporterBase.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OTLPExporterBase.js","sourceRoot":"","sources":["../../src/OTLPExporterBase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH;
|
|
1
|
+
{"version":3,"file":"OTLPExporterBase.js","sourceRoot":"","sources":["../../src/OTLPExporterBase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,MAAM,OAAO,gBAAgB;IACP;IAApB,YAAoB,SAAwC;QAAxC,cAAS,GAAT,SAAS,CAA+B;IAAG,CAAC;IAEhE;;;;OAIG;IACH,MAAM,CACJ,KAAe,EACf,cAA8C;QAE9C,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;IAC/C,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;IACnC,CAAC;CACF","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 { ExportResult } from '@opentelemetry/core';\nimport { IOtlpExportDelegate } from './otlp-export-delegate';\n\nexport class OTLPExporterBase<Internal> {\n constructor(private _delegate: IOtlpExportDelegate<Internal>) {}\n\n /**\n * Export items.\n * @param items\n * @param resultCallback\n */\n export(\n items: Internal,\n resultCallback: (result: ExportResult) => void\n ): void {\n this._delegate.export(items, resultCallback);\n }\n\n forceFlush(): Promise<void> {\n return this._delegate.forceFlush();\n }\n\n shutdown(): Promise<void> {\n return this._delegate.shutdown();\n }\n}\n"]}
|
|
@@ -13,79 +13,33 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
26
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
27
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
28
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
29
|
-
function step(op) {
|
|
30
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
31
|
-
while (_) try {
|
|
32
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
33
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
34
|
-
switch (op[0]) {
|
|
35
|
-
case 0: case 1: t = op; break;
|
|
36
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
37
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
38
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
39
|
-
default:
|
|
40
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
41
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
42
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
43
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
44
|
-
if (t[2]) _.ops.pop();
|
|
45
|
-
_.trys.pop(); continue;
|
|
46
|
-
}
|
|
47
|
-
op = body.call(thisArg, _);
|
|
48
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
49
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
var BoundedQueueExportPromiseHandler = /** @class */ (function () {
|
|
16
|
+
class BoundedQueueExportPromiseHandler {
|
|
17
|
+
_concurrencyLimit;
|
|
18
|
+
_sendingPromises = [];
|
|
53
19
|
/**
|
|
54
20
|
* @param concurrencyLimit maximum promises allowed in a queue at the same time.
|
|
55
21
|
*/
|
|
56
|
-
|
|
57
|
-
this._sendingPromises = [];
|
|
22
|
+
constructor(concurrencyLimit) {
|
|
58
23
|
this._concurrencyLimit = concurrencyLimit;
|
|
59
24
|
}
|
|
60
|
-
|
|
61
|
-
var _this = this;
|
|
25
|
+
pushPromise(promise) {
|
|
62
26
|
if (this.hasReachedLimit()) {
|
|
63
27
|
throw new Error('Concurrency Limit reached');
|
|
64
28
|
}
|
|
65
29
|
this._sendingPromises.push(promise);
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
30
|
+
const popPromise = () => {
|
|
31
|
+
const index = this._sendingPromises.indexOf(promise);
|
|
32
|
+
this._sendingPromises.splice(index, 1);
|
|
69
33
|
};
|
|
70
34
|
promise.then(popPromise, popPromise);
|
|
71
|
-
}
|
|
72
|
-
|
|
35
|
+
}
|
|
36
|
+
hasReachedLimit() {
|
|
73
37
|
return this._sendingPromises.length >= this._concurrencyLimit;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
case 0: return [4 /*yield*/, Promise.all(this._sendingPromises)];
|
|
80
|
-
case 1:
|
|
81
|
-
_a.sent();
|
|
82
|
-
return [2 /*return*/];
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
|
-
return BoundedQueueExportPromiseHandler;
|
|
88
|
-
}());
|
|
38
|
+
}
|
|
39
|
+
async awaitAll() {
|
|
40
|
+
await Promise.all(this._sendingPromises);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
89
43
|
/**
|
|
90
44
|
* Promise queue for keeping track of export promises. Finished promises will be auto-dequeued.
|
|
91
45
|
* Allows for awaiting all promises in the queue.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bounded-queue-export-promise-handler.js","sourceRoot":"","sources":["../../src/bounded-queue-export-promise-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG
|
|
1
|
+
{"version":3,"file":"bounded-queue-export-promise-handler.js","sourceRoot":"","sources":["../../src/bounded-queue-export-promise-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAQH,MAAM,gCAAgC;IACnB,iBAAiB,CAAS;IACnC,gBAAgB,GAAuB,EAAE,CAAC;IAElD;;OAEG;IACH,YAAY,gBAAwB;QAClC,IAAI,CAAC,iBAAiB,GAAG,gBAAgB,CAAC;IAC5C,CAAC;IAEM,WAAW,CAAC,OAAsB;QACvC,IAAI,IAAI,CAAC,eAAe,EAAE,EAAE;YAC1B,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;SAC9C;QAED,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpC,MAAM,UAAU,GAAG,GAAG,EAAE;YACtB,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACrD,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QACzC,CAAC,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACvC,CAAC;IAEM,eAAe;QACpB,OAAO,IAAI,CAAC,gBAAgB,CAAC,MAAM,IAAI,IAAI,CAAC,iBAAiB,CAAC;IAChE,CAAC;IAEM,KAAK,CAAC,QAAQ;QACnB,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC3C,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,UAAU,sCAAsC,CAAC,OAEtD;IACC,OAAO,IAAI,gCAAgC,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;AACxE,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\nexport interface IExportPromiseHandler {\n pushPromise(promise: Promise<void>): void;\n hasReachedLimit(): boolean;\n awaitAll(): Promise<void>;\n}\n\nclass BoundedQueueExportPromiseHandler implements IExportPromiseHandler {\n private readonly _concurrencyLimit: number;\n private _sendingPromises: Promise<unknown>[] = [];\n\n /**\n * @param concurrencyLimit maximum promises allowed in a queue at the same time.\n */\n constructor(concurrencyLimit: number) {\n this._concurrencyLimit = concurrencyLimit;\n }\n\n public pushPromise(promise: Promise<void>): void {\n if (this.hasReachedLimit()) {\n throw new Error('Concurrency Limit reached');\n }\n\n this._sendingPromises.push(promise);\n const popPromise = () => {\n const index = this._sendingPromises.indexOf(promise);\n this._sendingPromises.splice(index, 1);\n };\n promise.then(popPromise, popPromise);\n }\n\n public hasReachedLimit(): boolean {\n return this._sendingPromises.length >= this._concurrencyLimit;\n }\n\n public async awaitAll(): Promise<void> {\n await Promise.all(this._sendingPromises);\n }\n}\n\n/**\n * Promise queue for keeping track of export promises. Finished promises will be auto-dequeued.\n * Allows for awaiting all promises in the queue.\n */\nexport function createBoundedQueueExportPromiseHandler(options: {\n concurrencyLimit: number;\n}): IExportPromiseHandler {\n return new BoundedQueueExportPromiseHandler(options.concurrencyLimit);\n}\n"]}
|
|
@@ -4,7 +4,7 @@ import { diag } from '@opentelemetry/api';
|
|
|
4
4
|
import { wrapStaticHeadersInFunction } from './shared-configuration';
|
|
5
5
|
function convertLegacyAgentOptions(config) {
|
|
6
6
|
// populate keepAlive for use with new settings
|
|
7
|
-
if (
|
|
7
|
+
if (config?.keepAlive != null) {
|
|
8
8
|
if (config.httpAgentOptions != null) {
|
|
9
9
|
if (config.httpAgentOptions.keepAlive == null) {
|
|
10
10
|
// specific setting is not set, populate with non-specific setting.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-legacy-node-http-options.js","sourceRoot":"","sources":["../../../src/configuration/convert-legacy-node-http-options.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,4BAA4B,EAC5B,sCAAsC,GAEvC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,mCAAmC,EAAE,MAAM,+BAA+B,CAAC;AAGpF,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAErE,SAAS,yBAAyB,CAChC,MAAkC;IAElC,+CAA+C;IAC/C,IAAI,
|
|
1
|
+
{"version":3,"file":"convert-legacy-node-http-options.js","sourceRoot":"","sources":["../../../src/configuration/convert-legacy-node-http-options.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,4BAA4B,EAC5B,sCAAsC,GAEvC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,mCAAmC,EAAE,MAAM,+BAA+B,CAAC;AAGpF,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAErE,SAAS,yBAAyB,CAChC,MAAkC;IAElC,+CAA+C;IAC/C,IAAI,MAAM,EAAE,SAAS,IAAI,IAAI,EAAE;QAC7B,IAAI,MAAM,CAAC,gBAAgB,IAAI,IAAI,EAAE;YACnC,IAAI,MAAM,CAAC,gBAAgB,CAAC,SAAS,IAAI,IAAI,EAAE;gBAC7C,mEAAmE;gBACnE,MAAM,CAAC,gBAAgB,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;aACtD;YACD,6CAA6C;SAC9C;aAAM;YACL,2DAA2D;YAC3D,MAAM,CAAC,gBAAgB,GAAG;gBACxB,SAAS,EAAE,MAAM,CAAC,SAAS;aAC5B,CAAC;SACH;KACF;IAED,OAAO,MAAM,CAAC,gBAAgB,CAAC;AACjC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CACtC,MAAkC,EAClC,gBAAwB,EACxB,kBAA0B,EAC1B,eAAuC;IAEvC,8DAA8D;IAC9D,IAAK,MAAc,CAAC,QAAQ,EAAE;QAC5B,IAAI,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAC;KACrD;IAED,OAAO,sCAAsC,CAC3C;QACE,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,OAAO,EAAE,2BAA2B,CAAC,MAAM,CAAC,OAAO,CAAC;QACpD,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;QACzC,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,YAAY,EAAE,yBAAyB,CAAC,MAAM,CAAC;KAChD,EACD,mCAAmC,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,EACzE,4BAA4B,CAAC,eAAe,EAAE,kBAAkB,CAAC,CAClE,CAAC;AACJ,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 */\nimport { OTLPExporterNodeConfigBase } from './legacy-node-configuration';\nimport {\n getHttpConfigurationDefaults,\n mergeOtlpHttpConfigurationWithDefaults,\n OtlpHttpConfiguration,\n} from './otlp-http-configuration';\nimport { getHttpConfigurationFromEnvironment } from './otlp-http-env-configuration';\nimport type * as http from 'http';\nimport type * as https from 'https';\nimport { diag } from '@opentelemetry/api';\nimport { wrapStaticHeadersInFunction } from './shared-configuration';\n\nfunction convertLegacyAgentOptions(\n config: OTLPExporterNodeConfigBase\n): http.AgentOptions | https.AgentOptions | undefined {\n // populate keepAlive for use with new settings\n if (config?.keepAlive != null) {\n if (config.httpAgentOptions != null) {\n if (config.httpAgentOptions.keepAlive == null) {\n // specific setting is not set, populate with non-specific setting.\n config.httpAgentOptions.keepAlive = config.keepAlive;\n }\n // do nothing, use specific setting otherwise\n } else {\n // populate specific option if AgentOptions does not exist.\n config.httpAgentOptions = {\n keepAlive: config.keepAlive,\n };\n }\n }\n\n return config.httpAgentOptions;\n}\n\n/**\n * @deprecated this will be removed in 2.0\n * @param config\n * @param signalIdentifier\n * @param signalResourcePath\n * @param requiredHeaders\n */\nexport function convertLegacyHttpOptions(\n config: OTLPExporterNodeConfigBase,\n signalIdentifier: string,\n signalResourcePath: string,\n requiredHeaders: Record<string, string>\n): OtlpHttpConfiguration {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if ((config as any).metadata) {\n diag.warn('Metadata cannot be set when using http');\n }\n\n return mergeOtlpHttpConfigurationWithDefaults(\n {\n url: config.url,\n headers: wrapStaticHeadersInFunction(config.headers),\n concurrencyLimit: config.concurrencyLimit,\n timeoutMillis: config.timeoutMillis,\n compression: config.compression,\n agentOptions: convertLegacyAgentOptions(config),\n },\n getHttpConfigurationFromEnvironment(signalIdentifier, signalResourcePath),\n getHttpConfigurationDefaults(requiredHeaders, signalResourcePath)\n );\n}\n"]}
|
|
@@ -8,8 +8,8 @@ import { convertLegacyBrowserHttpOptions } from './convert-legacy-browser-http-o
|
|
|
8
8
|
* @param requiredHeaders
|
|
9
9
|
*/
|
|
10
10
|
export function createLegacyOtlpBrowserExportDelegate(config, serializer, signalResourcePath, requiredHeaders) {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const useXhr = !!config.headers || typeof navigator.sendBeacon !== 'function';
|
|
12
|
+
const options = convertLegacyBrowserHttpOptions(config, signalResourcePath, requiredHeaders);
|
|
13
13
|
if (useXhr) {
|
|
14
14
|
return createOtlpXhrExportDelegate(options, serializer);
|
|
15
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-legacy-browser-delegate.js","sourceRoot":"","sources":["../../../src/configuration/create-legacy-browser-delegate.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,kCAAkC,EAClC,2BAA2B,GAC5B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,+BAA+B,EAAE,MAAM,uCAAuC,CAAC;AAIxF;;;;;;GAMG;AACH,MAAM,UAAU,qCAAqC,CACnD,MAA8B,EAC9B,UAA2C,EAC3C,kBAA0B,EAC1B,eAAuC;IAEvC,
|
|
1
|
+
{"version":3,"file":"create-legacy-browser-delegate.js","sourceRoot":"","sources":["../../../src/configuration/create-legacy-browser-delegate.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,kCAAkC,EAClC,2BAA2B,GAC5B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,+BAA+B,EAAE,MAAM,uCAAuC,CAAC;AAIxF;;;;;;GAMG;AACH,MAAM,UAAU,qCAAqC,CACnD,MAA8B,EAC9B,UAA2C,EAC3C,kBAA0B,EAC1B,eAAuC;IAEvC,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,IAAI,OAAO,SAAS,CAAC,UAAU,KAAK,UAAU,CAAC;IAE9E,MAAM,OAAO,GAAG,+BAA+B,CAC7C,MAAM,EACN,kBAAkB,EAClB,eAAe,CAChB,CAAC;IAEF,IAAI,MAAM,EAAE;QACV,OAAO,2BAA2B,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;KACzD;SAAM;QACL,OAAO,kCAAkC,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;KAChE;AACH,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 */\nimport { ISerializer } from '@opentelemetry/otlp-transformer';\nimport {\n createOtlpSendBeaconExportDelegate,\n createOtlpXhrExportDelegate,\n} from '../otlp-browser-http-export-delegate';\nimport { convertLegacyBrowserHttpOptions } from './convert-legacy-browser-http-options';\nimport { IOtlpExportDelegate } from '../otlp-export-delegate';\nimport { OTLPExporterConfigBase } from './legacy-base-configuration';\n\n/**\n * @deprecated\n * @param config\n * @param serializer\n * @param signalResourcePath\n * @param requiredHeaders\n */\nexport function createLegacyOtlpBrowserExportDelegate<Internal, Response>(\n config: OTLPExporterConfigBase,\n serializer: ISerializer<Internal, Response>,\n signalResourcePath: string,\n requiredHeaders: Record<string, string>\n): IOtlpExportDelegate<Internal> {\n const useXhr = !!config.headers || typeof navigator.sendBeacon !== 'function';\n\n const options = convertLegacyBrowserHttpOptions(\n config,\n signalResourcePath,\n requiredHeaders\n );\n\n if (useXhr) {\n return createOtlpXhrExportDelegate(options, serializer);\n } else {\n return createOtlpSendBeaconExportDelegate(options, serializer);\n }\n}\n"]}
|
|
@@ -13,23 +13,14 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
var __assign = (this && this.__assign) || function () {
|
|
17
|
-
__assign = Object.assign || function(t) {
|
|
18
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
19
|
-
s = arguments[i];
|
|
20
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
21
|
-
t[p] = s[p];
|
|
22
|
-
}
|
|
23
|
-
return t;
|
|
24
|
-
};
|
|
25
|
-
return __assign.apply(this, arguments);
|
|
26
|
-
};
|
|
27
16
|
import { getSharedConfigurationDefaults, mergeOtlpSharedConfigurationWithDefaults, } from './shared-configuration';
|
|
28
17
|
import { validateAndNormalizeHeaders } from '../util';
|
|
29
18
|
function mergeHeaders(userProvidedHeaders, fallbackHeaders, defaultHeaders) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
19
|
+
const requiredHeaders = {
|
|
20
|
+
...defaultHeaders(),
|
|
21
|
+
};
|
|
22
|
+
const headers = {};
|
|
23
|
+
return () => {
|
|
33
24
|
// add fallback ones first
|
|
34
25
|
if (fallbackHeaders != null) {
|
|
35
26
|
Object.assign(headers, fallbackHeaders());
|
|
@@ -51,7 +42,7 @@ function validateUserProvidedUrl(url) {
|
|
|
51
42
|
return url;
|
|
52
43
|
}
|
|
53
44
|
catch (e) {
|
|
54
|
-
throw new Error(
|
|
45
|
+
throw new Error(`Configuration: Could not parse user-provided export URL: '${url}'`);
|
|
55
46
|
}
|
|
56
47
|
}
|
|
57
48
|
/**
|
|
@@ -60,10 +51,23 @@ function validateUserProvidedUrl(url) {
|
|
|
60
51
|
* @param defaultConfiguration The defaults as defined by the exporter specification
|
|
61
52
|
*/
|
|
62
53
|
export function mergeOtlpHttpConfigurationWithDefaults(userProvidedConfiguration, fallbackConfiguration, defaultConfiguration) {
|
|
63
|
-
|
|
64
|
-
|
|
54
|
+
return {
|
|
55
|
+
...mergeOtlpSharedConfigurationWithDefaults(userProvidedConfiguration, fallbackConfiguration, defaultConfiguration),
|
|
56
|
+
headers: mergeHeaders(validateAndNormalizeHeaders(userProvidedConfiguration.headers), fallbackConfiguration.headers, defaultConfiguration.headers),
|
|
57
|
+
url: validateUserProvidedUrl(userProvidedConfiguration.url) ??
|
|
58
|
+
fallbackConfiguration.url ??
|
|
59
|
+
defaultConfiguration.url,
|
|
60
|
+
agentOptions: userProvidedConfiguration.agentOptions ??
|
|
61
|
+
fallbackConfiguration.agentOptions ??
|
|
62
|
+
defaultConfiguration.agentOptions,
|
|
63
|
+
};
|
|
65
64
|
}
|
|
66
65
|
export function getHttpConfigurationDefaults(requiredHeaders, signalResourcePath) {
|
|
67
|
-
return
|
|
66
|
+
return {
|
|
67
|
+
...getSharedConfigurationDefaults(),
|
|
68
|
+
headers: () => requiredHeaders,
|
|
69
|
+
url: 'http://localhost:4318/' + signalResourcePath,
|
|
70
|
+
agentOptions: { keepAlive: true },
|
|
71
|
+
};
|
|
68
72
|
}
|
|
69
73
|
//# sourceMappingURL=otlp-http-configuration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otlp-http-configuration.js","sourceRoot":"","sources":["../../../src/configuration/otlp-http-configuration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG
|
|
1
|
+
{"version":3,"file":"otlp-http-configuration.js","sourceRoot":"","sources":["../../../src/configuration/otlp-http-configuration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,8BAA8B,EAC9B,wCAAwC,GAEzC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAYtD,SAAS,YAAY,CACnB,mBAAsE,EACtE,eAAkE,EAClE,cAA4C;IAE5C,MAAM,eAAe,GAAG;QACtB,GAAG,cAAc,EAAE;KACpB,CAAC;IACF,MAAM,OAAO,GAAG,EAAE,CAAC;IAEnB,OAAO,GAAG,EAAE;QACV,0BAA0B;QAC1B,IAAI,eAAe,IAAI,IAAI,EAAE;YAC3B,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,eAAe,EAAE,CAAC,CAAC;SAC3C;QAED,mCAAmC;QACnC,IAAI,mBAAmB,IAAI,IAAI,EAAE;YAC/B,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,mBAAmB,EAAE,CAAC,CAAC;SAC/C;QAED,0BAA0B;QAC1B,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IACjD,CAAC,CAAC;AACJ,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,MAAM,UAAU,sCAAsC,CACpD,yBAAyD,EACzD,qBAAqD,EACrD,oBAA2C;IAE3C,OAAO;QACL,GAAG,wCAAwC,CACzC,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,CACrB;QACD,OAAO,EAAE,YAAY,CACnB,2BAA2B,CAAC,yBAAyB,CAAC,OAAO,CAAC,EAC9D,qBAAqB,CAAC,OAAO,EAC7B,oBAAoB,CAAC,OAAO,CAC7B;QACD,GAAG,EACD,uBAAuB,CAAC,yBAAyB,CAAC,GAAG,CAAC;YACtD,qBAAqB,CAAC,GAAG;YACzB,oBAAoB,CAAC,GAAG;QAC1B,YAAY,EACV,yBAAyB,CAAC,YAAY;YACtC,qBAAqB,CAAC,YAAY;YAClC,oBAAoB,CAAC,YAAY;KACpC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,4BAA4B,CAC1C,eAAuC,EACvC,kBAA0B;IAE1B,OAAO;QACL,GAAG,8BAA8B,EAAE;QACnC,OAAO,EAAE,GAAG,EAAE,CAAC,eAAe;QAC9B,GAAG,EAAE,wBAAwB,GAAG,kBAAkB;QAClD,YAAY,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE;KAClC,CAAC;AACJ,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 {\n getSharedConfigurationDefaults,\n mergeOtlpSharedConfigurationWithDefaults,\n OtlpSharedConfiguration,\n} from './shared-configuration';\nimport { validateAndNormalizeHeaders } from '../util';\n\n// NOTE: do not change these imports to be actual imports, otherwise they WILL break `@opentelemetry/instrumentation-http`\nimport type * as http from 'http';\nimport type * as https from 'https';\n\nexport interface OtlpHttpConfiguration extends OtlpSharedConfiguration {\n url: string;\n headers: () => Record<string, string>;\n agentOptions: http.AgentOptions | https.AgentOptions;\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 return () => {\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}\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 agentOptions:\n userProvidedConfiguration.agentOptions ??\n fallbackConfiguration.agentOptions ??\n defaultConfiguration.agentOptions,\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 agentOptions: { keepAlive: true },\n };\n}\n"]}
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
/*
|
|
13
2
|
* Copyright The OpenTelemetry Authors
|
|
14
3
|
*
|
|
@@ -24,32 +13,31 @@ var __assign = (this && this.__assign) || function () {
|
|
|
24
13
|
* See the License for the specific language governing permissions and
|
|
25
14
|
* limitations under the License.
|
|
26
15
|
*/
|
|
27
|
-
import {
|
|
16
|
+
import { parseKeyPairsIntoRecord } from '@opentelemetry/core';
|
|
28
17
|
import { diag } from '@opentelemetry/api';
|
|
29
18
|
import { getSharedConfigurationFromEnvironment } from './shared-env-configuration';
|
|
30
19
|
import { wrapStaticHeadersInFunction } from './shared-configuration';
|
|
31
20
|
function getStaticHeadersFromEnv(signalIdentifier) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
var nonSignalSpecificHeaders = baggageUtils.parseKeyPairsIntoRecord(nonSignalSpecificRawHeaders);
|
|
21
|
+
const signalSpecificRawHeaders = process.env[`OTEL_EXPORTER_OTLP_${signalIdentifier}_HEADERS`]?.trim();
|
|
22
|
+
const nonSignalSpecificRawHeaders = process.env['OTEL_EXPORTER_OTLP_HEADERS']?.trim();
|
|
23
|
+
const signalSpecificHeaders = parseKeyPairsIntoRecord(signalSpecificRawHeaders);
|
|
24
|
+
const nonSignalSpecificHeaders = parseKeyPairsIntoRecord(nonSignalSpecificRawHeaders);
|
|
37
25
|
if (Object.keys(signalSpecificHeaders).length === 0 &&
|
|
38
26
|
Object.keys(nonSignalSpecificHeaders).length === 0) {
|
|
39
27
|
return undefined;
|
|
40
28
|
}
|
|
41
29
|
// headers are combined instead of overwritten, with the specific headers taking precedence over
|
|
42
30
|
// the non-specific ones.
|
|
43
|
-
return Object.assign({},
|
|
31
|
+
return Object.assign({}, parseKeyPairsIntoRecord(nonSignalSpecificRawHeaders), parseKeyPairsIntoRecord(signalSpecificRawHeaders));
|
|
44
32
|
}
|
|
45
33
|
function appendRootPathToUrlIfNeeded(url) {
|
|
46
34
|
try {
|
|
47
|
-
|
|
35
|
+
const parsedUrl = new URL(url);
|
|
48
36
|
// This will automatically append '/' if there's no root path.
|
|
49
37
|
return parsedUrl.toString();
|
|
50
38
|
}
|
|
51
|
-
catch
|
|
52
|
-
diag.warn(
|
|
39
|
+
catch {
|
|
40
|
+
diag.warn(`Configuration: Could not parse environment-provided export URL: '${url}', falling back to undefined`);
|
|
53
41
|
return undefined;
|
|
54
42
|
}
|
|
55
43
|
}
|
|
@@ -58,8 +46,8 @@ function appendResourcePathToUrl(url, path) {
|
|
|
58
46
|
// just try to parse, if it fails we catch and warn.
|
|
59
47
|
new URL(url);
|
|
60
48
|
}
|
|
61
|
-
catch
|
|
62
|
-
diag.warn(
|
|
49
|
+
catch {
|
|
50
|
+
diag.warn(`Configuration: Could not parse environment-provided export URL: '${url}', falling back to undefined`);
|
|
63
51
|
return undefined;
|
|
64
52
|
}
|
|
65
53
|
if (!url.endsWith('/')) {
|
|
@@ -70,23 +58,21 @@ function appendResourcePathToUrl(url, path) {
|
|
|
70
58
|
// just try to parse, if it fails we catch and warn.
|
|
71
59
|
new URL(url);
|
|
72
60
|
}
|
|
73
|
-
catch
|
|
74
|
-
diag.warn(
|
|
61
|
+
catch {
|
|
62
|
+
diag.warn(`Configuration: Provided URL appended with '${path}' is not a valid URL, using 'undefined' instead of '${url}'`);
|
|
75
63
|
return undefined;
|
|
76
64
|
}
|
|
77
65
|
return url;
|
|
78
66
|
}
|
|
79
67
|
function getNonSpecificUrlFromEnv(signalResourcePath) {
|
|
80
|
-
|
|
81
|
-
var envUrl = (_a = process.env.OTEL_EXPORTER_OTLP_ENDPOINT) === null || _a === void 0 ? void 0 : _a.trim();
|
|
68
|
+
const envUrl = process.env.OTEL_EXPORTER_OTLP_ENDPOINT?.trim();
|
|
82
69
|
if (envUrl == null || envUrl === '') {
|
|
83
70
|
return undefined;
|
|
84
71
|
}
|
|
85
72
|
return appendResourcePathToUrl(envUrl, signalResourcePath);
|
|
86
73
|
}
|
|
87
74
|
function getSpecificUrlFromEnv(signalIdentifier) {
|
|
88
|
-
|
|
89
|
-
var envUrl = (_a = process.env["OTEL_EXPORTER_OTLP_" + signalIdentifier + "_ENDPOINT"]) === null || _a === void 0 ? void 0 : _a.trim();
|
|
75
|
+
const envUrl = process.env[`OTEL_EXPORTER_OTLP_${signalIdentifier}_ENDPOINT`]?.trim();
|
|
90
76
|
if (envUrl == null || envUrl === '') {
|
|
91
77
|
return undefined;
|
|
92
78
|
}
|
|
@@ -99,7 +85,11 @@ function getSpecificUrlFromEnv(signalIdentifier) {
|
|
|
99
85
|
* @param signalResourcePath signal resource path to append if necessary (e.g.: v1/metrics, v1/traces, v1/logs)
|
|
100
86
|
*/
|
|
101
87
|
export function getHttpConfigurationFromEnvironment(signalIdentifier, signalResourcePath) {
|
|
102
|
-
|
|
103
|
-
|
|
88
|
+
return {
|
|
89
|
+
...getSharedConfigurationFromEnvironment(signalIdentifier),
|
|
90
|
+
url: getSpecificUrlFromEnv(signalIdentifier) ??
|
|
91
|
+
getNonSpecificUrlFromEnv(signalResourcePath),
|
|
92
|
+
headers: wrapStaticHeadersInFunction(getStaticHeadersFromEnv(signalIdentifier)),
|
|
93
|
+
};
|
|
104
94
|
}
|
|
105
95
|
//# sourceMappingURL=otlp-http-env-configuration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otlp-http-env-configuration.js","sourceRoot":"","sources":["../../../src/configuration/otlp-http-env-configuration.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"otlp-http-env-configuration.js","sourceRoot":"","sources":["../../../src/configuration/otlp-http-env-configuration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,qCAAqC,EAAE,MAAM,4BAA4B,CAAC;AAEnF,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAErE,SAAS,uBAAuB,CAC9B,gBAAwB;IAExB,MAAM,wBAAwB,GAC5B,OAAO,CAAC,GAAG,CAAC,sBAAsB,gBAAgB,UAAU,CAAC,EAAE,IAAI,EAAE,CAAC;IACxE,MAAM,2BAA2B,GAC/B,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,EAAE,IAAI,EAAE,CAAC;IAEpD,MAAM,qBAAqB,GAAG,uBAAuB,CACnD,wBAAwB,CACzB,CAAC;IACF,MAAM,wBAAwB,GAAG,uBAAuB,CACtD,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,uBAAuB,CAAC,2BAA2B,CAAC,EACpD,uBAAuB,CAAC,wBAAwB,CAAC,CAClD,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,MAAM;QACN,IAAI,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,MAAM;QACN,IAAI,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,MAAM;QACN,IAAI,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,OAAO,CAAC,GAAG,CAAC,2BAA2B,EAAE,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,OAAO,CAAC,GAAG,CAAC,sBAAsB,gBAAgB,WAAW,CAAC,EAAE,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,MAAM,UAAU,mCAAmC,CACjD,gBAAwB,EACxB,kBAA0B;IAE1B,OAAO;QACL,GAAG,qCAAqC,CAAC,gBAAgB,CAAC;QAC1D,GAAG,EACD,qBAAqB,CAAC,gBAAgB,CAAC;YACvC,wBAAwB,CAAC,kBAAkB,CAAC;QAC9C,OAAO,EAAE,2BAA2B,CAClC,uBAAuB,CAAC,gBAAgB,CAAC,CAC1C;KACF,CAAC;AACJ,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 */\nimport { parseKeyPairsIntoRecord } from '@opentelemetry/core';\nimport { diag } from '@opentelemetry/api';\nimport { getSharedConfigurationFromEnvironment } from './shared-env-configuration';\nimport { OtlpHttpConfiguration } from './otlp-http-configuration';\nimport { wrapStaticHeadersInFunction } from './shared-configuration';\n\nfunction getStaticHeadersFromEnv(\n signalIdentifier: string\n): Record<string, string> | undefined {\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 = parseKeyPairsIntoRecord(\n signalSpecificRawHeaders\n );\n const nonSignalSpecificHeaders = 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 parseKeyPairsIntoRecord(nonSignalSpecificRawHeaders),\n 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: wrapStaticHeadersInFunction(\n getStaticHeadersFromEnv(signalIdentifier)\n ),\n };\n}\n"]}
|
|
@@ -14,18 +14,16 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
export function validateTimeoutMillis(timeoutMillis) {
|
|
17
|
-
if (
|
|
18
|
-
Number.isFinite(timeoutMillis) &&
|
|
19
|
-
timeoutMillis > 0) {
|
|
17
|
+
if (Number.isFinite(timeoutMillis) && timeoutMillis > 0) {
|
|
20
18
|
return timeoutMillis;
|
|
21
19
|
}
|
|
22
|
-
throw new Error(
|
|
20
|
+
throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${timeoutMillis}')`);
|
|
23
21
|
}
|
|
24
22
|
export function wrapStaticHeadersInFunction(headers) {
|
|
25
23
|
if (headers == null) {
|
|
26
24
|
return undefined;
|
|
27
25
|
}
|
|
28
|
-
return
|
|
26
|
+
return () => headers;
|
|
29
27
|
}
|
|
30
28
|
/**
|
|
31
29
|
* @param userProvidedConfiguration Configuration options provided by the user in code.
|
|
@@ -33,11 +31,16 @@ export function wrapStaticHeadersInFunction(headers) {
|
|
|
33
31
|
* @param defaultConfiguration The defaults as defined by the exporter specification
|
|
34
32
|
*/
|
|
35
33
|
export function mergeOtlpSharedConfigurationWithDefaults(userProvidedConfiguration, fallbackConfiguration, defaultConfiguration) {
|
|
36
|
-
var _a, _b, _c, _d, _e, _f;
|
|
37
34
|
return {
|
|
38
|
-
timeoutMillis: validateTimeoutMillis(
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
timeoutMillis: validateTimeoutMillis(userProvidedConfiguration.timeoutMillis ??
|
|
36
|
+
fallbackConfiguration.timeoutMillis ??
|
|
37
|
+
defaultConfiguration.timeoutMillis),
|
|
38
|
+
concurrencyLimit: userProvidedConfiguration.concurrencyLimit ??
|
|
39
|
+
fallbackConfiguration.concurrencyLimit ??
|
|
40
|
+
defaultConfiguration.concurrencyLimit,
|
|
41
|
+
compression: userProvidedConfiguration.compression ??
|
|
42
|
+
fallbackConfiguration.compression ??
|
|
43
|
+
defaultConfiguration.compression,
|
|
41
44
|
};
|
|
42
45
|
}
|
|
43
46
|
export function getSharedConfigurationDefaults() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-configuration.js","sourceRoot":"","sources":["../../../src/configuration/shared-configuration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAgBH,MAAM,UAAU,qBAAqB,CAAC,aAAqB;IACzD,
|
|
1
|
+
{"version":3,"file":"shared-configuration.js","sourceRoot":"","sources":["../../../src/configuration/shared-configuration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAgBH,MAAM,UAAU,qBAAqB,CAAC,aAAqB;IACzD,IAAI,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,aAAa,GAAG,CAAC,EAAE;QACvD,OAAO,aAAa,CAAC;KACtB;IACD,MAAM,IAAI,KAAK,CACb,qFAAqF,aAAa,IAAI,CACvG,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,2BAA2B,CACzC,OAA2C;IAE3C,IAAI,OAAO,IAAI,IAAI,EAAE;QACnB,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC;AACvB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,wCAAwC,CACtD,yBAA2D,EAC3D,qBAAuD,EACvD,oBAA6C;IAE7C,OAAO;QACL,aAAa,EAAE,qBAAqB,CAClC,yBAAyB,CAAC,aAAa;YACrC,qBAAqB,CAAC,aAAa;YACnC,oBAAoB,CAAC,aAAa,CACrC;QACD,gBAAgB,EACd,yBAAyB,CAAC,gBAAgB;YAC1C,qBAAqB,CAAC,gBAAgB;YACtC,oBAAoB,CAAC,gBAAgB;QACvC,WAAW,EACT,yBAAyB,CAAC,WAAW;YACrC,qBAAqB,CAAC,WAAW;YACjC,oBAAoB,CAAC,WAAW;KACnC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,8BAA8B;IAC5C,OAAO;QACL,aAAa,EAAE,KAAK;QACpB,gBAAgB,EAAE,EAAE;QACpB,WAAW,EAAE,MAAM;KACpB,CAAC;AACJ,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/**\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 (Number.isFinite(timeoutMillis) && timeoutMillis > 0) {\n return timeoutMillis;\n }\n throw new Error(\n `Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${timeoutMillis}')`\n );\n}\n\nexport function wrapStaticHeadersInFunction(\n headers: Record<string, string> | undefined\n): (() => Record<string, string>) | undefined {\n if (headers == null) {\n return undefined;\n }\n\n return () => headers;\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"]}
|
|
@@ -1,39 +1,35 @@
|
|
|
1
1
|
import { diag } from '@opentelemetry/api';
|
|
2
2
|
function parseAndValidateTimeoutFromEnv(timeoutEnvVar) {
|
|
3
|
-
|
|
4
|
-
var envTimeout = (_a = process.env[timeoutEnvVar]) === null || _a === void 0 ? void 0 : _a.trim();
|
|
3
|
+
const envTimeout = process.env[timeoutEnvVar]?.trim();
|
|
5
4
|
if (envTimeout != null && envTimeout !== '') {
|
|
6
|
-
|
|
7
|
-
if (
|
|
8
|
-
Number.isFinite(definedTimeout) &&
|
|
9
|
-
definedTimeout > 0) {
|
|
5
|
+
const definedTimeout = Number(envTimeout);
|
|
6
|
+
if (Number.isFinite(definedTimeout) && definedTimeout > 0) {
|
|
10
7
|
return definedTimeout;
|
|
11
8
|
}
|
|
12
|
-
diag.warn(
|
|
9
|
+
diag.warn(`Configuration: ${timeoutEnvVar} is invalid, expected number greater than 0 (actual: ${envTimeout})`);
|
|
13
10
|
}
|
|
14
11
|
return undefined;
|
|
15
12
|
}
|
|
16
13
|
function getTimeoutFromEnv(signalIdentifier) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return specificTimeout
|
|
14
|
+
const specificTimeout = parseAndValidateTimeoutFromEnv(`OTEL_EXPORTER_OTLP_${signalIdentifier}_TIMEOUT`);
|
|
15
|
+
const nonSpecificTimeout = parseAndValidateTimeoutFromEnv('OTEL_EXPORTER_OTLP_TIMEOUT');
|
|
16
|
+
return specificTimeout ?? nonSpecificTimeout;
|
|
20
17
|
}
|
|
21
18
|
function parseAndValidateCompressionFromEnv(compressionEnvVar) {
|
|
22
|
-
|
|
23
|
-
var compression = (_a = process.env[compressionEnvVar]) === null || _a === void 0 ? void 0 : _a.trim();
|
|
19
|
+
const compression = process.env[compressionEnvVar]?.trim();
|
|
24
20
|
if (compression === '') {
|
|
25
21
|
return undefined;
|
|
26
22
|
}
|
|
27
23
|
if (compression == null || compression === 'none' || compression === 'gzip') {
|
|
28
24
|
return compression;
|
|
29
25
|
}
|
|
30
|
-
diag.warn(
|
|
26
|
+
diag.warn(`Configuration: ${compressionEnvVar} is invalid, expected 'none' or 'gzip' (actual: '${compression}')`);
|
|
31
27
|
return undefined;
|
|
32
28
|
}
|
|
33
29
|
function getCompressionFromEnv(signalIdentifier) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return specificCompression
|
|
30
|
+
const specificCompression = parseAndValidateCompressionFromEnv(`OTEL_EXPORTER_OTLP_${signalIdentifier}_COMPRESSION`);
|
|
31
|
+
const nonSpecificCompression = parseAndValidateCompressionFromEnv('OTEL_EXPORTER_OTLP_COMPRESSION');
|
|
32
|
+
return specificCompression ?? nonSpecificCompression;
|
|
37
33
|
}
|
|
38
34
|
export function getSharedConfigurationFromEnvironment(signalIdentifier) {
|
|
39
35
|
return {
|