@opentelemetry/exporter-zipkin 2.0.1 → 2.1.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.
@@ -1,4 +1,4 @@
1
1
  export { prepareSend } from './platform';
2
- export { ExporterConfig } from './types';
2
+ export type { ExporterConfig } from './types';
3
3
  export { ZipkinExporter } from './zipkin';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,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 { prepareSend } from './platform';\nexport { ExporterConfig } from './types';\nexport { ZipkinExporter } from './zipkin';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,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 { prepareSend } from './platform';\nexport type { ExporterConfig } from './types';\nexport { ZipkinExporter } from './zipkin';\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.0.1";
1
+ export declare const VERSION = "2.1.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -14,5 +14,5 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  // this is autogenerated file, see scripts/version-update.js
17
- export const VERSION = '2.0.1';
17
+ export const VERSION = '2.1.0';
18
18
  //# sourceMappingURL=version.js.map
@@ -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,OAAO,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 = '2.0.1';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,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 = '2.1.0';\n"]}
@@ -76,7 +76,7 @@ export class ZipkinExporter {
76
76
  this._sendingPromises.push(promise);
77
77
  const popPromise = () => {
78
78
  const index = this._sendingPromises.indexOf(promise);
79
- this._sendingPromises.splice(index, 1);
79
+ void this._sendingPromises.splice(index, 1);
80
80
  };
81
81
  promise.then(popPromise, popPromise);
82
82
  }
