@opentelemetry/otlp-exporter-base 0.41.0 → 0.41.2
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/platform/browser/OTLPExporterBrowserBase.js +15 -1
- package/build/esm/platform/browser/OTLPExporterBrowserBase.js.map +1 -1
- package/build/esm/platform/browser/util.js +27 -1
- package/build/esm/platform/browser/util.js.map +1 -1
- package/build/esm/platform/node/OTLPExporterNodeBase.js +15 -1
- package/build/esm/platform/node/OTLPExporterNodeBase.js.map +1 -1
- package/build/esm/platform/node/util.js +11 -1
- package/build/esm/platform/node/util.js.map +1 -1
- package/build/esm/types.js +15 -1
- package/build/esm/types.js.map +1 -1
- package/build/esm/util.js +16 -1
- 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/version.d.ts +1 -1
- package/build/esnext/version.js +1 -1
- package/build/esnext/version.js.map +1 -1
- package/build/src/index.js +11 -2
- package/build/src/index.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 +18 -10
|
@@ -13,7 +13,21 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
var __extends = (this && this.__extends) || (function () {
|
|
17
|
+
var extendStatics = function (d, b) {
|
|
18
|
+
extendStatics = Object.setPrototypeOf ||
|
|
19
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
20
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
21
|
+
return extendStatics(d, b);
|
|
22
|
+
};
|
|
23
|
+
return function (d, b) {
|
|
24
|
+
if (typeof b !== "function" && b !== null)
|
|
25
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
26
|
+
extendStatics(d, b);
|
|
27
|
+
function __() { this.constructor = d; }
|
|
28
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
29
|
+
};
|
|
30
|
+
})();
|
|
17
31
|
import { OTLPExporterBase } from '../../OTLPExporterBase';
|
|
18
32
|
import { parseHeaders } from '../../util';
|
|
19
33
|
import { sendWithBeacon, sendWithXhr } from './util';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OTLPExporterBrowserBase.js","sourceRoot":"","sources":["../../../../src/platform/browser/OTLPExporterBrowserBase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG
|
|
1
|
+
{"version":3,"file":"OTLPExporterBrowserBase.js","sourceRoot":"","sources":["../../../../src/platform/browser/OTLPExporterBrowserBase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAE3D;;GAEG;AACH;IAGU,2CAAoE;IAI5E;;OAEG;IACH,iCAAY,MAAmC;QAAnC,uBAAA,EAAA,WAAmC;QAA/C,YACE,kBAAM,MAAM,CAAC,SAcd;QApBO,aAAO,GAAY,KAAK,CAAC;QAO/B,KAAI,CAAC,OAAO;YACV,CAAC,CAAC,MAAM,CAAC,OAAO,IAAI,OAAO,SAAS,CAAC,UAAU,KAAK,UAAU,CAAC;QACjE,IAAI,KAAI,CAAC,OAAO,EAAE;YAChB,KAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAC3B,EAAE,EACF,YAAY,CA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AG;YACjB,IAAM,KAAK,GAAG,KAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACrD,KAAI,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;IACH,8BAAC;AAAD,CAAC,AA3ED,CAGU,gBAAgB,GAwEzB","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 { OTLPExporterBase } from '../../OTLPExporterBase';\nimport { OTLPExporterConfigBase } from '../../types';\nimport * as otlpTypes from '../../types';\nimport { parseHeaders } from '../../util';\nimport { sendWithBeacon, sendWithXhr } from './util';\nimport { diag } from '@opentelemetry/api';\nimport { getEnv, baggageUtils } from '@opentelemetry/core';\n\n/**\n * Collector Metric Exporter abstract base class\n */\nexport abstract class OTLPExporterBrowserBase<\n ExportItem,\n ServiceRequest\n> extends OTLPExporterBase<OTLPExporterConfigBase, ExportItem, ServiceRequest> {\n protected _headers: Record<string, string>;\n private _useXHR: boolean = false;\n\n /**\n * @param config\n */\n constructor(config: OTLPExporterConfigBase = {}) {\n super(config);\n this._useXHR =\n !!config.headers || typeof navigator.sendBeacon !== 'function';\n if (this._useXHR) {\n this._headers = Object.assign(\n {},\n parseHeaders(config.headers),\n baggageUtils.parseKeyPairsIntoRecord(\n getEnv().OTEL_EXPORTER_OTLP_HEADERS\n )\n );\n } else {\n this._headers = {};\n }\n }\n\n onInit(): void {\n window.addEventListener('unload', this.shutdown);\n }\n\n onShutdown(): void {\n window.removeEventListener('unload', this.shutdown);\n }\n\n send(\n items: ExportItem[],\n onSuccess: () => void,\n onError: (error: otlpTypes.OTLPExporterError) => void\n ): void {\n if (this._shutdownOnce.isCalled) {\n diag.debug('Shutdown already started. Cannot send objects');\n return;\n }\n const serviceRequest = this.convert(items);\n const body = JSON.stringify(serviceRequest);\n\n const promise = new Promise<void>((resolve, reject) => {\n if (this._useXHR) {\n sendWithXhr(\n body,\n this.url,\n this._headers,\n this.timeoutMillis,\n resolve,\n reject\n );\n } else {\n sendWithBeacon(\n body,\n this.url,\n { type: 'application/json' },\n resolve,\n reject\n );\n }\n }).then(onSuccess, onError);\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"]}
|
|
@@ -1,4 +1,30 @@
|
|
|
1
|
-
|
|
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
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
13
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
14
|
+
if (!m) return o;
|
|
15
|
+
var i = m.call(o), r, ar = [], e;
|
|
16
|
+
try {
|
|
17
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
18
|
+
}
|
|
19
|
+
catch (error) { e = { error: error }; }
|
|
20
|
+
finally {
|
|
21
|
+
try {
|
|
22
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
23
|
+
}
|
|
24
|
+
finally { if (e) throw e.error; }
|
|
25
|
+
}
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
2
28
|
/*
|
|
3
29
|
* Copyright The OpenTelemetry Authors
|
|
4
30
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../../../src/platform/browser/util.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../../../src/platform/browser/util.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EACL,2BAA2B,EAC3B,8BAA8B,EAC9B,iCAAiC,EACjC,0BAA0B,EAC1B,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,YAAY,CAAC;AAEpB;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,IAAY,EACZ,GAAW,EACX,eAAgC,EAChC,SAAqB,EACrB,OAA2C;IAE3C,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,eAAe,CAAC,CAAC,EAAE;QAChE,IAAI,CAAC,KAAK,CAAC,uBAAuB,EAAE,IAAI,CAAC,CAAC;QAC1C,SAAS,EAAE,CAAC;KACb;SAAM;QACL,IAAM,KAAK,GAAG,IAAI,iBAAiB,CAAC,8BAA4B,IAAM,CAAC,CAAC;QACxE,OAAO,CAAC,KAAK,CAAC,CAAC;KAChB;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CACzB,IAAmB,EACnB,GAAW,EACX,OAA+B,EAC/B,eAAuB,EACvB,SAAqB,EACrB,OAA2C;IAE3C,IAAI,UAAyC,CAAC;IAC9C,IAAI,GAAmB,CAA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UAAU,CAAC,CAAC;QAC3B,CAAC,CAAC;QAEF,GAAG,CAAC,OAAO,GAAG;YACZ,IAAI,cAAc,EAAE;gBAClB,IAAM,GAAG,GAAG,IAAI,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;gBACrD,OAAO,CAAC,GAAG,CAAC,CAAC;aACd;YACD,YAAY,CAAC,aAAa,CAAC,CAAC;YAC5B,YAAY,CAAC,UAAU,CAAC,CAAC;QAC3B,CAAC,CAAC;IACJ,CAAC,CAAC;IAEF,aAAa,EAAE,CAAC;AAClB,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 { diag } from '@opentelemetry/api';\nimport { OTLPExporterError } from '../../types';\nimport {\n DEFAULT_EXPORT_MAX_ATTEMPTS,\n DEFAULT_EXPORT_INITIAL_BACKOFF,\n DEFAULT_EXPORT_BACKOFF_MULTIPLIER,\n DEFAULT_EXPORT_MAX_BACKOFF,\n isExportRetryable,\n parseRetryAfterToMills,\n} from '../../util';\n\n/**\n * Send metrics/spans using browser navigator.sendBeacon\n * @param body\n * @param url\n * @param blobPropertyBag\n * @param onSuccess\n * @param onError\n */\nexport function sendWithBeacon(\n body: string,\n url: string,\n blobPropertyBag: BlobPropertyBag,\n onSuccess: () => void,\n onError: (error: OTLPExporterError) => void\n): void {\n if (navigator.sendBeacon(url, new Blob([body], blobPropertyBag))) {\n diag.debug('sendBeacon - can send', body);\n onSuccess();\n } else {\n const error = new OTLPExporterError(`sendBeacon - cannot send ${body}`);\n onError(error);\n }\n}\n\n/**\n * function to send metrics/spans using browser XMLHttpRequest\n * used when navigator.sendBeacon is not available\n * @param body\n * @param url\n * @param headers\n * @param onSuccess\n * @param onError\n */\nexport function sendWithXhr(\n body: string | Blob,\n url: string,\n headers: Record<string, string>,\n exporterTimeout: number,\n onSuccess: () => void,\n onError: (error: OTLPExporterError) => void\n): void {\n let retryTimer: ReturnType<typeof setTimeout>;\n let xhr: XMLHttpRequest;\n let reqIsDestroyed = false;\n\n const exporterTimer = setTimeout(() => {\n clearTimeout(retryTimer);\n reqIsDestroyed = true;\n\n if (xhr.readyState === XMLHttpRequest.DONE) {\n const err = new OTLPExporterError('Request Timeout');\n onError(err);\n } else {\n xhr.abort();\n }\n }, exporterTimeout);\n\n const sendWithRetry = (\n retries = DEFAULT_EXPORT_MAX_ATTEMPTS,\n minDelay = DEFAULT_EXPORT_INITIAL_BACKOFF\n ) => {\n xhr = new XMLHttpRequest();\n xhr.open('POST', url);\n\n const defaultHeaders = {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n };\n\n Object.entries({\n ...defaultHeaders,\n ...headers,\n }).forEach(([k, v]) => {\n xhr.setRequestHeader(k, v);\n });\n\n xhr.send(body);\n\n xhr.onreadystatechange = () => {\n if (xhr.readyState === XMLHttpRequest.DONE && reqIsDestroyed === false) {\n if (xhr.status >= 200 && xhr.status <= 299) {\n diag.debug('xhr success', body);\n onSuccess();\n clearTimeout(exporterTimer);\n clearTimeout(retryTimer);\n } else if (xhr.status && isExportRetryable(xhr.status) && retries > 0) {\n let retryTime: number;\n minDelay = DEFAULT_EXPORT_BACKOFF_MULTIPLIER * minDelay;\n\n // retry after interval specified in Retry-After header\n if (xhr.getResponseHeader('Retry-After')) {\n retryTime = parseRetryAfterToMills(\n xhr.getResponseHeader('Retry-After')!\n );\n } else {\n // exponential backoff with jitter\n retryTime = Math.round(\n Math.random() * (DEFAULT_EXPORT_MAX_BACKOFF - minDelay) + minDelay\n );\n }\n\n retryTimer = setTimeout(() => {\n sendWithRetry(retries - 1, minDelay);\n }, retryTime);\n } else {\n const error = new OTLPExporterError(\n `Failed to export with XHR (status: ${xhr.status})`,\n xhr.status\n );\n onError(error);\n clearTimeout(exporterTimer);\n clearTimeout(retryTimer);\n }\n }\n };\n\n xhr.onabort = () => {\n if (reqIsDestroyed) {\n const err = new OTLPExporterError('Request Timeout');\n onError(err);\n }\n clearTimeout(exporterTimer);\n clearTimeout(retryTimer);\n };\n\n xhr.onerror = () => {\n if (reqIsDestroyed) {\n const err = new OTLPExporterError('Request Timeout');\n onError(err);\n }\n clearTimeout(exporterTimer);\n clearTimeout(retryTimer);\n };\n };\n\n sendWithRetry();\n}\n"]}
|
|
@@ -13,7 +13,21 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
var __extends = (this && this.__extends) || (function () {
|
|
17
|
+
var extendStatics = function (d, b) {
|
|
18
|
+
extendStatics = Object.setPrototypeOf ||
|
|
19
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
20
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
21
|
+
return extendStatics(d, b);
|
|
22
|
+
};
|
|
23
|
+
return function (d, b) {
|
|
24
|
+
if (typeof b !== "function" && b !== null)
|
|
25
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
26
|
+
extendStatics(d, b);
|
|
27
|
+
function __() { this.constructor = d; }
|
|
28
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
29
|
+
};
|
|
30
|
+
})();
|
|
17
31
|
import { OTLPExporterBase } from '../../OTLPExporterBase';
|
|
18
32
|
import { parseHeaders } from '../../util';
|
|
19
33
|
import { createHttpAgent, sendWithHttp, configureCompression } from './util';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OTLPExporterNodeBase.js","sourceRoot":"","sources":["../../../../src/platform/node/OTLPExporterNodeBase.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,CAAC,aAAa,CAAC,QAAQ,EAAE;YAC/B,IAAI,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC;YAC5D,OAAO;SACR;QACD,IAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAE7C,IAAM,OAAO,GAAG,IAAI,OAAO,CAAO,UAAC,OAAO,EAAE,MAAM;YAChD,YAAY,CACV,KAAI,EACJ,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,EAC9B,kBAAkB,EAClB,OAAO,EACP,MAAM,CACP,CAAC;QACJ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAE5B,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpC,IAAM,UAAU,GAAG;YACjB,IAAM,KAAK,GAAG,KAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACrD,KAAI,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;IAED,yCAAU,GAAV,cAAoB,CAAC;IACvB,2BAAC;AAAD,CAAC,AA5DD,CAGU,gBAAgB,GAyDzB","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 type * as http from 'http';\nimport type * as https from 'https';\n\nimport { OTLPExporterBase } from '../../OTLPExporterBase';\nimport { OTLPExporterNodeConfigBase, CompressionAlgorithm } from './types';\nimport * as otlpTypes from '../../types';\nimport { parseHeaders } from '../../util';\nimport { createHttpAgent, sendWithHttp, configureCompression } from './util';\nimport { diag } from '@opentelemetry/api';\nimport { getEnv, baggageUtils } from '@opentelemetry/core';\n\n/**\n * Collector Metric Exporter abstract base class\n */\nexport abstract class OTLPExporterNodeBase<\n ExportItem,\n ServiceRequest\n> extends OTLPExporterBase<\n OTLPExporterNodeConfigBase,\n ExportItem,\n ServiceRequest\n> {\n DEFAULT_HEADERS: Record<string, string> = {};\n headers: Record<string, string>;\n agent: http.Agent | https.Agent | undefined;\n compression: CompressionAlgorithm;\n\n constructor(config: OTLPExporterNodeConfigBase = {}) {\n super(config);\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 this.headers = Object.assign(\n this.DEFAULT_HEADERS,\n parseHeaders(config.headers),\n baggageUtils.parseKeyPairsIntoRecord(getEnv().OTEL_EXPORTER_OTLP_HEADERS)\n );\n this.agent = createHttpAgent(config);\n this.compression = configureCompression(config.compression);\n }\n\n onInit(_config: OTLPExporterNodeConfigBase): void {}\n\n send(\n objects: ExportItem[],\n onSuccess: () => void,\n onError: (error: otlpTypes.OTLPExporterError) => void\n ): void {\n if (this._shutdownOnce.isCalled) {\n diag.debug('Shutdown already started. Cannot send objects');\n return;\n }\n const serviceRequest = this.convert(objects);\n\n const promise = new Promise<void>((resolve, reject) => {\n sendWithHttp(\n this,\n JSON.stringify(serviceRequest),\n 'application/json',\n resolve,\n reject\n );\n }).then(onSuccess, onError);\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 onShutdown(): void {}\n}\n"]}
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
|
|
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
|
+
};
|
|
2
12
|
/*
|
|
3
13
|
* Copyright The OpenTelemetry Authors
|
|
4
14
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../../../src/platform/node/util.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAGlC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EACL,2BAA2B,EAC3B,8BAA8B,EAC9B,iCAAiC,EACjC,0BAA0B,EAC1B,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,YAAY,CAAC;AAEpB;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAC1B,SAA2D,EAC3D,IAAqB,EACrB,WAAmB,EACnB,SAAqB,EACrB,OAA2C;IAE3C,IAAM,eAAe,GAAG,SAAS,CAAC,aAAa,CAAC;IAChD,IAAM,SAAS,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC7C,IAAM,WAAW,G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AS,CACtE,CAAC;QACF,OAAO,SAAS,CAAC;KAClB;AACH,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,WAA6C;IAE7C,IAAI,WAAW,EAAE;QACf,OAAO,WAAW,CAAC;KACpB;SAAM;QACL,IAAM,kBAAkB,GACtB,MAAM,EAAE,CAAC,qCAAqC;YAC9C,MAAM,EAAE,CAAC,8BAA8B,CAAC;QAC1C,OAAO,kBAAkB,KAAK,oBAAoB,CAAC,IAAI;YACrD,CAAC,CAAC,oBAAoB,CAAC,IAAI;YAC3B,CAAC,CAAC,oBAAoB,CAAC,IAAI,CAAC;KAC/B;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 * as url from 'url';\nimport * as http from 'http';\nimport * as https from 'https';\nimport * as zlib from 'zlib';\nimport { Readable } from 'stream';\nimport { OTLPExporterNodeBase } from './OTLPExporterNodeBase';\nimport { OTLPExporterNodeConfigBase } from '.';\nimport { diag } from '@opentelemetry/api';\nimport { CompressionAlgorithm } from './types';\nimport { getEnv } from '@opentelemetry/core';\nimport { OTLPExporterError } from '../../types';\nimport {\n DEFAULT_EXPORT_MAX_ATTEMPTS,\n DEFAULT_EXPORT_INITIAL_BACKOFF,\n DEFAULT_EXPORT_BACKOFF_MULTIPLIER,\n DEFAULT_EXPORT_MAX_BACKOFF,\n isExportRetryable,\n parseRetryAfterToMills,\n} from '../../util';\n\n/**\n * Sends data using http\n * @param collector\n * @param data\n * @param contentType\n * @param onSuccess\n * @param onError\n */\nexport function sendWithHttp<ExportItem, ServiceRequest>(\n collector: OTLPExporterNodeBase<ExportItem, ServiceRequest>,\n data: string | Buffer,\n contentType: string,\n onSuccess: () => void,\n onError: (error: OTLPExporterError) => void\n): void {\n const exporterTimeout = collector.timeoutMillis;\n const parsedUrl = new url.URL(collector.url);\n const nodeVersion = Number(process.versions.node.split('.')[0]);\n let retryTimer: ReturnType<typeof setTimeout>;\n let req: http.ClientRequest;\n let reqIsDestroyed = false;\n\n const exporterTimer = setTimeout(() => {\n clearTimeout(retryTimer);\n reqIsDestroyed = true;\n\n if (req.destroyed) {\n const err = new OTLPExporterError('Request Timeout');\n onError(err);\n } else {\n // req.abort() was deprecated since v14\n nodeVersion >= 14 ? req.destroy() : req.abort();\n }\n }, exporterTimeout);\n\n const options: http.RequestOptions | https.RequestOptions = {\n hostname: parsedUrl.hostname,\n port: parsedUrl.port,\n path: parsedUrl.pathname,\n method: 'POST',\n headers: {\n 'Content-Type': contentType,\n ...collector.headers,\n },\n agent: collector.agent,\n };\n\n const request = parsedUrl.protocol === 'http:' ? http.request : https.request;\n\n const sendWithRetry = (\n retries = DEFAULT_EXPORT_MAX_ATTEMPTS,\n minDelay = DEFAULT_EXPORT_INITIAL_BACKOFF\n ) => {\n req = request(options, (res: http.IncomingMessage) => {\n let responseData = '';\n res.on('data', chunk => (responseData += chunk));\n\n res.on('aborted', () => {\n if (reqIsDestroyed) {\n const err = new OTLPExporterError('Request Timeout');\n onError(err);\n }\n });\n\n res.on('end', () => {\n if (reqIsDestroyed === false) {\n if (res.statusCode && res.statusCode < 299) {\n diag.debug(`statusCode: ${res.statusCode}`, responseData);\n onSuccess();\n // clear all timers since request was completed and promise was resolved\n clearTimeout(exporterTimer);\n clearTimeout(retryTimer);\n } else if (\n res.statusCode &&\n isExportRetryable(res.statusCode) &&\n retries > 0\n ) {\n let retryTime: number;\n minDelay = DEFAULT_EXPORT_BACKOFF_MULTIPLIER * minDelay;\n\n // retry after interval specified in Retry-After header\n if (res.headers['retry-after']) {\n retryTime = parseRetryAfterToMills(res.headers['retry-after']!);\n } else {\n // exponential backoff with jitter\n retryTime = Math.round(\n Math.random() * (DEFAULT_EXPORT_MAX_BACKOFF - minDelay) +\n minDelay\n );\n }\n\n retryTimer = setTimeout(() => {\n sendWithRetry(retries - 1, minDelay);\n }, retryTime);\n } else {\n const error = new OTLPExporterError(\n res.statusMessage,\n res.statusCode,\n responseData\n );\n onError(error);\n // clear all timers since request was completed and promise was resolved\n clearTimeout(exporterTimer);\n clearTimeout(retryTimer);\n }\n }\n });\n });\n\n req.on('error', (error: Error | any) => {\n if (reqIsDestroyed) {\n const err = new OTLPExporterError('Request Timeout', error.code);\n onError(err);\n } else {\n onError(error);\n }\n clearTimeout(exporterTimer);\n clearTimeout(retryTimer);\n });\n\n req.on('abort', () => {\n if (reqIsDestroyed) {\n const err = new OTLPExporterError('Request Timeout');\n onError(err);\n }\n clearTimeout(exporterTimer);\n clearTimeout(retryTimer);\n });\n\n switch (collector.compression) {\n case CompressionAlgorithm.GZIP: {\n req.setHeader('Content-Encoding', 'gzip');\n const dataStream = readableFromBuffer(data);\n dataStream\n .on('error', onError)\n .pipe(zlib.createGzip())\n .on('error', onError)\n .pipe(req);\n\n break;\n }\n default:\n req.end(data);\n break;\n }\n };\n sendWithRetry();\n}\n\nfunction readableFromBuffer(buff: string | Buffer): Readable {\n const readable = new Readable();\n readable.push(buff);\n readable.push(null);\n\n return readable;\n}\n\nexport function createHttpAgent(\n config: OTLPExporterNodeConfigBase\n): http.Agent | https.Agent | undefined {\n if (config.httpAgentOptions && config.keepAlive === false) {\n diag.warn('httpAgentOptions is used only when keepAlive is true');\n return undefined;\n }\n\n if (config.keepAlive === false || !config.url) return undefined;\n\n try {\n const parsedUrl = new url.URL(config.url as string);\n const Agent = parsedUrl.protocol === 'http:' ? http.Agent : https.Agent;\n return new Agent({ keepAlive: true, ...config.httpAgentOptions });\n } catch (err) {\n diag.error(\n `collector exporter failed to create http agent. err: ${err.message}`\n );\n return undefined;\n }\n}\n\nexport function configureCompression(\n compression: CompressionAlgorithm | undefined\n): CompressionAlgorithm {\n if (compression) {\n return compression;\n } else {\n const definedCompression =\n getEnv().OTEL_EXPORTER_OTLP_TRACES_COMPRESSION ||\n getEnv().OTEL_EXPORTER_OTLP_COMPRESSION;\n return definedCompression === CompressionAlgorithm.GZIP\n ? CompressionAlgorithm.GZIP\n : CompressionAlgorithm.NONE;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../../../src/platform/node/util.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAGlC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EACL,2BAA2B,EAC3B,8BAA8B,EAC9B,iCAAiC,EACjC,0BAA0B,EAC1B,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,YAAY,CAAC;AAEpB;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAC1B,SAA2D,EAC3D,IAAqB,EACrB,WAAmB,EACnB,SAAqB,EACrB,OAA2C;IAE3C,IAAM,eAAe,GAAG,SAAS,CAAC,aAAa,CAAC;IAChD,IAAM,SAAS,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC7C,IAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC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,UAAU,oBAAoB,CAClC,WAA6C;IAE7C,IAAI,WAAW,EAAE;QACf,OAAO,WAAW,CAAC;KACpB;SAAM;QACL,IAAM,kBAAkB,GACtB,MAAM,EAAE,CAAC,qCAAqC;YAC9C,MAAM,EAAE,CAAC,8BAA8B,CAAC;QAC1C,OAAO,kBAAkB,KAAK,oBAAoB,CAAC,IAAI;YACrD,CAAC,CAAC,oBAAoB,CAAC,IAAI;YAC3B,CAAC,CAAC,oBAAoB,CAAC,IAAI,CAAC;KAC/B;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 * as url from 'url';\nimport * as http from 'http';\nimport * as https from 'https';\nimport * as zlib from 'zlib';\nimport { Readable } from 'stream';\nimport { OTLPExporterNodeBase } from './OTLPExporterNodeBase';\nimport { OTLPExporterNodeConfigBase } from '.';\nimport { diag } from '@opentelemetry/api';\nimport { CompressionAlgorithm } from './types';\nimport { getEnv } from '@opentelemetry/core';\nimport { OTLPExporterError } from '../../types';\nimport {\n DEFAULT_EXPORT_MAX_ATTEMPTS,\n DEFAULT_EXPORT_INITIAL_BACKOFF,\n DEFAULT_EXPORT_BACKOFF_MULTIPLIER,\n DEFAULT_EXPORT_MAX_BACKOFF,\n isExportRetryable,\n parseRetryAfterToMills,\n} from '../../util';\n\n/**\n * Sends data using http\n * @param collector\n * @param data\n * @param contentType\n * @param onSuccess\n * @param onError\n */\nexport function sendWithHttp<ExportItem, ServiceRequest>(\n collector: OTLPExporterNodeBase<ExportItem, ServiceRequest>,\n data: string | Buffer,\n contentType: string,\n onSuccess: () => void,\n onError: (error: OTLPExporterError) => void\n): void {\n const exporterTimeout = collector.timeoutMillis;\n const parsedUrl = new url.URL(collector.url);\n const nodeVersion = Number(process.versions.node.split('.')[0]);\n let retryTimer: ReturnType<typeof setTimeout>;\n let req: http.ClientRequest;\n let reqIsDestroyed = false;\n\n const exporterTimer = setTimeout(() => {\n clearTimeout(retryTimer);\n reqIsDestroyed = true;\n\n if (req.destroyed) {\n const err = new OTLPExporterError('Request Timeout');\n onError(err);\n } else {\n // req.abort() was deprecated since v14\n nodeVersion >= 14 ? req.destroy() : req.abort();\n }\n }, exporterTimeout);\n\n const options: http.RequestOptions | https.RequestOptions = {\n hostname: parsedUrl.hostname,\n port: parsedUrl.port,\n path: parsedUrl.pathname,\n method: 'POST',\n headers: {\n 'Content-Type': contentType,\n ...collector.headers,\n },\n agent: collector.agent,\n };\n\n const request = parsedUrl.protocol === 'http:' ? http.request : https.request;\n\n const sendWithRetry = (\n retries = DEFAULT_EXPORT_MAX_ATTEMPTS,\n minDelay = DEFAULT_EXPORT_INITIAL_BACKOFF\n ) => {\n req = request(options, (res: http.IncomingMessage) => {\n let responseData = '';\n res.on('data', chunk => (responseData += chunk));\n\n res.on('aborted', () => {\n if (reqIsDestroyed) {\n const err = new OTLPExporterError('Request Timeout');\n onError(err);\n }\n });\n\n res.on('end', () => {\n if (reqIsDestroyed === false) {\n if (res.statusCode && res.statusCode < 299) {\n diag.debug(`statusCode: ${res.statusCode}`, responseData);\n onSuccess();\n // clear all timers since request was completed and promise was resolved\n clearTimeout(exporterTimer);\n clearTimeout(retryTimer);\n } else if (\n res.statusCode &&\n isExportRetryable(res.statusCode) &&\n retries > 0\n ) {\n let retryTime: number;\n minDelay = DEFAULT_EXPORT_BACKOFF_MULTIPLIER * minDelay;\n\n // retry after interval specified in Retry-After header\n if (res.headers['retry-after']) {\n retryTime = parseRetryAfterToMills(res.headers['retry-after']!);\n } else {\n // exponential backoff with jitter\n retryTime = Math.round(\n Math.random() * (DEFAULT_EXPORT_MAX_BACKOFF - minDelay) +\n minDelay\n );\n }\n\n retryTimer = setTimeout(() => {\n sendWithRetry(retries - 1, minDelay);\n }, retryTime);\n } else {\n const error = new OTLPExporterError(\n res.statusMessage,\n res.statusCode,\n responseData\n );\n onError(error);\n // clear all timers since request was completed and promise was resolved\n clearTimeout(exporterTimer);\n clearTimeout(retryTimer);\n }\n }\n });\n });\n\n req.on('error', (error: Error | any) => {\n if (reqIsDestroyed) {\n const err = new OTLPExporterError('Request Timeout', error.code);\n onError(err);\n } else {\n onError(error);\n }\n clearTimeout(exporterTimer);\n clearTimeout(retryTimer);\n });\n\n req.on('abort', () => {\n if (reqIsDestroyed) {\n const err = new OTLPExporterError('Request Timeout');\n onError(err);\n }\n clearTimeout(exporterTimer);\n clearTimeout(retryTimer);\n });\n\n switch (collector.compression) {\n case CompressionAlgorithm.GZIP: {\n req.setHeader('Content-Encoding', 'gzip');\n const dataStream = readableFromBuffer(data);\n dataStream\n .on('error', onError)\n .pipe(zlib.createGzip())\n .on('error', onError)\n .pipe(req);\n\n break;\n }\n default:\n req.end(data);\n break;\n }\n };\n sendWithRetry();\n}\n\nfunction readableFromBuffer(buff: string | Buffer): Readable {\n const readable = new Readable();\n readable.push(buff);\n readable.push(null);\n\n return readable;\n}\n\nexport function createHttpAgent(\n config: OTLPExporterNodeConfigBase\n): http.Agent | https.Agent | undefined {\n if (config.httpAgentOptions && config.keepAlive === false) {\n diag.warn('httpAgentOptions is used only when keepAlive is true');\n return undefined;\n }\n\n if (config.keepAlive === false || !config.url) return undefined;\n\n try {\n const parsedUrl = new url.URL(config.url as string);\n const Agent = parsedUrl.protocol === 'http:' ? http.Agent : https.Agent;\n return new Agent({ keepAlive: true, ...config.httpAgentOptions });\n } catch (err) {\n diag.error(\n `collector exporter failed to create http agent. err: ${err.message}`\n );\n return undefined;\n }\n}\n\nexport function configureCompression(\n compression: CompressionAlgorithm | undefined\n): CompressionAlgorithm {\n if (compression) {\n return compression;\n } else {\n const definedCompression =\n getEnv().OTEL_EXPORTER_OTLP_TRACES_COMPRESSION ||\n getEnv().OTEL_EXPORTER_OTLP_COMPRESSION;\n return definedCompression === CompressionAlgorithm.GZIP\n ? CompressionAlgorithm.GZIP\n : CompressionAlgorithm.NONE;\n }\n}\n"]}
|
package/build/esm/types.js
CHANGED
|
@@ -13,7 +13,21 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
var __extends = (this && this.__extends) || (function () {
|
|
17
|
+
var extendStatics = function (d, b) {
|
|
18
|
+
extendStatics = Object.setPrototypeOf ||
|
|
19
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
20
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
21
|
+
return extendStatics(d, b);
|
|
22
|
+
};
|
|
23
|
+
return function (d, b) {
|
|
24
|
+
if (typeof b !== "function" && b !== null)
|
|
25
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
26
|
+
extendStatics(d, b);
|
|
27
|
+
function __() { this.constructor = d; }
|
|
28
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
29
|
+
};
|
|
30
|
+
})();
|
|
17
31
|
/**
|
|
18
32
|
* Interface for handling error
|
|
19
33
|
*/
|
package/build/esm/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;AAEH;;GAEG;AACH;IAAuC,qCAAK;IAK1C,2BAAY,OAAgB,EAAE,IAAa,EAAE,IAAa;QAA1D,YACE,kBAAM,OAAO,CAAC,SAGf;QAPiB,UAAI,GAAW,mBAAmB,CAAC;QAKnD,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;;IACnB,CAAC;IACH,wBAAC;AAAD,CAAC,AAVD,CAAuC,KAAK,GAU3C","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 * Interface for handling error\n */\nexport class OTLPExporterError extends Error {\n readonly code?: number;\n override readonly name: string = 'OTLPExporterError';\n readonly data?: string;\n\n constructor(message?: string, code?: number, data?: string) {\n super(message);\n this.data = data;\n this.code = code;\n }\n}\n\n/**\n * Interface for handling export service errors\n */\nexport interface ExportServiceError {\n name: string;\n code: number;\n details: string;\n metadata: { [key: string]: unknown };\n message: string;\n stack: string;\n}\n\n/**\n * Collector Exporter base config\n */\nexport interface OTLPExporterConfigBase {\n headers?: Partial<Record<string, unknown>>;\n hostname?: string;\n url?: string;\n concurrencyLimit?: number;\n /** Maximum time the OTLP exporter will wait for each batch export.\n * The default value is 10000ms. */\n timeoutMillis?: number;\n}\n"]}
|
package/build/esm/util.js
CHANGED
|
@@ -13,7 +13,22 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
17
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
18
|
+
if (!m) return o;
|
|
19
|
+
var i = m.call(o), r, ar = [], e;
|
|
20
|
+
try {
|
|
21
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
22
|
+
}
|
|
23
|
+
catch (error) { e = { error: error }; }
|
|
24
|
+
finally {
|
|
25
|
+
try {
|
|
26
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
27
|
+
}
|
|
28
|
+
finally { if (e) throw e.error; }
|
|
29
|
+
}
|
|
30
|
+
return ar;
|
|
31
|
+
};
|
|
17
32
|
import { diag } from '@opentelemetry/api';
|
|
18
33
|
import { getEnv } from '@opentelemetry/core';
|
|
19
34
|
var DEFAULT_TRACE_TIMEOUT = 10000;
|
package/build/esm/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,IAAM,qBAAqB,GAAG,KAAK,CAAC;AACpC,MAAM,CAAC,IAAM,2BAA2B,GAAG,CAAC,CAAC;AAC7C,MAAM,CAAC,IAAM,8BAA8B,GAAG,IAAI,CAAC;AACnD,MAAM,CAAC,IAAM,0BAA0B,GAAG,IAAI,CAAC;AAC/C,MAAM,CAAC,IAAM,iCAAiC,GAAG,GAAG,CAAC;AAErD;;;GAGG;AACH,MAAM,UAAU,YAAY,CAC1B,cAAqD;IAArD,+BAAA,EAAA,mBAAqD;IAErD,IAAM,OAAO,GAA2B,EAAE,CAAC;IAC3C,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,UAAC,EAAY;YAAZ,KAAA,aAAY,EAAX,GAAG,QAAA,EAAE,KAAK,QAAA;QACjD,IAAI,OAA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EAAE,CAAC,iCAAiC,mCACxC,MAAM,EAAE,CAAC,0BAA0B,CACtC,CAAC;IAEF,IAAI,cAAc,IAAI,CAAC,EAAE;QACvB,oEAAoE;QACpE,OAAO,cAAc,CAAC,cAAc,EAAE,qBAAqB,CAAC,CAAC;KAC9D;SAAM;QACL,OAAO,cAAc,CAAC;KACvB;AACH,CAAC;AAED,oEAAoE;AACpE,MAAM,UAAU,cAAc,CAC5B,OAAe,EACf,cAAsB;IAEtB,IAAI,CAAC,IAAI,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;IAErD,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,UAAkB;IAClD,IAAM,UAAU,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IAExC,OAAO,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,UAA0B;IAC/D,IAAI,UAAU,IAAI,IAAI,EAAE;QACtB,OAAO,CAAC,CAAC,CAAC;KACX;IACD,IAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IAChD,IAAI,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE;QAC7B,OAAO,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAC1C;IACD,mFAAmF;IACnF,IAAM,KAAK,GAAG,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAE1D,IAAI,KAAK,IAAI,CAAC,EAAE;QACd,OAAO,KAAK,CAAC;KACd;IACD,OAAO,CAAC,CAAC;AACX,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';\nimport { getEnv } from '@opentelemetry/core';\n\nconst DEFAULT_TRACE_TIMEOUT = 10000;\nexport const DEFAULT_EXPORT_MAX_ATTEMPTS = 5;\nexport const DEFAULT_EXPORT_INITIAL_BACKOFF = 1000;\nexport const DEFAULT_EXPORT_MAX_BACKOFF = 5000;\nexport const DEFAULT_EXPORT_BACKOFF_MULTIPLIER = 1.5;\n\n/**\n * Parses headers from config leaving only those that have defined values\n * @param partialHeaders\n */\nexport function parseHeaders(\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(`Header \"${key}\" has wrong value and will be ignored`);\n }\n });\n return headers;\n}\n\n/**\n * Adds path (version + signal) to a no per-signal endpoint\n * @param url\n * @param path\n * @returns url + path\n */\nexport function appendResourcePathToUrl(url: string, path: string): string {\n if (!url.endsWith('/')) {\n url = url + '/';\n }\n return url + path;\n}\n\n/**\n * Adds root path to signal specific endpoint when endpoint contains no path part and no root path\n * @param url\n * @returns url\n */\nexport function appendRootPathToUrlIfNeeded(url: string): string {\n try {\n const parsedUrl = new URL(url);\n if (parsedUrl.pathname === '') {\n parsedUrl.pathname = parsedUrl.pathname + '/';\n }\n return parsedUrl.toString();\n } catch {\n diag.warn(`Could not parse export URL: '${url}'`);\n return url;\n }\n}\n\n/**\n * Configure exporter trace timeout value from passed in value or environment variables\n * @param timeoutMillis\n * @returns timeout value in milliseconds\n */\nexport function configureExporterTimeout(\n timeoutMillis: number | undefined\n): number {\n if (typeof timeoutMillis === 'number') {\n if (timeoutMillis <= 0) {\n // OTLP exporter configured timeout - using default value of 10000ms\n return invalidTimeout(timeoutMillis, DEFAULT_TRACE_TIMEOUT);\n }\n return timeoutMillis;\n } else {\n return getExporterTimeoutFromEnv();\n }\n}\n\nfunction getExporterTimeoutFromEnv(): number {\n const definedTimeout = Number(\n getEnv().OTEL_EXPORTER_OTLP_TRACES_TIMEOUT ??\n getEnv().OTEL_EXPORTER_OTLP_TIMEOUT\n );\n\n if (definedTimeout <= 0) {\n // OTLP exporter configured timeout - using default value of 10000ms\n return invalidTimeout(definedTimeout, DEFAULT_TRACE_TIMEOUT);\n } else {\n return definedTimeout;\n }\n}\n\n// OTLP exporter configured timeout - using default value of 10000ms\nexport function invalidTimeout(\n timeout: number,\n defaultTimeout: number\n): number {\n diag.warn('Timeout must be greater than 0', timeout);\n\n return defaultTimeout;\n}\n\nexport function isExportRetryable(statusCode: number): boolean {\n const retryCodes = [429, 502, 503, 504];\n\n return retryCodes.includes(statusCode);\n}\n\nexport function parseRetryAfterToMills(retryAfter?: string | null): number {\n if (retryAfter == null) {\n return -1;\n }\n const seconds = Number.parseInt(retryAfter, 10);\n if (Number.isInteger(seconds)) {\n return seconds > 0 ? seconds * 1000 : -1;\n }\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After#directives\n const delay = new Date(retryAfter).getTime() - Date.now();\n\n if (delay >= 0) {\n return delay;\n }\n return 0;\n}\n"]}
|
package/build/esm/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.41.
|
|
1
|
+
export declare const VERSION = "0.41.2";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/build/esm/version.js
CHANGED
package/build/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,IAAM,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.41.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,IAAM,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.41.2';\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.41.
|
|
1
|
+
export declare const VERSION = "0.41.2";
|
|
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.41.
|
|
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.41.2';\n"]}
|
package/build/src/index.js
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
2
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
13
|
exports.invalidTimeout = exports.configureExporterTimeout = exports.appendRootPathToUrlIfNeeded = exports.appendResourcePathToUrl = exports.parseHeaders = exports.OTLPExporterError = exports.OTLPExporterBase = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
14
|
/*
|
|
6
15
|
* Copyright The OpenTelemetry Authors
|
|
7
16
|
*
|
|
@@ -17,7 +26,7 @@ const tslib_1 = require("tslib");
|
|
|
17
26
|
* See the License for the specific language governing permissions and
|
|
18
27
|
* limitations under the License.
|
|
19
28
|
*/
|
|
20
|
-
|
|
29
|
+
__exportStar(require("./platform"), exports);
|
|
21
30
|
var OTLPExporterBase_1 = require("./OTLPExporterBase");
|
|
22
31
|
Object.defineProperty(exports, "OTLPExporterBase", { enumerable: true, get: function () { return OTLPExporterBase_1.OTLPExporterBase; } });
|
|
23
32
|
var types_1 = require("./types");
|
package/build/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;GAcG;AACH,6CAA2B;AAC3B,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,iCAIiB;AAHf,0GAAA,iBAAiB,OAAA;AAInB,+BAMgB;AALd,oGAAA,YAAY,OAAA;AACZ,+GAAA,uBAAuB,OAAA;AACvB,mHAAA,2BAA2B,OAAA;AAC3B,gHAAA,wBAAwB,OAAA;AACxB,sGAAA,cAAc,OAAA","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 */\nexport * from './platform';\nexport { OTLPExporterBase } from './OTLPExporterBase';\nexport {\n OTLPExporterError,\n OTLPExporterConfigBase,\n ExportServiceError,\n} from './types';\nexport {\n parseHeaders,\n appendResourcePathToUrl,\n appendRootPathToUrlIfNeeded,\n configureExporterTimeout,\n invalidTimeout,\n} from './util';\n"]}
|
package/build/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.41.
|
|
1
|
+
export declare const VERSION = "0.41.2";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/build/src/version.js
CHANGED
package/build/src/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,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.41.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,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.41.2';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentelemetry/otlp-exporter-base",
|
|
3
|
-
"version": "0.41.
|
|
3
|
+
"version": "0.41.2",
|
|
4
4
|
"description": "OpenTelemetry OTLP Exporter base (for internal use only)",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"module": "build/esm/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"tdd": "npm run test -- --watch-extensions ts --watch",
|
|
25
25
|
"tdd:browser": "karma start",
|
|
26
26
|
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/browser/**/*.ts'",
|
|
27
|
-
"test:browser": "
|
|
27
|
+
"test:browser": "karma start --single-run",
|
|
28
28
|
"version": "node ../../../scripts/version-update.js",
|
|
29
29
|
"watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
|
|
30
30
|
"precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies",
|
|
@@ -61,30 +61,38 @@
|
|
|
61
61
|
"access": "public"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@opentelemetry/core": "1.15.
|
|
65
|
-
"tslib": "^2.3.1"
|
|
64
|
+
"@opentelemetry/core": "1.15.2"
|
|
66
65
|
},
|
|
67
66
|
"devDependencies": {
|
|
67
|
+
"@babel/core": "7.22.10",
|
|
68
68
|
"@opentelemetry/api": "1.4.1",
|
|
69
69
|
"@types/mocha": "10.0.1",
|
|
70
70
|
"@types/node": "18.6.5",
|
|
71
|
-
"@types/sinon": "10.0.
|
|
71
|
+
"@types/sinon": "10.0.16",
|
|
72
|
+
"babel-plugin-istanbul": "6.1.1",
|
|
72
73
|
"codecov": "3.8.3",
|
|
73
74
|
"cross-var": "1.1.0",
|
|
74
|
-
"
|
|
75
|
-
"
|
|
75
|
+
"karma": "6.4.2",
|
|
76
|
+
"karma-chrome-launcher": "3.1.0",
|
|
77
|
+
"karma-coverage": "2.2.1",
|
|
78
|
+
"karma-mocha": "2.0.1",
|
|
79
|
+
"karma-spec-reporter": "0.0.36",
|
|
80
|
+
"karma-webpack": "4.0.2",
|
|
81
|
+
"lerna": "7.1.4",
|
|
76
82
|
"mocha": "10.2.0",
|
|
77
|
-
"nock": "13.3.1",
|
|
78
83
|
"nyc": "15.1.0",
|
|
79
84
|
"sinon": "15.1.2",
|
|
80
85
|
"ts-loader": "8.4.0",
|
|
81
86
|
"ts-mocha": "10.0.0",
|
|
82
|
-
"typescript": "4.4.4"
|
|
87
|
+
"typescript": "4.4.4",
|
|
88
|
+
"webpack": "4.46.0",
|
|
89
|
+
"webpack-cli": "4.10.0",
|
|
90
|
+
"webpack-merge": "5.9.0"
|
|
83
91
|
},
|
|
84
92
|
"peerDependencies": {
|
|
85
93
|
"@opentelemetry/api": "^1.0.0"
|
|
86
94
|
},
|
|
87
95
|
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/otlp-exporter-base",
|
|
88
96
|
"sideEffects": false,
|
|
89
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "48fb15862e801b742059a3e39dbcc8ef4c10b2e2"
|
|
90
98
|
}
|