@@ -1 +1 @@
1
- {"version":3,"file":"zipkin.js","sourceRoot":"","sources":["../../src/zipkin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAEL,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EACL,YAAY,EACZ,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C;;GAEG;AACH,MAAM,OAAO,cAAc;IACR,oBAAoB,GAAG,uBAAuB,CAAC;IAC/C,kBAAkB,CAAS;IAC3B,yBAAyB,CAAS;IAC3C,OAAO,CAAS;IAChB,KAAK,CAA2B;IAChC,WAAW,CAAqC;IAChD,YAAY,CAAU;IACtB,WAAW,CAAU;IACrB,gBAAgB,GAAuB,EAAE,CAAC;IAElD,YAAY,SAAqC,EAAE;QACjD,IAAI,CAAC,OAAO;YACV,MAAM,CAAC,GAAG;gBACV,CAAC,gBAAgB,CAAC,+BAA+B,CAAC;oBAChD,oCAAoC,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BAAiB,CAAC;YAChC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,iBAAiB,CAAC;YAC3C,WAAW,CACd,EACD,IAAI,CAAC,kBAAkB,EACvB,IAAI,CAAC,yBAAyB,CAC/B,CACF,CAAC;QACF,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,MAAoB,EAAE,EAAE;YACtD,IAAI,IAAI,EAAE;gBACR,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;aACrB;QACH,CAAC,CAAC,CAAC;IACL,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 { diag } from '@opentelemetry/api';\nimport {\n ExportResult,\n ExportResultCode,\n getStringFromEnv,\n} from '@opentelemetry/core';\nimport { SpanExporter, ReadableSpan } from '@opentelemetry/sdk-trace-base';\nimport { prepareSend } from './platform/index';\nimport * as zipkinTypes from './types';\nimport {\n toZipkinSpan,\n defaultStatusCodeTagName,\n defaultStatusErrorTagName,\n} from './transform';\nimport { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';\nimport { prepareGetHeaders } from './utils';\n\n/**\n * Zipkin Exporter\n */\nexport class ZipkinExporter implements SpanExporter {\n private readonly DEFAULT_SERVICE_NAME = 'OpenTelemetry Service';\n private readonly _statusCodeTagName: string;\n private readonly _statusDescriptionTagName: string;\n private _urlStr: string;\n private _send: zipkinTypes.SendFunction;\n private _getHeaders: zipkinTypes.GetHeaders | undefined;\n private _serviceName?: string;\n private _isShutdown: boolean;\n private _sendingPromises: Promise<unknown>[] = [];\n\n constructor(config: zipkinTypes.ExporterConfig = {}) {\n this._urlStr =\n config.url ||\n (getStringFromEnv('OTEL_EXPORTER_ZIPKIN_ENDPOINT') ??\n 'http://localhost:9411/api/v2/spans');\n this._send = prepareSend(this._urlStr, config.headers);\n this._serviceName = config.serviceName;\n this._statusCodeTagName =\n config.statusCodeTagName || defaultStatusCodeTagName;\n this._statusDescriptionTagName =\n config.statusDescriptionTagName || defaultStatusErrorTagName;\n this._isShutdown = false;\n if (typeof config.getExportRequestHeaders === 'function') {\n this._getHeaders = prepareGetHeaders(config.getExportRequestHeaders);\n } else {\n // noop\n this._beforeSend = function () {};\n }\n }\n\n /**\n * Export spans.\n */\n export(\n spans: ReadableSpan[],\n resultCallback: (result: ExportResult) => void\n ): void {\n const serviceName = String(\n this._serviceName ||\n spans[0].resource.attributes[ATTR_SERVICE_NAME] ||\n this.DEFAULT_SERVICE_NAME\n );\n\n diag.debug('Zipkin exporter export');\n if (this._isShutdown) {\n setTimeout(() =>\n resultCallback({\n code: ExportResultCode.FAILED,\n error: new Error('Exporter has been shutdown'),\n })\n );\n return;\n }\n const promise = new Promise<void>(resolve => {\n this._sendSpans(spans, serviceName, result => {\n resolve();\n resultCallback(result);\n });\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 /**\n * Shutdown exporter. Noop operation in this exporter.\n */\n shutdown(): Promise<void> {\n diag.debug('Zipkin exporter shutdown');\n this._isShutdown = true;\n return this.forceFlush();\n }\n\n /**\n * Exports any pending spans in exporter\n */\n forceFlush(): Promise<void> {\n return new Promise((resolve, reject) => {\n Promise.all(this._sendingPromises).then(() => {\n resolve();\n }, reject);\n });\n }\n\n /**\n * if user defines getExportRequestHeaders in config then this will be called\n * every time before send, otherwise it will be replaced with noop in\n * constructor\n * @default noop\n */\n private _beforeSend() {\n if (this._getHeaders) {\n this._send = prepareSend(this._urlStr, this._getHeaders());\n }\n }\n\n /**\n * Transform spans and sends to Zipkin service.\n */\n private _sendSpans(\n spans: ReadableSpan[],\n serviceName: string,\n done?: (result: ExportResult) => void\n ) {\n const zipkinSpans = spans.map(span =>\n toZipkinSpan(\n span,\n String(\n span.attributes[ATTR_SERVICE_NAME] ||\n span.resource.attributes[ATTR_SERVICE_NAME] ||\n serviceName\n ),\n this._statusCodeTagName,\n this._statusDescriptionTagName\n )\n );\n this._beforeSend();\n return this._send(zipkinSpans, (result: ExportResult) => {\n if (done) {\n return done(result);\n }\n });\n }\n}\n"]}
1
+ {"version":3,"file":"zipkin.js","sourceRoot":"","sources":["../../src/zipkin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAEL,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EACL,YAAY,EACZ,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C;;GAEG;AACH,MAAM,OAAO,cAAc;IACR,oBAAoB,GAAG,uBAAuB,CAAC;IAC/C,kBAAkB,CAAS;IAC3B,yBAAyB,CAAS;IAC3C,OAAO,CAAS;IAChB,KAAK,CAA2B;IAChC,WAAW,CAAqC;IAChD,YAAY,CAAU;IACtB,WAAW,CAAU;IACrB,gBAAgB,GAAuB,EAAE,CAAC;IAElD,YAAY,SAAqC,EAAE;QACjD,IAAI,CAAC,OAAO;YACV,MAAM,CAAC,GAAG;gBACV,CAAC,gBAAgB,CAAC,+BAA+B,CAAC;oBAChD,oCAAoC,CAAC,CAAC;QAC1C,IAAI,CAAC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I,CAAC,QAAQ,CAAC,UAAU,CAAC,iBAAiB,CAAC;YAC3C,WAAW,CACd,EACD,IAAI,CAAC,kBAAkB,EACvB,IAAI,CAAC,yBAAyB,CAC/B,CACF,CAAC;QACF,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,MAAoB,EAAE,EAAE;YACtD,IAAI,IAAI,EAAE;gBACR,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;aACrB;QACH,CAAC,CAAC,CAAC;IACL,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 { diag } from '@opentelemetry/api';\nimport {\n ExportResult,\n ExportResultCode,\n getStringFromEnv,\n} from '@opentelemetry/core';\nimport { SpanExporter, ReadableSpan } from '@opentelemetry/sdk-trace-base';\nimport { prepareSend } from './platform/index';\nimport * as zipkinTypes from './types';\nimport {\n toZipkinSpan,\n defaultStatusCodeTagName,\n defaultStatusErrorTagName,\n} from './transform';\nimport { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';\nimport { prepareGetHeaders } from './utils';\n\n/**\n * Zipkin Exporter\n */\nexport class ZipkinExporter implements SpanExporter {\n private readonly DEFAULT_SERVICE_NAME = 'OpenTelemetry Service';\n private readonly _statusCodeTagName: string;\n private readonly _statusDescriptionTagName: string;\n private _urlStr: string;\n private _send: zipkinTypes.SendFunction;\n private _getHeaders: zipkinTypes.GetHeaders | undefined;\n private _serviceName?: string;\n private _isShutdown: boolean;\n private _sendingPromises: Promise<unknown>[] = [];\n\n constructor(config: zipkinTypes.ExporterConfig = {}) {\n this._urlStr =\n config.url ||\n (getStringFromEnv('OTEL_EXPORTER_ZIPKIN_ENDPOINT') ??\n 'http://localhost:9411/api/v2/spans');\n this._send = prepareSend(this._urlStr, config.headers);\n this._serviceName = config.serviceName;\n this._statusCodeTagName =\n config.statusCodeTagName || defaultStatusCodeTagName;\n this._statusDescriptionTagName =\n config.statusDescriptionTagName || defaultStatusErrorTagName;\n this._isShutdown = false;\n if (typeof config.getExportRequestHeaders === 'function') {\n this._getHeaders = prepareGetHeaders(config.getExportRequestHeaders);\n } else {\n // noop\n this._beforeSend = function () {};\n }\n }\n\n /**\n * Export spans.\n */\n export(\n spans: ReadableSpan[],\n resultCallback: (result: ExportResult) => void\n ): void {\n const serviceName = String(\n this._serviceName ||\n spans[0].resource.attributes[ATTR_SERVICE_NAME] ||\n this.DEFAULT_SERVICE_NAME\n );\n\n diag.debug('Zipkin exporter export');\n if (this._isShutdown) {\n setTimeout(() =>\n resultCallback({\n code: ExportResultCode.FAILED,\n error: new Error('Exporter has been shutdown'),\n })\n );\n return;\n }\n const promise = new Promise<void>(resolve => {\n this._sendSpans(spans, serviceName, result => {\n resolve();\n resultCallback(result);\n });\n });\n\n this._sendingPromises.push(promise);\n const popPromise = () => {\n const index = this._sendingPromises.indexOf(promise);\n void this._sendingPromises.splice(index, 1);\n };\n promise.then(popPromise, popPromise);\n }\n\n /**\n * Shutdown exporter. Noop operation in this exporter.\n */\n shutdown(): Promise<void> {\n diag.debug('Zipkin exporter shutdown');\n this._isShutdown = true;\n return this.forceFlush();\n }\n\n /**\n * Exports any pending spans in exporter\n */\n forceFlush(): Promise<void> {\n return new Promise((resolve, reject) => {\n Promise.all(this._sendingPromises).then(() => {\n resolve();\n }, reject);\n });\n }\n\n /**\n * if user defines getExportRequestHeaders in config then this will be called\n * every time before send, otherwise it will be replaced with noop in\n * constructor\n * @default noop\n */\n private _beforeSend() {\n if (this._getHeaders) {\n this._send = prepareSend(this._urlStr, this._getHeaders());\n }\n }\n\n /**\n * Transform spans and sends to Zipkin service.\n */\n private _sendSpans(\n spans: ReadableSpan[],\n serviceName: string,\n done?: (result: ExportResult) => void\n ) {\n const zipkinSpans = spans.map(span =>\n toZipkinSpan(\n span,\n String(\n span.attributes[ATTR_SERVICE_NAME] ||\n span.resource.attributes[ATTR_SERVICE_NAME] ||\n serviceName\n ),\n this._statusCodeTagName,\n this._statusDescriptionTagName\n )\n );\n this._beforeSend();\n return this._send(zipkinSpans, (result: ExportResult) => {\n if (done) {\n return done(result);\n }\n });\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
1
  export { prepareSend } from './platform';
2
- export { ExporterConfig } from './types';
2
+ export type { ExporterConfig } from './types';
3
3
  export { ZipkinExporter } from './zipkin';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,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 { prepareSend } from './platform';\nexport { ExporterConfig } from './types';\nexport { ZipkinExporter } from './zipkin';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,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 { prepareSend } from './platform';\nexport type { ExporterConfig } from './types';\nexport { ZipkinExporter } from './zipkin';\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.0.1";
1
+ export declare const VERSION = "2.1.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -14,5 +14,5 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  // this is autogenerated file, see scripts/version-update.js
17
- export const VERSION = '2.0.1';
17
+ export const VERSION = '2.1.0';
18
18
  //# sourceMappingURL=version.js.map
@@ -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,OAAO,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 = '2.0.1';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,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 = '2.1.0';\n"]}
@@ -76,7 +76,7 @@ export class ZipkinExporter {
76
76
  this._sendingPromises.push(promise);
77
77
  const popPromise = () => {
78
78
  const index = this._sendingPromises.indexOf(promise);
79
- this._sendingPromises.splice(index, 1);
79
+ void this._sendingPromises.splice(index, 1);
80
80
  };
81
81
  promise.then(popPromise, popPromise);
82
82
  }
@@ -1 +1 @@
1
- {"version":3,"file":"zipkin.js","sourceRoot":"","sources":["../../src/zipkin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAEL,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EACL,YAAY,EACZ,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C;;GAEG;AACH,MAAM,OAAO,cAAc;IACR,oBAAoB,GAAG,uBAAuB,CAAC;IAC/C,kBAAkB,CAAS;IAC3B,yBAAyB,CAAS;IAC3C,OAAO,CAA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C,WAAW,EAAE,CAAC,CAAC;SAC5D;IACH,CAAC;IAED;;OAEG;IACK,UAAU,CAChB,KAAqB,EACrB,WAAmB,EACnB,IAAqC;QAErC,MAAM,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CACnC,YAAY,CACV,IAAI,EACJ,MAAM,CACJ,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC;YAChC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,iBAAiB,CAAC;YAC3C,WAAW,CACd,EACD,IAAI,CAAC,kBAAkB,EACvB,IAAI,CAAC,yBAAyB,CAC/B,CACF,CAAC;QACF,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,MAAoB,EAAE,EAAE;YACtD,IAAI,IAAI,EAAE;gBACR,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;aACrB;QACH,CAAC,CAAC,CAAC;IACL,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 { diag } from '@opentelemetry/api';\nimport {\n ExportResult,\n ExportResultCode,\n getStringFromEnv,\n} from '@opentelemetry/core';\nimport { SpanExporter, ReadableSpan } from '@opentelemetry/sdk-trace-base';\nimport { prepareSend } from './platform/index';\nimport * as zipkinTypes from './types';\nimport {\n toZipkinSpan,\n defaultStatusCodeTagName,\n defaultStatusErrorTagName,\n} from './transform';\nimport { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';\nimport { prepareGetHeaders } from './utils';\n\n/**\n * Zipkin Exporter\n */\nexport class ZipkinExporter implements SpanExporter {\n private readonly DEFAULT_SERVICE_NAME = 'OpenTelemetry Service';\n private readonly _statusCodeTagName: string;\n private readonly _statusDescriptionTagName: string;\n private _urlStr: string;\n private _send: zipkinTypes.SendFunction;\n private _getHeaders: zipkinTypes.GetHeaders | undefined;\n private _serviceName?: string;\n private _isShutdown: boolean;\n private _sendingPromises: Promise<unknown>[] = [];\n\n constructor(config: zipkinTypes.ExporterConfig = {}) {\n this._urlStr =\n config.url ||\n (getStringFromEnv('OTEL_EXPORTER_ZIPKIN_ENDPOINT') ??\n 'http://localhost:9411/api/v2/spans');\n this._send = prepareSend(this._urlStr, config.headers);\n this._serviceName = config.serviceName;\n this._statusCodeTagName =\n config.statusCodeTagName || defaultStatusCodeTagName;\n this._statusDescriptionTagName =\n config.statusDescriptionTagName || defaultStatusErrorTagName;\n this._isShutdown = false;\n if (typeof config.getExportRequestHeaders === 'function') {\n this._getHeaders = prepareGetHeaders(config.getExportRequestHeaders);\n } else {\n // noop\n this._beforeSend = function () {};\n }\n }\n\n /**\n * Export spans.\n */\n export(\n spans: ReadableSpan[],\n resultCallback: (result: ExportResult) => void\n ): void {\n const serviceName = String(\n this._serviceName ||\n spans[0].resource.attributes[ATTR_SERVICE_NAME] ||\n this.DEFAULT_SERVICE_NAME\n );\n\n diag.debug('Zipkin exporter export');\n if (this._isShutdown) {\n setTimeout(() =>\n resultCallback({\n code: ExportResultCode.FAILED,\n error: new Error('Exporter has been shutdown'),\n })\n );\n return;\n }\n const promise = new Promise<void>(resolve => {\n this._sendSpans(spans, serviceName, result => {\n resolve();\n resultCallback(result);\n });\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 /**\n * Shutdown exporter. Noop operation in this exporter.\n */\n shutdown(): Promise<void> {\n diag.debug('Zipkin exporter shutdown');\n this._isShutdown = true;\n return this.forceFlush();\n }\n\n /**\n * Exports any pending spans in exporter\n */\n forceFlush(): Promise<void> {\n return new Promise((resolve, reject) => {\n Promise.all(this._sendingPromises).then(() => {\n resolve();\n }, reject);\n });\n }\n\n /**\n * if user defines getExportRequestHeaders in config then this will be called\n * every time before send, otherwise it will be replaced with noop in\n * constructor\n * @default noop\n */\n private _beforeSend() {\n if (this._getHeaders) {\n this._send = prepareSend(this._urlStr, this._getHeaders());\n }\n }\n\n /**\n * Transform spans and sends to Zipkin service.\n */\n private _sendSpans(\n spans: ReadableSpan[],\n serviceName: string,\n done?: (result: ExportResult) => void\n ) {\n const zipkinSpans = spans.map(span =>\n toZipkinSpan(\n span,\n String(\n span.attributes[ATTR_SERVICE_NAME] ||\n span.resource.attributes[ATTR_SERVICE_NAME] ||\n serviceName\n ),\n this._statusCodeTagName,\n this._statusDescriptionTagName\n )\n );\n this._beforeSend();\n return this._send(zipkinSpans, (result: ExportResult) => {\n if (done) {\n return done(result);\n }\n });\n }\n}\n"]}
1
+ {"version":3,"file":"zipkin.js","sourceRoot":"","sources":["../../src/zipkin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAEL,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EACL,YAAY,EACZ,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C;;GAEG;AACH,MAAM,OAAO,cAAc;IACR,oBAAoB,GAAG,uBAAuB,CAAC;IAC/C,kBAAkB,CAAS;IAC3B,yBAAyB,CAAS;IAC3C,OAAO,CAAS;IAChB,KAAK,CAA2B;IAChC,WA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AC;SAC5D;IACH,CAAC;IAED;;OAEG;IACK,UAAU,CAChB,KAAqB,EACrB,WAAmB,EACnB,IAAqC;QAErC,MAAM,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CACnC,YAAY,CACV,IAAI,EACJ,MAAM,CACJ,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC;YAChC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,iBAAiB,CAAC;YAC3C,WAAW,CACd,EACD,IAAI,CAAC,kBAAkB,EACvB,IAAI,CAAC,yBAAyB,CAC/B,CACF,CAAC;QACF,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,MAAoB,EAAE,EAAE;YACtD,IAAI,IAAI,EAAE;gBACR,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;aACrB;QACH,CAAC,CAAC,CAAC;IACL,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 { diag } from '@opentelemetry/api';\nimport {\n ExportResult,\n ExportResultCode,\n getStringFromEnv,\n} from '@opentelemetry/core';\nimport { SpanExporter, ReadableSpan } from '@opentelemetry/sdk-trace-base';\nimport { prepareSend } from './platform/index';\nimport * as zipkinTypes from './types';\nimport {\n toZipkinSpan,\n defaultStatusCodeTagName,\n defaultStatusErrorTagName,\n} from './transform';\nimport { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';\nimport { prepareGetHeaders } from './utils';\n\n/**\n * Zipkin Exporter\n */\nexport class ZipkinExporter implements SpanExporter {\n private readonly DEFAULT_SERVICE_NAME = 'OpenTelemetry Service';\n private readonly _statusCodeTagName: string;\n private readonly _statusDescriptionTagName: string;\n private _urlStr: string;\n private _send: zipkinTypes.SendFunction;\n private _getHeaders: zipkinTypes.GetHeaders | undefined;\n private _serviceName?: string;\n private _isShutdown: boolean;\n private _sendingPromises: Promise<unknown>[] = [];\n\n constructor(config: zipkinTypes.ExporterConfig = {}) {\n this._urlStr =\n config.url ||\n (getStringFromEnv('OTEL_EXPORTER_ZIPKIN_ENDPOINT') ??\n 'http://localhost:9411/api/v2/spans');\n this._send = prepareSend(this._urlStr, config.headers);\n this._serviceName = config.serviceName;\n this._statusCodeTagName =\n config.statusCodeTagName || defaultStatusCodeTagName;\n this._statusDescriptionTagName =\n config.statusDescriptionTagName || defaultStatusErrorTagName;\n this._isShutdown = false;\n if (typeof config.getExportRequestHeaders === 'function') {\n this._getHeaders = prepareGetHeaders(config.getExportRequestHeaders);\n } else {\n // noop\n this._beforeSend = function () {};\n }\n }\n\n /**\n * Export spans.\n */\n export(\n spans: ReadableSpan[],\n resultCallback: (result: ExportResult) => void\n ): void {\n const serviceName = String(\n this._serviceName ||\n spans[0].resource.attributes[ATTR_SERVICE_NAME] ||\n this.DEFAULT_SERVICE_NAME\n );\n\n diag.debug('Zipkin exporter export');\n if (this._isShutdown) {\n setTimeout(() =>\n resultCallback({\n code: ExportResultCode.FAILED,\n error: new Error('Exporter has been shutdown'),\n })\n );\n return;\n }\n const promise = new Promise<void>(resolve => {\n this._sendSpans(spans, serviceName, result => {\n resolve();\n resultCallback(result);\n });\n });\n\n this._sendingPromises.push(promise);\n const popPromise = () => {\n const index = this._sendingPromises.indexOf(promise);\n void this._sendingPromises.splice(index, 1);\n };\n promise.then(popPromise, popPromise);\n }\n\n /**\n * Shutdown exporter. Noop operation in this exporter.\n */\n shutdown(): Promise<void> {\n diag.debug('Zipkin exporter shutdown');\n this._isShutdown = true;\n return this.forceFlush();\n }\n\n /**\n * Exports any pending spans in exporter\n */\n forceFlush(): Promise<void> {\n return new Promise((resolve, reject) => {\n Promise.all(this._sendingPromises).then(() => {\n resolve();\n }, reject);\n });\n }\n\n /**\n * if user defines getExportRequestHeaders in config then this will be called\n * every time before send, otherwise it will be replaced with noop in\n * constructor\n * @default noop\n */\n private _beforeSend() {\n if (this._getHeaders) {\n this._send = prepareSend(this._urlStr, this._getHeaders());\n }\n }\n\n /**\n * Transform spans and sends to Zipkin service.\n */\n private _sendSpans(\n spans: ReadableSpan[],\n serviceName: string,\n done?: (result: ExportResult) => void\n ) {\n const zipkinSpans = spans.map(span =>\n toZipkinSpan(\n span,\n String(\n span.attributes[ATTR_SERVICE_NAME] ||\n span.resource.attributes[ATTR_SERVICE_NAME] ||\n serviceName\n ),\n this._statusCodeTagName,\n this._statusDescriptionTagName\n )\n );\n this._beforeSend();\n return this._send(zipkinSpans, (result: ExportResult) => {\n if (done) {\n return done(result);\n }\n });\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
1
  export { prepareSend } from './platform';
2
- export { ExporterConfig } from './types';
2
+ export type { ExporterConfig } from './types';
3
3
  export { ZipkinExporter } from './zipkin';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,uCAAyC;AAAhC,uGAAA,WAAW,OAAA;AAEpB,mCAA0C;AAAjC,wGAAA,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 */\n\nexport { prepareSend } from './platform';\nexport { ExporterConfig } from './types';\nexport { ZipkinExporter } from './zipkin';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,uCAAyC;AAAhC,uGAAA,WAAW,OAAA;AAEpB,mCAA0C;AAAjC,wGAAA,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 */\n\nexport { prepareSend } from './platform';\nexport type { ExporterConfig } from './types';\nexport { ZipkinExporter } from './zipkin';\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.0.1";
1
+ export declare const VERSION = "2.1.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -17,5 +17,5 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.VERSION = void 0;
19
19
  // this is autogenerated file, see scripts/version-update.js
20
- exports.VERSION = '2.0.1';
20
+ exports.VERSION = '2.1.0';
21
21
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,OAAO,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 = '2.0.1';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,OAAO,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 = '2.1.0';\n"]}
@@ -79,7 +79,7 @@ class ZipkinExporter {
79
79
  this._sendingPromises.push(promise);
80
80
  const popPromise = () => {
81
81
  const index = this._sendingPromises.indexOf(promise);
82
- this._sendingPromises.splice(index, 1);
82
+ void this._sendingPromises.splice(index, 1);
83
83
  };
84
84
  promise.then(popPromise, popPromise);
85
85
  }
@@ -1 +1 @@
1
- {"version":3,"file":"zipkin.js","sourceRoot":"","sources":["../../src/zipkin.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4CAA0C;AAC1C,8CAI6B;AAE7B,4CAA+C;AAE/C,2CAIqB;AACrB,8EAAwE;AACxE,mCAA4C;AAE5C;;GAEG;AACH,MAAa,cAAc;IACR,oBAAoB,GAAG,uBAAuB,CAAC;IAC/C,kBAAkB,CAAS;IAC3B,yBAAyB,CAAS;IAC3C,OAAO,CAAS;IAChB,KAAK,CAA2B;IAChC,WAAW,CAA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AE,CAAC,CAAC;SAC5D;IACH,CAAC;IAED;;OAEG;IACK,UAAU,CAChB,KAAqB,EACrB,WAAmB,EACnB,IAAqC;QAErC,MAAM,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CACnC,IAAA,wBAAY,EACV,IAAI,EACJ,MAAM,CACJ,IAAI,CAAC,UAAU,CAAC,wCAAiB,CAAC;YAChC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,wCAAiB,CAAC;YAC3C,WAAW,CACd,EACD,IAAI,CAAC,kBAAkB,EACvB,IAAI,CAAC,yBAAyB,CAC/B,CACF,CAAC;QACF,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,MAAoB,EAAE,EAAE;YACtD,IAAI,IAAI,EAAE;gBACR,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;aACrB;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAhID,wCAgIC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { diag } from '@opentelemetry/api';\nimport {\n ExportResult,\n ExportResultCode,\n getStringFromEnv,\n} from '@opentelemetry/core';\nimport { SpanExporter, ReadableSpan } from '@opentelemetry/sdk-trace-base';\nimport { prepareSend } from './platform/index';\nimport * as zipkinTypes from './types';\nimport {\n toZipkinSpan,\n defaultStatusCodeTagName,\n defaultStatusErrorTagName,\n} from './transform';\nimport { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';\nimport { prepareGetHeaders } from './utils';\n\n/**\n * Zipkin Exporter\n */\nexport class ZipkinExporter implements SpanExporter {\n private readonly DEFAULT_SERVICE_NAME = 'OpenTelemetry Service';\n private readonly _statusCodeTagName: string;\n private readonly _statusDescriptionTagName: string;\n private _urlStr: string;\n private _send: zipkinTypes.SendFunction;\n private _getHeaders: zipkinTypes.GetHeaders | undefined;\n private _serviceName?: string;\n private _isShutdown: boolean;\n private _sendingPromises: Promise<unknown>[] = [];\n\n constructor(config: zipkinTypes.ExporterConfig = {}) {\n this._urlStr =\n config.url ||\n (getStringFromEnv('OTEL_EXPORTER_ZIPKIN_ENDPOINT') ??\n 'http://localhost:9411/api/v2/spans');\n this._send = prepareSend(this._urlStr, config.headers);\n this._serviceName = config.serviceName;\n this._statusCodeTagName =\n config.statusCodeTagName || defaultStatusCodeTagName;\n this._statusDescriptionTagName =\n config.statusDescriptionTagName || defaultStatusErrorTagName;\n this._isShutdown = false;\n if (typeof config.getExportRequestHeaders === 'function') {\n this._getHeaders = prepareGetHeaders(config.getExportRequestHeaders);\n } else {\n // noop\n this._beforeSend = function () {};\n }\n }\n\n /**\n * Export spans.\n */\n export(\n spans: ReadableSpan[],\n resultCallback: (result: ExportResult) => void\n ): void {\n const serviceName = String(\n this._serviceName ||\n spans[0].resource.attributes[ATTR_SERVICE_NAME] ||\n this.DEFAULT_SERVICE_NAME\n );\n\n diag.debug('Zipkin exporter export');\n if (this._isShutdown) {\n setTimeout(() =>\n resultCallback({\n code: ExportResultCode.FAILED,\n error: new Error('Exporter has been shutdown'),\n })\n );\n return;\n }\n const promise = new Promise<void>(resolve => {\n this._sendSpans(spans, serviceName, result => {\n resolve();\n resultCallback(result);\n });\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 /**\n * Shutdown exporter. Noop operation in this exporter.\n */\n shutdown(): Promise<void> {\n diag.debug('Zipkin exporter shutdown');\n this._isShutdown = true;\n return this.forceFlush();\n }\n\n /**\n * Exports any pending spans in exporter\n */\n forceFlush(): Promise<void> {\n return new Promise((resolve, reject) => {\n Promise.all(this._sendingPromises).then(() => {\n resolve();\n }, reject);\n });\n }\n\n /**\n * if user defines getExportRequestHeaders in config then this will be called\n * every time before send, otherwise it will be replaced with noop in\n * constructor\n * @default noop\n */\n private _beforeSend() {\n if (this._getHeaders) {\n this._send = prepareSend(this._urlStr, this._getHeaders());\n }\n }\n\n /**\n * Transform spans and sends to Zipkin service.\n */\n private _sendSpans(\n spans: ReadableSpan[],\n serviceName: string,\n done?: (result: ExportResult) => void\n ) {\n const zipkinSpans = spans.map(span =>\n toZipkinSpan(\n span,\n String(\n span.attributes[ATTR_SERVICE_NAME] ||\n span.resource.attributes[ATTR_SERVICE_NAME] ||\n serviceName\n ),\n this._statusCodeTagName,\n this._statusDescriptionTagName\n )\n );\n this._beforeSend();\n return this._send(zipkinSpans, (result: ExportResult) => {\n if (done) {\n return done(result);\n }\n });\n }\n}\n"]}
1
+ {"version":3,"file":"zipkin.js","sourceRoot":"","sources":["../../src/zipkin.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4CAA0C;AAC1C,8CAI6B;AAE7B,4CAA+C;AAE/C,2CAIqB;AACrB,8EAAwE;AACxE,mCAA4C;AAE5C;;GAEG;AACH,MAAa,cAAc;IACR,oBAAoB,GAAG,uBAAuB,CAAC;IAC/C,kBAAkB,CAAS;IAC3B,yBAAyB,CAAS;IAC3C,OAAO,CAAS;IAChB,KAAK,CAA2B;IAChC,WAAW,CAAqC;IAChD,YAAY,CAAU;IACtB,WAAW,CAAU;IACrB,gBAAgB,GAAuB,EAAE,CAAC;IAElD,YAAY,SAAqC,EAAE;QACjD,IAAI,CAAC,OAAO;YACV,MAAM,CAAC,GAAG;gBACV,CAAC,IAAA,uBAAgB,EAAC,+BAA+B,CAAC;oBAChD,oCAAoC,CAAC,CAAC;QAC1C,IAAI,CAAC,KAAK,GA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B,CAAC;YAChC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,wCAAiB,CAAC;YAC3C,WAAW,CACd,EACD,IAAI,CAAC,kBAAkB,EACvB,IAAI,CAAC,yBAAyB,CAC/B,CACF,CAAC;QACF,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,MAAoB,EAAE,EAAE;YACtD,IAAI,IAAI,EAAE;gBACR,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;aACrB;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAhID,wCAgIC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { diag } from '@opentelemetry/api';\nimport {\n ExportResult,\n ExportResultCode,\n getStringFromEnv,\n} from '@opentelemetry/core';\nimport { SpanExporter, ReadableSpan } from '@opentelemetry/sdk-trace-base';\nimport { prepareSend } from './platform/index';\nimport * as zipkinTypes from './types';\nimport {\n toZipkinSpan,\n defaultStatusCodeTagName,\n defaultStatusErrorTagName,\n} from './transform';\nimport { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';\nimport { prepareGetHeaders } from './utils';\n\n/**\n * Zipkin Exporter\n */\nexport class ZipkinExporter implements SpanExporter {\n private readonly DEFAULT_SERVICE_NAME = 'OpenTelemetry Service';\n private readonly _statusCodeTagName: string;\n private readonly _statusDescriptionTagName: string;\n private _urlStr: string;\n private _send: zipkinTypes.SendFunction;\n private _getHeaders: zipkinTypes.GetHeaders | undefined;\n private _serviceName?: string;\n private _isShutdown: boolean;\n private _sendingPromises: Promise<unknown>[] = [];\n\n constructor(config: zipkinTypes.ExporterConfig = {}) {\n this._urlStr =\n config.url ||\n (getStringFromEnv('OTEL_EXPORTER_ZIPKIN_ENDPOINT') ??\n 'http://localhost:9411/api/v2/spans');\n this._send = prepareSend(this._urlStr, config.headers);\n this._serviceName = config.serviceName;\n this._statusCodeTagName =\n config.statusCodeTagName || defaultStatusCodeTagName;\n this._statusDescriptionTagName =\n config.statusDescriptionTagName || defaultStatusErrorTagName;\n this._isShutdown = false;\n if (typeof config.getExportRequestHeaders === 'function') {\n this._getHeaders = prepareGetHeaders(config.getExportRequestHeaders);\n } else {\n // noop\n this._beforeSend = function () {};\n }\n }\n\n /**\n * Export spans.\n */\n export(\n spans: ReadableSpan[],\n resultCallback: (result: ExportResult) => void\n ): void {\n const serviceName = String(\n this._serviceName ||\n spans[0].resource.attributes[ATTR_SERVICE_NAME] ||\n this.DEFAULT_SERVICE_NAME\n );\n\n diag.debug('Zipkin exporter export');\n if (this._isShutdown) {\n setTimeout(() =>\n resultCallback({\n code: ExportResultCode.FAILED,\n error: new Error('Exporter has been shutdown'),\n })\n );\n return;\n }\n const promise = new Promise<void>(resolve => {\n this._sendSpans(spans, serviceName, result => {\n resolve();\n resultCallback(result);\n });\n });\n\n this._sendingPromises.push(promise);\n const popPromise = () => {\n const index = this._sendingPromises.indexOf(promise);\n void this._sendingPromises.splice(index, 1);\n };\n promise.then(popPromise, popPromise);\n }\n\n /**\n * Shutdown exporter. Noop operation in this exporter.\n */\n shutdown(): Promise<void> {\n diag.debug('Zipkin exporter shutdown');\n this._isShutdown = true;\n return this.forceFlush();\n }\n\n /**\n * Exports any pending spans in exporter\n */\n forceFlush(): Promise<void> {\n return new Promise((resolve, reject) => {\n Promise.all(this._sendingPromises).then(() => {\n resolve();\n }, reject);\n });\n }\n\n /**\n * if user defines getExportRequestHeaders in config then this will be called\n * every time before send, otherwise it will be replaced with noop in\n * constructor\n * @default noop\n */\n private _beforeSend() {\n if (this._getHeaders) {\n this._send = prepareSend(this._urlStr, this._getHeaders());\n }\n }\n\n /**\n * Transform spans and sends to Zipkin service.\n */\n private _sendSpans(\n spans: ReadableSpan[],\n serviceName: string,\n done?: (result: ExportResult) => void\n ) {\n const zipkinSpans = spans.map(span =>\n toZipkinSpan(\n span,\n String(\n span.attributes[ATTR_SERVICE_NAME] ||\n span.resource.attributes[ATTR_SERVICE_NAME] ||\n serviceName\n ),\n this._statusCodeTagName,\n this._statusDescriptionTagName\n )\n );\n this._beforeSend();\n return this._send(zipkinSpans, (result: ExportResult) => {\n if (done) {\n return done(result);\n }\n });\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentelemetry/exporter-zipkin",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "description": "OpenTelemetry Zipkin Exporter allows the user to send collected traces to Zipkin.",
5
5
  "main": "build/src/index.js",
6
6
  "module": "build/esm/index.js",
@@ -24,7 +24,7 @@
24
24
  "test:browser": "karma start --single-run",
25
25
  "version": "node ../../scripts/version-update.js",
26
26
  "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
27
- "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies",
27
+ "precompile": "lerna run version --scope @opentelemetry/exporter-zipkin --include-dependencies",
28
28
  "prewatch": "npm run precompile",
29
29
  "peer-api-check": "node ../../scripts/peer-api-check.js",
30
30
  "align-api-deps": "node ../../scripts/align-api-deps.js"
@@ -59,8 +59,8 @@
59
59
  "access": "public"
60
60
  },
61
61
  "devDependencies": {
62
- "@babel/core": "7.26.10",
63
- "@babel/preset-env": "7.26.9",
62
+ "@babel/core": "7.27.1",
63
+ "@babel/preset-env": "7.27.2",
64
64
  "@opentelemetry/api": "^1.0.0",
65
65
  "@types/mocha": "10.0.10",
66
66
  "@types/node": "18.6.5",
@@ -68,7 +68,6 @@
68
68
  "@types/webpack-env": "1.16.3",
69
69
  "babel-loader": "10.0.0",
70
70
  "babel-plugin-istanbul": "7.0.0",
71
- "cross-var": "1.1.0",
72
71
  "karma": "6.4.4",
73
72
  "karma-chrome-launcher": "3.1.0",
74
73
  "karma-coverage": "2.2.1",
@@ -76,25 +75,25 @@
76
75
  "karma-spec-reporter": "0.0.36",
77
76
  "karma-webpack": "5.0.1",
78
77
  "lerna": "6.6.2",
79
- "mocha": "11.1.0",
78
+ "mocha": "11.7.2",
80
79
  "nock": "13.5.6",
81
80
  "nyc": "17.1.0",
82
- "sinon": "15.1.2",
83
- "ts-loader": "9.5.2",
81
+ "sinon": "18.0.1",
82
+ "ts-loader": "9.5.4",
84
83
  "typescript": "5.0.4",
85
- "webpack": "5.99.8",
84
+ "webpack": "5.101.3",
86
85
  "webpack-cli": "6.0.1"
87
86
  },
88
87
  "peerDependencies": {
89
88
  "@opentelemetry/api": "^1.0.0"
90
89
  },
91
90
  "dependencies": {
92
- "@opentelemetry/core": "2.0.1",
93
- "@opentelemetry/resources": "2.0.1",
94
- "@opentelemetry/sdk-trace-base": "2.0.1",
91
+ "@opentelemetry/core": "2.1.0",
92
+ "@opentelemetry/resources": "2.1.0",
93
+ "@opentelemetry/sdk-trace-base": "2.1.0",
95
94
  "@opentelemetry/semantic-conventions": "^1.29.0"
96
95
  },
97
96
  "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-exporter-zipkin",
98
97
  "sideEffects": false,
99
- "gitHead": "4ce5bd165195870f292fa95e312cffe05eb9e09d"
98
+ "gitHead": "98f9d720af84bc38074dfd4ab7760ae83a3e9826"
100
99
  }