@opentelemetry/otlp-exporter-base 0.219.0 → 0.221.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.
Files changed (117) hide show
  1. package/build/esm/ExporterMetrics.d.ts +24 -0
  2. package/build/esm/ExporterMetrics.js +104 -0
  3. package/build/esm/ExporterMetrics.js.map +1 -0
  4. package/build/esm/OTLPExporterBase.d.ts +2 -0
  5. package/build/esm/OTLPExporterBase.js +3 -0
  6. package/build/esm/OTLPExporterBase.js.map +1 -1
  7. package/build/esm/configuration/create-legacy-browser-delegate.d.ts +8 -2
  8. package/build/esm/configuration/create-legacy-browser-delegate.js +36 -2
  9. package/build/esm/configuration/create-legacy-browser-delegate.js.map +1 -1
  10. package/build/esm/configuration/legacy-base-configuration.d.ts +6 -0
  11. package/build/esm/configuration/legacy-base-configuration.js.map +1 -1
  12. package/build/esm/index-browser-http.d.ts +1 -1
  13. package/build/esm/index-browser-http.js +1 -1
  14. package/build/esm/index-browser-http.js.map +1 -1
  15. package/build/esm/index-node-http.d.ts +1 -1
  16. package/build/esm/index-node-http.js +1 -1
  17. package/build/esm/index-node-http.js.map +1 -1
  18. package/build/esm/index.d.ts +1 -0
  19. package/build/esm/index.js +1 -0
  20. package/build/esm/index.js.map +1 -1
  21. package/build/esm/otlp-browser-http-export-delegate.d.ts +3 -2
  22. package/build/esm/otlp-browser-http-export-delegate.js +8 -4
  23. package/build/esm/otlp-browser-http-export-delegate.js.map +1 -1
  24. package/build/esm/otlp-export-delegate.d.ts +3 -0
  25. package/build/esm/otlp-export-delegate.js +19 -6
  26. package/build/esm/otlp-export-delegate.js.map +1 -1
  27. package/build/esm/otlp-http-export-delegate.d.ts +5 -2
  28. package/build/esm/otlp-http-export-delegate.js +30 -1
  29. package/build/esm/otlp-http-export-delegate.js.map +1 -1
  30. package/build/esm/otlp-network-export-delegate.d.ts +2 -1
  31. package/build/esm/otlp-network-export-delegate.js +2 -1
  32. package/build/esm/otlp-network-export-delegate.js.map +1 -1
  33. package/build/esm/semconv.d.ts +91 -0
  34. package/build/esm/semconv.js +100 -0
  35. package/build/esm/semconv.js.map +1 -0
  36. package/build/esm/version.d.ts +1 -1
  37. package/build/esm/version.js +1 -1
  38. package/build/esm/version.js.map +1 -1
  39. package/build/esnext/ExporterMetrics.d.ts +24 -0
  40. package/build/esnext/ExporterMetrics.js +104 -0
  41. package/build/esnext/ExporterMetrics.js.map +1 -0
  42. package/build/esnext/OTLPExporterBase.d.ts +2 -0
  43. package/build/esnext/OTLPExporterBase.js +3 -0
  44. package/build/esnext/OTLPExporterBase.js.map +1 -1
  45. package/build/esnext/configuration/create-legacy-browser-delegate.d.ts +8 -2
  46. package/build/esnext/configuration/create-legacy-browser-delegate.js +36 -2
  47. package/build/esnext/configuration/create-legacy-browser-delegate.js.map +1 -1
  48. package/build/esnext/configuration/legacy-base-configuration.d.ts +6 -0
  49. package/build/esnext/configuration/legacy-base-configuration.js.map +1 -1
  50. package/build/esnext/index-browser-http.d.ts +1 -1
  51. package/build/esnext/index-browser-http.js +1 -1
  52. package/build/esnext/index-browser-http.js.map +1 -1
  53. package/build/esnext/index-node-http.d.ts +1 -1
  54. package/build/esnext/index-node-http.js +1 -1
  55. package/build/esnext/index-node-http.js.map +1 -1
  56. package/build/esnext/index.d.ts +1 -0
  57. package/build/esnext/index.js +1 -0
  58. package/build/esnext/index.js.map +1 -1
  59. package/build/esnext/otlp-browser-http-export-delegate.d.ts +3 -2
  60. package/build/esnext/otlp-browser-http-export-delegate.js +8 -4
  61. package/build/esnext/otlp-browser-http-export-delegate.js.map +1 -1
  62. package/build/esnext/otlp-export-delegate.d.ts +3 -0
  63. package/build/esnext/otlp-export-delegate.js +19 -6
  64. package/build/esnext/otlp-export-delegate.js.map +1 -1
  65. package/build/esnext/otlp-http-export-delegate.d.ts +5 -2
  66. package/build/esnext/otlp-http-export-delegate.js +30 -1
  67. package/build/esnext/otlp-http-export-delegate.js.map +1 -1
  68. package/build/esnext/otlp-network-export-delegate.d.ts +2 -1
  69. package/build/esnext/otlp-network-export-delegate.js +2 -1
  70. package/build/esnext/otlp-network-export-delegate.js.map +1 -1
  71. package/build/esnext/semconv.d.ts +91 -0
  72. package/build/esnext/semconv.js +100 -0
  73. package/build/esnext/semconv.js.map +1 -0
  74. package/build/esnext/version.d.ts +1 -1
  75. package/build/esnext/version.js +1 -1
  76. package/build/esnext/version.js.map +1 -1
  77. package/build/src/ExporterMetrics.d.ts +24 -0
  78. package/build/src/ExporterMetrics.js +108 -0
  79. package/build/src/ExporterMetrics.js.map +1 -0
  80. package/build/src/OTLPExporterBase.d.ts +2 -0
  81. package/build/src/OTLPExporterBase.js +3 -0
  82. package/build/src/OTLPExporterBase.js.map +1 -1
  83. package/build/src/configuration/create-legacy-browser-delegate.d.ts +8 -2
  84. package/build/src/configuration/create-legacy-browser-delegate.js +38 -3
  85. package/build/src/configuration/create-legacy-browser-delegate.js.map +1 -1
  86. package/build/src/configuration/legacy-base-configuration.d.ts +6 -0
  87. package/build/src/configuration/legacy-base-configuration.js.map +1 -1
  88. package/build/src/configuration/legacy-node-configuration.js +1 -1
  89. package/build/src/configuration/legacy-node-configuration.js.map +1 -1
  90. package/build/src/index-browser-http.d.ts +1 -1
  91. package/build/src/index-browser-http.js +2 -1
  92. package/build/src/index-browser-http.js.map +1 -1
  93. package/build/src/index-node-http.d.ts +1 -1
  94. package/build/src/index-node-http.js +2 -1
  95. package/build/src/index-node-http.js.map +1 -1
  96. package/build/src/index.d.ts +1 -0
  97. package/build/src/index.js +3 -1
  98. package/build/src/index.js.map +1 -1
  99. package/build/src/otlp-browser-http-export-delegate.d.ts +3 -2
  100. package/build/src/otlp-browser-http-export-delegate.js +8 -4
  101. package/build/src/otlp-browser-http-export-delegate.js.map +1 -1
  102. package/build/src/otlp-export-delegate.d.ts +3 -0
  103. package/build/src/otlp-export-delegate.js +19 -6
  104. package/build/src/otlp-export-delegate.js.map +1 -1
  105. package/build/src/otlp-http-export-delegate.d.ts +5 -2
  106. package/build/src/otlp-http-export-delegate.js +32 -2
  107. package/build/src/otlp-http-export-delegate.js.map +1 -1
  108. package/build/src/otlp-network-export-delegate.d.ts +2 -1
  109. package/build/src/otlp-network-export-delegate.js +2 -1
  110. package/build/src/otlp-network-export-delegate.js.map +1 -1
  111. package/build/src/semconv.d.ts +91 -0
  112. package/build/src/semconv.js +103 -0
  113. package/build/src/semconv.js.map +1 -0
  114. package/build/src/version.d.ts +1 -1
  115. package/build/src/version.js +1 -1
  116. package/build/src/version.js.map +1 -1
  117. package/package.json +10 -10
@@ -1,14 +1,43 @@
1
+ /*
2
+ * Copyright The OpenTelemetry Authors
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
1
5
  import { createOtlpExportDelegate } from './otlp-export-delegate';
2
6
  import { createHttpExporterTransport } from './transport/http-exporter-transport';
3
7
  import { createBoundedQueueExportPromiseHandler } from './bounded-queue-export-promise-handler';
4
8
  import { createRetryingTransport } from './retrying-transport';
5
- export function createOtlpHttpExportDelegate(options, serializer) {
9
+ import { OTLPExporterError } from './types';
10
+ import { ATTR_HTTP_RESPONSE_STATUS_CODE } from './semconv';
11
+ import { ExporterMetrics } from './ExporterMetrics';
12
+ export function createOtlpHttpExporterMetrics(metricsComponentType, exporterMetricsHelper, url, meterProvider) {
13
+ return new ExporterMetrics({
14
+ componentType: metricsComponentType,
15
+ metricsHelper: exporterMetricsHelper,
16
+ url,
17
+ meterProvider,
18
+ responseAttributesFromError: (error) => {
19
+ if (!error) {
20
+ return {
21
+ [ATTR_HTTP_RESPONSE_STATUS_CODE]: 200,
22
+ };
23
+ }
24
+ if (!(error instanceof OTLPExporterError)) {
25
+ return {};
26
+ }
27
+ return {
28
+ [ATTR_HTTP_RESPONSE_STATUS_CODE]: error.code,
29
+ };
30
+ },
31
+ });
32
+ }
33
+ export function createOtlpHttpExportDelegate(options, serializer, metricsComponentType, exporterMetricsHelper, meterProvider) {
6
34
  return createOtlpExportDelegate({
7
35
  transport: createRetryingTransport({
8
36
  transport: createHttpExporterTransport(options),
9
37
  }),
10
38
  serializer: serializer,
11
39
  promiseHandler: createBoundedQueueExportPromiseHandler(options),
40
+ metrics: createOtlpHttpExporterMetrics(metricsComponentType, exporterMetricsHelper, options.url, meterProvider),
12
41
  }, { timeout: options.timeoutMillis });
13
42
  }
14
43
  //# sourceMappingURL=otlp-http-export-delegate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"otlp-http-export-delegate.js","sourceRoot":"","sources":["../../src/otlp-http-export-delegate.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAElE,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,EAAE,sCAAsC,EAAE,MAAM,wCAAwC,CAAC;AAChG,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAG/D,MAAM,UAAU,4BAA4B,CAC1C,OAAkC,EAClC,UAA2C;IAE3C,OAAO,wBAAwB,CAC7B;QACE,SAAS,EAAE,uBAAuB,CAAC;YACjC,SAAS,EAAE,2BAA2B,CAAC,OAAO,CAAC;SAChD,CAAC;QACF,UAAU,EAAE,UAAU;QACtB,cAAc,EAAE,sCAAsC,CAAC,OAAO,CAAC;KAChE,EACD,EAAE,OAAO,EAAE,OAAO,CAAC,aAAa,EAAE,CACnC,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { IOtlpExportDelegate } from './otlp-export-delegate';\nimport { createOtlpExportDelegate } from './otlp-export-delegate';\nimport type { ISerializer } from '@opentelemetry/otlp-transformer';\nimport { createHttpExporterTransport } from './transport/http-exporter-transport';\nimport { createBoundedQueueExportPromiseHandler } from './bounded-queue-export-promise-handler';\nimport { createRetryingTransport } from './retrying-transport';\nimport type { OtlpNodeHttpConfiguration } from './configuration/otlp-node-http-configuration';\n\nexport function createOtlpHttpExportDelegate<Internal, Response>(\n options: OtlpNodeHttpConfiguration,\n serializer: ISerializer<Internal, Response>\n): IOtlpExportDelegate<Internal> {\n return createOtlpExportDelegate(\n {\n transport: createRetryingTransport({\n transport: createHttpExporterTransport(options),\n }),\n serializer: serializer,\n promiseHandler: createBoundedQueueExportPromiseHandler(options),\n },\n { timeout: options.timeoutMillis }\n );\n}\n"]}
1
+ {"version":3,"file":"otlp-http-export-delegate.js","sourceRoot":"","sources":["../../src/otlp-http-export-delegate.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAKlE,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,EAAE,sCAAsC,EAAE,MAAM,wCAAwC,CAAC;AAChG,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,8BAA8B,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,UAAU,6BAA6B,CAC3C,oBAA4B,EAC5B,qBAAuD,EACvD,GAAuB,EACvB,aAAwC;IAExC,OAAO,IAAI,eAAe,CAAC;QACzB,aAAa,EAAE,oBAAoB;QACnC,aAAa,EAAE,qBAAqB;QACpC,GAAG;QACH,aAAa;QACb,2BAA2B,EAAE,CAAC,KAAiC,EAAE,EAAE;YACjE,IAAI,CAAC,KAAK,EAAE;gBACV,OAAO;oBACL,CAAC,8BAA8B,CAAC,EAAE,GAAG;iBACtC,CAAC;aACH;YACD,IAAI,CAAC,CAAC,KAAK,YAAY,iBAAiB,CAAC,EAAE;gBACzC,OAAO,EAAE,CAAC;aACX;YACD,OAAO;gBACL,CAAC,8BAA8B,CAAC,EAAE,KAAK,CAAC,IAAI;aAC7C,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,4BAA4B,CAC1C,OAAkC,EAClC,UAA2C,EAC3C,oBAA4B,EAC5B,qBAAuD,EACvD,aAAwC;IAExC,OAAO,wBAAwB,CAC7B;QACE,SAAS,EAAE,uBAAuB,CAAC;YACjC,SAAS,EAAE,2BAA2B,CAAC,OAAO,CAAC;SAChD,CAAC;QACF,UAAU,EAAE,UAAU;QACtB,cAAc,EAAE,sCAAsC,CAAC,OAAO,CAAC;QAC/D,OAAO,EAAE,6BAA6B,CACpC,oBAAoB,EACpB,qBAAqB,EACrB,OAAO,CAAC,GAAG,EACX,aAAa,CACd;KACF,EACD,EAAE,OAAO,EAAE,OAAO,CAAC,aAAa,EAAE,CACnC,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { MeterProvider } from '@opentelemetry/api';\n\nimport type { IOtlpExportDelegate } from './otlp-export-delegate';\nimport { createOtlpExportDelegate } from './otlp-export-delegate';\nimport type {\n IExporterMetricsHelper,\n ISerializer,\n} from '@opentelemetry/otlp-transformer';\nimport { createHttpExporterTransport } from './transport/http-exporter-transport';\nimport { createBoundedQueueExportPromiseHandler } from './bounded-queue-export-promise-handler';\nimport { createRetryingTransport } from './retrying-transport';\nimport type { OtlpNodeHttpConfiguration } from './configuration/otlp-node-http-configuration';\nimport { OTLPExporterError } from './types';\nimport { ATTR_HTTP_RESPONSE_STATUS_CODE } from './semconv';\nimport { ExporterMetrics } from './ExporterMetrics';\n\nexport function createOtlpHttpExporterMetrics<Internal>(\n metricsComponentType: string,\n exporterMetricsHelper: IExporterMetricsHelper<Internal>,\n url: string | undefined,\n meterProvider: MeterProvider | undefined\n): ExporterMetrics<Internal> {\n return new ExporterMetrics({\n componentType: metricsComponentType,\n metricsHelper: exporterMetricsHelper,\n url,\n meterProvider,\n responseAttributesFromError: (error: Error | string | undefined) => {\n if (!error) {\n return {\n [ATTR_HTTP_RESPONSE_STATUS_CODE]: 200,\n };\n }\n if (!(error instanceof OTLPExporterError)) {\n return {};\n }\n return {\n [ATTR_HTTP_RESPONSE_STATUS_CODE]: error.code,\n };\n },\n });\n}\n\nexport function createOtlpHttpExportDelegate<Internal, Response>(\n options: OtlpNodeHttpConfiguration,\n serializer: ISerializer<Internal, Response>,\n metricsComponentType: string,\n exporterMetricsHelper: IExporterMetricsHelper<Internal>,\n meterProvider: MeterProvider | undefined\n): IOtlpExportDelegate<Internal> {\n return createOtlpExportDelegate(\n {\n transport: createRetryingTransport({\n transport: createHttpExporterTransport(options),\n }),\n serializer: serializer,\n promiseHandler: createBoundedQueueExportPromiseHandler(options),\n metrics: createOtlpHttpExporterMetrics(\n metricsComponentType,\n exporterMetricsHelper,\n options.url,\n meterProvider\n ),\n },\n { timeout: options.timeoutMillis }\n );\n}\n"]}
@@ -2,5 +2,6 @@ import type { OtlpSharedConfiguration } from './configuration/shared-configurati
2
2
  import type { ISerializer } from '@opentelemetry/otlp-transformer';
3
3
  import type { IExporterTransport } from './exporter-transport';
4
4
  import type { IOtlpExportDelegate } from './otlp-export-delegate';
5
- export declare function createOtlpNetworkExportDelegate<Internal, Response>(options: OtlpSharedConfiguration, serializer: ISerializer<Internal, Response>, transport: IExporterTransport): IOtlpExportDelegate<Internal>;
5
+ import { type ExporterMetrics } from './ExporterMetrics';
6
+ export declare function createOtlpNetworkExportDelegate<Internal, Response>(options: OtlpSharedConfiguration, serializer: ISerializer<Internal, Response>, metrics: ExporterMetrics<Internal>, transport: IExporterTransport): IOtlpExportDelegate<Internal>;
6
7
  //# sourceMappingURL=otlp-network-export-delegate.d.ts.map
@@ -4,11 +4,12 @@
4
4
  */
5
5
  import { createBoundedQueueExportPromiseHandler } from './bounded-queue-export-promise-handler';
6
6
  import { createOtlpExportDelegate } from './otlp-export-delegate';
7
- export function createOtlpNetworkExportDelegate(options, serializer, transport) {
7
+ export function createOtlpNetworkExportDelegate(options, serializer, metrics, transport) {
8
8
  return createOtlpExportDelegate({
9
9
  transport: transport,
10
10
  serializer,
11
11
  promiseHandler: createBoundedQueueExportPromiseHandler(options),
12
+ metrics,
12
13
  }, { timeout: options.timeoutMillis });
13
14
  }
14
15
  //# sourceMappingURL=otlp-network-export-delegate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"otlp-network-export-delegate.js","sourceRoot":"","sources":["../../src/otlp-network-export-delegate.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,sCAAsC,EAAE,MAAM,wCAAwC,CAAC;AAKhG,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAElE,MAAM,UAAU,+BAA+B,CAC7C,OAAgC,EAChC,UAA2C,EAC3C,SAA6B;IAE7B,OAAO,wBAAwB,CAC7B;QACE,SAAS,EAAE,SAAS;QACpB,UAAU;QACV,cAAc,EAAE,sCAAsC,CAAC,OAAO,CAAC;KAChE,EACD,EAAE,OAAO,EAAE,OAAO,CAAC,aAAa,EAAE,CACnC,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { createBoundedQueueExportPromiseHandler } from './bounded-queue-export-promise-handler';\nimport type { OtlpSharedConfiguration } from './configuration/shared-configuration';\nimport type { ISerializer } from '@opentelemetry/otlp-transformer';\nimport type { IExporterTransport } from './exporter-transport';\nimport type { IOtlpExportDelegate } from './otlp-export-delegate';\nimport { createOtlpExportDelegate } from './otlp-export-delegate';\n\nexport function createOtlpNetworkExportDelegate<Internal, Response>(\n options: OtlpSharedConfiguration,\n serializer: ISerializer<Internal, Response>,\n transport: IExporterTransport\n): IOtlpExportDelegate<Internal> {\n return createOtlpExportDelegate(\n {\n transport: transport,\n serializer,\n promiseHandler: createBoundedQueueExportPromiseHandler(options),\n },\n { timeout: options.timeoutMillis }\n );\n}\n"]}
1
+ {"version":3,"file":"otlp-network-export-delegate.js","sourceRoot":"","sources":["../../src/otlp-network-export-delegate.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,sCAAsC,EAAE,MAAM,wCAAwC,CAAC;AAKhG,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAGlE,MAAM,UAAU,+BAA+B,CAC7C,OAAgC,EAChC,UAA2C,EAC3C,OAAkC,EAClC,SAA6B;IAE7B,OAAO,wBAAwB,CAC7B;QACE,SAAS,EAAE,SAAS;QACpB,UAAU;QACV,cAAc,EAAE,sCAAsC,CAAC,OAAO,CAAC;QAC/D,OAAO;KACR,EACD,EAAE,OAAO,EAAE,OAAO,CAAC,aAAa,EAAE,CACnC,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { createBoundedQueueExportPromiseHandler } from './bounded-queue-export-promise-handler';\nimport type { OtlpSharedConfiguration } from './configuration/shared-configuration';\nimport type { ISerializer } from '@opentelemetry/otlp-transformer';\nimport type { IExporterTransport } from './exporter-transport';\nimport type { IOtlpExportDelegate } from './otlp-export-delegate';\nimport { createOtlpExportDelegate } from './otlp-export-delegate';\nimport { type ExporterMetrics } from './ExporterMetrics';\n\nexport function createOtlpNetworkExportDelegate<Internal, Response>(\n options: OtlpSharedConfiguration,\n serializer: ISerializer<Internal, Response>,\n metrics: ExporterMetrics<Internal>,\n transport: IExporterTransport\n): IOtlpExportDelegate<Internal> {\n return createOtlpExportDelegate(\n {\n transport: transport,\n serializer,\n promiseHandler: createBoundedQueueExportPromiseHandler(options),\n metrics,\n },\n { timeout: options.timeoutMillis }\n );\n}\n"]}
@@ -0,0 +1,91 @@
1
+ /**
2
+ * [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).
3
+ *
4
+ * @example 200
5
+ */
6
+ export declare const ATTR_HTTP_RESPONSE_STATUS_CODE: "http.response.status_code";
7
+ /**
8
+ * A name uniquely identifying the instance of the OpenTelemetry component within its containing SDK instance.
9
+ *
10
+ * @example otlp_grpc_span_exporter/0
11
+ * @example custom-name
12
+ *
13
+ * @note Implementations **SHOULD** ensure a low cardinality for this attribute, even across application or SDK restarts.
14
+ * E.g. implementations **MUST NOT** use UUIDs as values for this attribute.
15
+ *
16
+ * Implementations **MAY** achieve these goals by following a `<otel.component.type>/<instance-counter>` pattern, e.g. `batching_span_processor/0`.
17
+ * Hereby `otel.component.type` refers to the corresponding attribute value of the component.
18
+ *
19
+ * The value of `instance-counter` **MAY** be automatically assigned by the component and uniqueness within the enclosing SDK instance **MUST** be guaranteed.
20
+ * For example, `<instance-counter>` **MAY** be implemented by using a monotonically increasing counter (starting with `0`), which is incremented every time an
21
+ * instance of the given component type is started.
22
+ *
23
+ * With this implementation, for example the first Batching Span Processor would have `batching_span_processor/0`
24
+ * as `otel.component.name`, the second one `batching_span_processor/1` and so on.
25
+ * These values will therefore be reused in the case of an application restart.
26
+ *
27
+ * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
28
+ */
29
+ export declare const ATTR_OTEL_COMPONENT_NAME: "otel.component.name";
30
+ /**
31
+ * A name identifying the type of the OpenTelemetry component.
32
+ *
33
+ * @example batching_span_processor
34
+ * @example com.example.MySpanExporter
35
+ *
36
+ * @note If none of the standardized values apply, implementations **SHOULD** use the language-defined name of the type.
37
+ * E.g. for Java the fully qualified classname **SHOULD** be used in this case.
38
+ *
39
+ * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
40
+ */
41
+ export declare const ATTR_OTEL_COMPONENT_TYPE: "otel.component.type";
42
+ /**
43
+ * Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.
44
+ *
45
+ * @example example.com
46
+ * @example 10.1.2.80
47
+ * @example /tmp/my.sock
48
+ *
49
+ * @note When observed from the client side, and when communicating through an intermediary, `server.address` **SHOULD** represent the server address behind any intermediaries, for example proxies, if it's available.
50
+ */
51
+ export declare const ATTR_SERVER_ADDRESS: "server.address";
52
+ /**
53
+ * Server port number.
54
+ *
55
+ * @example 80
56
+ * @example 8080
57
+ * @example 443
58
+ *
59
+ * @note When observed from the client side, and when communicating through an intermediary, `server.port` **SHOULD** represent the server port behind any intermediaries, for example proxies, if it's available.
60
+ */
61
+ export declare const ATTR_SERVER_PORT: "server.port";
62
+ /**
63
+ * Describes a class of error the operation ended with.
64
+ *
65
+ * @example timeout
66
+ * @example java.net.UnknownHostException
67
+ * @example server_certificate_invalid
68
+ * @example 500
69
+ *
70
+ * @note The `error.type` **SHOULD** be predictable, and **SHOULD** have low cardinality.
71
+ *
72
+ * When `error.type` is set to a type (e.g., an exception type), its
73
+ * canonical class name identifying the type within the artifact **SHOULD** be used.
74
+ *
75
+ * Instrumentations **SHOULD** document the list of errors they report.
76
+ *
77
+ * The cardinality of `error.type` within one instrumentation library **SHOULD** be low.
78
+ * Telemetry consumers that aggregate data from multiple instrumentation libraries and applications
79
+ * should be prepared for `error.type` to have high cardinality at query time when no
80
+ * additional filters are applied.
81
+ *
82
+ * If the operation has completed successfully, instrumentations **SHOULD NOT** set `error.type`.
83
+ *
84
+ * If a specific domain defines its own set of error identifiers (such as HTTP or RPC status codes),
85
+ * it's **RECOMMENDED** to:
86
+ *
87
+ * - Use a domain-specific attribute
88
+ * - Set `error.type` to capture all errors, regardless of whether they are defined within the domain-specific set or not.
89
+ */
90
+ export declare const ATTR_ERROR_TYPE: "error.type";
91
+ //# sourceMappingURL=semconv.d.ts.map
@@ -0,0 +1,100 @@
1
+ /*
2
+ * Copyright The OpenTelemetry Authors
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ /*
6
+ * This file contains a copy of unstable semantic convention definitions
7
+ * used by this package.
8
+ * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv
9
+ */
10
+ /**
11
+ * [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).
12
+ *
13
+ * @example 200
14
+ */
15
+ export const ATTR_HTTP_RESPONSE_STATUS_CODE = 'http.response.status_code';
16
+ /**
17
+ * A name uniquely identifying the instance of the OpenTelemetry component within its containing SDK instance.
18
+ *
19
+ * @example otlp_grpc_span_exporter/0
20
+ * @example custom-name
21
+ *
22
+ * @note Implementations **SHOULD** ensure a low cardinality for this attribute, even across application or SDK restarts.
23
+ * E.g. implementations **MUST NOT** use UUIDs as values for this attribute.
24
+ *
25
+ * Implementations **MAY** achieve these goals by following a `<otel.component.type>/<instance-counter>` pattern, e.g. `batching_span_processor/0`.
26
+ * Hereby `otel.component.type` refers to the corresponding attribute value of the component.
27
+ *
28
+ * The value of `instance-counter` **MAY** be automatically assigned by the component and uniqueness within the enclosing SDK instance **MUST** be guaranteed.
29
+ * For example, `<instance-counter>` **MAY** be implemented by using a monotonically increasing counter (starting with `0`), which is incremented every time an
30
+ * instance of the given component type is started.
31
+ *
32
+ * With this implementation, for example the first Batching Span Processor would have `batching_span_processor/0`
33
+ * as `otel.component.name`, the second one `batching_span_processor/1` and so on.
34
+ * These values will therefore be reused in the case of an application restart.
35
+ *
36
+ * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
37
+ */
38
+ export const ATTR_OTEL_COMPONENT_NAME = 'otel.component.name';
39
+ /**
40
+ * A name identifying the type of the OpenTelemetry component.
41
+ *
42
+ * @example batching_span_processor
43
+ * @example com.example.MySpanExporter
44
+ *
45
+ * @note If none of the standardized values apply, implementations **SHOULD** use the language-defined name of the type.
46
+ * E.g. for Java the fully qualified classname **SHOULD** be used in this case.
47
+ *
48
+ * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
49
+ */
50
+ export const ATTR_OTEL_COMPONENT_TYPE = 'otel.component.type';
51
+ /**
52
+ * Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.
53
+ *
54
+ * @example example.com
55
+ * @example 10.1.2.80
56
+ * @example /tmp/my.sock
57
+ *
58
+ * @note When observed from the client side, and when communicating through an intermediary, `server.address` **SHOULD** represent the server address behind any intermediaries, for example proxies, if it's available.
59
+ */
60
+ export const ATTR_SERVER_ADDRESS = 'server.address';
61
+ /**
62
+ * Server port number.
63
+ *
64
+ * @example 80
65
+ * @example 8080
66
+ * @example 443
67
+ *
68
+ * @note When observed from the client side, and when communicating through an intermediary, `server.port` **SHOULD** represent the server port behind any intermediaries, for example proxies, if it's available.
69
+ */
70
+ export const ATTR_SERVER_PORT = 'server.port';
71
+ /**
72
+ * Describes a class of error the operation ended with.
73
+ *
74
+ * @example timeout
75
+ * @example java.net.UnknownHostException
76
+ * @example server_certificate_invalid
77
+ * @example 500
78
+ *
79
+ * @note The `error.type` **SHOULD** be predictable, and **SHOULD** have low cardinality.
80
+ *
81
+ * When `error.type` is set to a type (e.g., an exception type), its
82
+ * canonical class name identifying the type within the artifact **SHOULD** be used.
83
+ *
84
+ * Instrumentations **SHOULD** document the list of errors they report.
85
+ *
86
+ * The cardinality of `error.type` within one instrumentation library **SHOULD** be low.
87
+ * Telemetry consumers that aggregate data from multiple instrumentation libraries and applications
88
+ * should be prepared for `error.type` to have high cardinality at query time when no
89
+ * additional filters are applied.
90
+ *
91
+ * If the operation has completed successfully, instrumentations **SHOULD NOT** set `error.type`.
92
+ *
93
+ * If a specific domain defines its own set of error identifiers (such as HTTP or RPC status codes),
94
+ * it's **RECOMMENDED** to:
95
+ *
96
+ * - Use a domain-specific attribute
97
+ * - Set `error.type` to capture all errors, regardless of whether they are defined within the domain-specific set or not.
98
+ */
99
+ export const ATTR_ERROR_TYPE = 'error.type';
100
+ //# sourceMappingURL=semconv.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"semconv.js","sourceRoot":"","sources":["../../src/semconv.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,8BAA8B,GACzC,2BAAoC,CAAC;AAEvC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,qBAA8B,CAAC;AAEvE;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,qBAA8B,CAAC;AAEvE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,gBAAyB,CAAC;AAE7D;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAsB,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,YAAqB,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/*\n * This file contains a copy of unstable semantic convention definitions\n * used by this package.\n * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv\n */\n\n/**\n * [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).\n *\n * @example 200\n */\nexport const ATTR_HTTP_RESPONSE_STATUS_CODE =\n 'http.response.status_code' as const;\n\n/**\n * A name uniquely identifying the instance of the OpenTelemetry component within its containing SDK instance.\n *\n * @example otlp_grpc_span_exporter/0\n * @example custom-name\n *\n * @note Implementations **SHOULD** ensure a low cardinality for this attribute, even across application or SDK restarts.\n * E.g. implementations **MUST NOT** use UUIDs as values for this attribute.\n *\n * Implementations **MAY** achieve these goals by following a `<otel.component.type>/<instance-counter>` pattern, e.g. `batching_span_processor/0`.\n * Hereby `otel.component.type` refers to the corresponding attribute value of the component.\n *\n * The value of `instance-counter` **MAY** be automatically assigned by the component and uniqueness within the enclosing SDK instance **MUST** be guaranteed.\n * For example, `<instance-counter>` **MAY** be implemented by using a monotonically increasing counter (starting with `0`), which is incremented every time an\n * instance of the given component type is started.\n *\n * With this implementation, for example the first Batching Span Processor would have `batching_span_processor/0`\n * as `otel.component.name`, the second one `batching_span_processor/1` and so on.\n * These values will therefore be reused in the case of an application restart.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_OTEL_COMPONENT_NAME = 'otel.component.name' as const;\n\n/**\n * A name identifying the type of the OpenTelemetry component.\n *\n * @example batching_span_processor\n * @example com.example.MySpanExporter\n *\n * @note If none of the standardized values apply, implementations **SHOULD** use the language-defined name of the type.\n * E.g. for Java the fully qualified classname **SHOULD** be used in this case.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_OTEL_COMPONENT_TYPE = 'otel.component.type' as const;\n\n/**\n * Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.\n *\n * @example example.com\n * @example 10.1.2.80\n * @example /tmp/my.sock\n *\n * @note When observed from the client side, and when communicating through an intermediary, `server.address` **SHOULD** represent the server address behind any intermediaries, for example proxies, if it's available.\n */\nexport const ATTR_SERVER_ADDRESS = 'server.address' as const;\n\n/**\n * Server port number.\n *\n * @example 80\n * @example 8080\n * @example 443\n *\n * @note When observed from the client side, and when communicating through an intermediary, `server.port` **SHOULD** represent the server port behind any intermediaries, for example proxies, if it's available.\n */\nexport const ATTR_SERVER_PORT = 'server.port' as const;\n\n/**\n * Describes a class of error the operation ended with.\n *\n * @example timeout\n * @example java.net.UnknownHostException\n * @example server_certificate_invalid\n * @example 500\n *\n * @note The `error.type` **SHOULD** be predictable, and **SHOULD** have low cardinality.\n *\n * When `error.type` is set to a type (e.g., an exception type), its\n * canonical class name identifying the type within the artifact **SHOULD** be used.\n *\n * Instrumentations **SHOULD** document the list of errors they report.\n *\n * The cardinality of `error.type` within one instrumentation library **SHOULD** be low.\n * Telemetry consumers that aggregate data from multiple instrumentation libraries and applications\n * should be prepared for `error.type` to have high cardinality at query time when no\n * additional filters are applied.\n *\n * If the operation has completed successfully, instrumentations **SHOULD NOT** set `error.type`.\n *\n * If a specific domain defines its own set of error identifiers (such as HTTP or RPC status codes),\n * it's **RECOMMENDED** to:\n *\n * - Use a domain-specific attribute\n * - Set `error.type` to capture all errors, regardless of whether they are defined within the domain-specific set or not.\n */\nexport const ATTR_ERROR_TYPE = 'error.type' as const;\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.219.0";
1
+ export declare const VERSION = "0.221.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -3,5 +3,5 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  // this is autogenerated file, see scripts/version-update.js
6
- export const VERSION = '0.219.0';
6
+ export const VERSION = '0.221.0';
7
7
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.219.0';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.221.0';\n"]}
@@ -0,0 +1,24 @@
1
+ import { type Attributes, type MeterProvider } from '@opentelemetry/api';
2
+ import { type IExporterMetricsHelper } from '@opentelemetry/otlp-transformer';
3
+ export interface ExporterMetricsOptions<Internal> {
4
+ componentType: string;
5
+ metricsHelper: IExporterMetricsHelper<Internal>;
6
+ url: string | undefined;
7
+ meterProvider: MeterProvider | undefined;
8
+ responseAttributesFromError: (error: Error | string | undefined) => Attributes;
9
+ }
10
+ /**
11
+ * Generates `otel.sdk.exporter.*` metrics.
12
+ * https://opentelemetry.io/docs/specs/semconv/otel/sdk-metrics
13
+ */
14
+ export declare class ExporterMetrics<Internal> {
15
+ private readonly inflight;
16
+ private readonly exported;
17
+ private readonly duration;
18
+ private readonly standardAttrs;
19
+ private readonly responseAttributesFromError;
20
+ private readonly helper;
21
+ constructor(options: ExporterMetricsOptions<Internal>);
22
+ startExport(request: Internal): (error: Error | string | undefined) => void;
23
+ }
24
+ //# sourceMappingURL=ExporterMetrics.d.ts.map
@@ -0,0 +1,104 @@
1
+ /*
2
+ * Copyright The OpenTelemetry Authors
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { createNoopMeter, } from '@opentelemetry/api';
6
+ import { hrTime, hrTimeDuration, hrTimeToMilliseconds, } from '@opentelemetry/core';
7
+ import { ATTR_ERROR_TYPE, ATTR_OTEL_COMPONENT_NAME, ATTR_OTEL_COMPONENT_TYPE, ATTR_SERVER_ADDRESS, ATTR_SERVER_PORT, } from './semconv';
8
+ import { VERSION } from './version';
9
+ const componentCounter = new Map();
10
+ /**
11
+ * Generates `otel.sdk.exporter.*` metrics.
12
+ * https://opentelemetry.io/docs/specs/semconv/otel/sdk-metrics
13
+ */
14
+ export class ExporterMetrics {
15
+ inflight;
16
+ exported;
17
+ duration;
18
+ standardAttrs;
19
+ responseAttributesFromError;
20
+ helper;
21
+ constructor(options) {
22
+ const { componentType, metricsHelper, meterProvider, url, responseAttributesFromError, } = options;
23
+ this.responseAttributesFromError = responseAttributesFromError;
24
+ const meter = meterProvider
25
+ ? meterProvider.getMeter('@opentelemetry/otlp-exporter', VERSION)
26
+ : createNoopMeter();
27
+ const counter = componentCounter.get(componentType) ?? 0;
28
+ componentCounter.set(componentType, counter + 1);
29
+ this.standardAttrs = {
30
+ [ATTR_OTEL_COMPONENT_TYPE]: componentType,
31
+ [ATTR_OTEL_COMPONENT_NAME]: `${componentType}/${counter}`,
32
+ };
33
+ if (url) {
34
+ // URLs may exclude scheme for gRPC endpoints, but in this case they always
35
+ // have a port number. Because the URL constructor requires a scheme, we
36
+ // can still handle gRPC endpoints by prepending an arbitrary scheme.
37
+ let urlToParse = url;
38
+ if (!url.includes('://')) {
39
+ urlToParse = `http://${url}`;
40
+ }
41
+ try {
42
+ const parsedUrl = new URL(urlToParse);
43
+ this.standardAttrs[ATTR_SERVER_ADDRESS] = parsedUrl.hostname;
44
+ let port = undefined;
45
+ if (parsedUrl.port) {
46
+ port = Number(parsedUrl.port);
47
+ }
48
+ else if (parsedUrl.protocol === 'http:') {
49
+ port = 80;
50
+ }
51
+ else if (parsedUrl.protocol === 'https:') {
52
+ port = 443;
53
+ }
54
+ if (typeof port === 'number') {
55
+ this.standardAttrs[ATTR_SERVER_PORT] = port;
56
+ }
57
+ }
58
+ catch {
59
+ // In practice, URLs will be valid or something else will break. Better to let that
60
+ // inform the user than an exception in this internal code and proceed best-effort
61
+ // here.
62
+ }
63
+ }
64
+ this.helper = metricsHelper;
65
+ this.inflight = meter.createUpDownCounter(`otel.sdk.exporter.${this.helper.name}.inflight`, {
66
+ unit: `{${this.helper.name}}`,
67
+ description: `The number of ${this.helper.name}s which were passed to the exporter, but that have not been exported yet (neither successful, nor failed).`,
68
+ });
69
+ this.exported = meter.createCounter(`otel.sdk.exporter.${this.helper.name}.exported`, {
70
+ unit: `{${this.helper.name}}`,
71
+ description: `The number of ${this.helper.name}s for which the export has finished, either successful or failed.`,
72
+ });
73
+ this.duration = meter.createHistogram('otel.sdk.exporter.operation.duration', {
74
+ unit: 's',
75
+ description: 'The duration of exporting a batch of telemetry records.',
76
+ advice: {
77
+ explicitBucketBoundaries: [],
78
+ },
79
+ });
80
+ }
81
+ startExport(request) {
82
+ const numItems = this.helper.countItems(request);
83
+ const startTime = hrTime();
84
+ this.inflight.add(numItems, this.standardAttrs);
85
+ return (error) => {
86
+ const endTime = hrTime();
87
+ this.inflight.add(-numItems, this.standardAttrs);
88
+ const exportedAttrs = error
89
+ ? {
90
+ ...this.standardAttrs,
91
+ [ATTR_ERROR_TYPE]: error instanceof Error ? error.name : 'export_failed',
92
+ }
93
+ : this.standardAttrs;
94
+ this.exported.add(numItems, exportedAttrs);
95
+ const durationAttrs = {
96
+ ...exportedAttrs,
97
+ ...this.responseAttributesFromError(error),
98
+ };
99
+ const duration = hrTimeToMilliseconds(hrTimeDuration(startTime, endTime)) / 1000;
100
+ this.duration.record(duration, durationAttrs);
101
+ };
102
+ }
103
+ }
104
+ //# sourceMappingURL=ExporterMetrics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExporterMetrics.js","sourceRoot":"","sources":["../../src/ExporterMetrics.ts"],"names":[],"mappings":"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","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n type Attributes,\n type Counter,\n type Histogram,\n type MeterProvider,\n type UpDownCounter,\n createNoopMeter,\n} from '@opentelemetry/api';\nimport {\n hrTime,\n hrTimeDuration,\n hrTimeToMilliseconds,\n} from '@opentelemetry/core';\nimport { type IExporterMetricsHelper } from '@opentelemetry/otlp-transformer';\nimport {\n ATTR_ERROR_TYPE,\n ATTR_OTEL_COMPONENT_NAME,\n ATTR_OTEL_COMPONENT_TYPE,\n ATTR_SERVER_ADDRESS,\n ATTR_SERVER_PORT,\n} from './semconv';\nimport { VERSION } from './version';\n\nconst componentCounter = new Map<string, number>();\n\nexport interface ExporterMetricsOptions<Internal> {\n componentType: string;\n metricsHelper: IExporterMetricsHelper<Internal>;\n url: string | undefined;\n meterProvider: MeterProvider | undefined;\n responseAttributesFromError: (\n error: Error | string | undefined\n ) => Attributes;\n}\n\n/**\n * Generates `otel.sdk.exporter.*` metrics.\n * https://opentelemetry.io/docs/specs/semconv/otel/sdk-metrics\n */\nexport class ExporterMetrics<Internal> {\n private readonly inflight: UpDownCounter;\n private readonly exported: Counter;\n private readonly duration: Histogram;\n private readonly standardAttrs: Attributes;\n private readonly responseAttributesFromError: (\n error: Error | string | undefined\n ) => Attributes;\n\n private readonly helper: IExporterMetricsHelper<Internal>;\n\n constructor(options: ExporterMetricsOptions<Internal>) {\n const {\n componentType,\n metricsHelper,\n meterProvider,\n url,\n responseAttributesFromError,\n } = options;\n this.responseAttributesFromError = responseAttributesFromError;\n const meter = meterProvider\n ? meterProvider.getMeter('@opentelemetry/otlp-exporter', VERSION)\n : createNoopMeter();\n\n const counter = componentCounter.get(componentType) ?? 0;\n componentCounter.set(componentType, counter + 1);\n\n this.standardAttrs = {\n [ATTR_OTEL_COMPONENT_TYPE]: componentType,\n [ATTR_OTEL_COMPONENT_NAME]: `${componentType}/${counter}`,\n };\n if (url) {\n // URLs may exclude scheme for gRPC endpoints, but in this case they always\n // have a port number. Because the URL constructor requires a scheme, we\n // can still handle gRPC endpoints by prepending an arbitrary scheme.\n let urlToParse = url;\n if (!url.includes('://')) {\n urlToParse = `http://${url}`;\n }\n try {\n const parsedUrl = new URL(urlToParse);\n this.standardAttrs[ATTR_SERVER_ADDRESS] = parsedUrl.hostname;\n let port: number | undefined = undefined;\n if (parsedUrl.port) {\n port = Number(parsedUrl.port);\n } else if (parsedUrl.protocol === 'http:') {\n port = 80;\n } else if (parsedUrl.protocol === 'https:') {\n port = 443;\n }\n if (typeof port === 'number') {\n this.standardAttrs[ATTR_SERVER_PORT] = port;\n }\n } catch {\n // In practice, URLs will be valid or something else will break. Better to let that\n // inform the user than an exception in this internal code and proceed best-effort\n // here.\n }\n }\n\n this.helper = metricsHelper;\n\n this.inflight = meter.createUpDownCounter(\n `otel.sdk.exporter.${this.helper.name}.inflight`,\n {\n unit: `{${this.helper.name}}`,\n description: `The number of ${this.helper.name}s which were passed to the exporter, but that have not been exported yet (neither successful, nor failed).`,\n }\n );\n this.exported = meter.createCounter(\n `otel.sdk.exporter.${this.helper.name}.exported`,\n {\n unit: `{${this.helper.name}}`,\n description: `The number of ${this.helper.name}s for which the export has finished, either successful or failed.`,\n }\n );\n this.duration = meter.createHistogram(\n 'otel.sdk.exporter.operation.duration',\n {\n unit: 's',\n description: 'The duration of exporting a batch of telemetry records.',\n advice: {\n explicitBucketBoundaries: [],\n },\n }\n );\n }\n\n startExport(request: Internal): (error: Error | string | undefined) => void {\n const numItems = this.helper.countItems(request);\n const startTime = hrTime();\n this.inflight.add(numItems, this.standardAttrs);\n return (error: Error | string | undefined) => {\n const endTime = hrTime();\n this.inflight.add(-numItems, this.standardAttrs);\n const exportedAttrs = error\n ? {\n ...this.standardAttrs,\n [ATTR_ERROR_TYPE]:\n error instanceof Error ? error.name : 'export_failed',\n }\n : this.standardAttrs;\n this.exported.add(numItems, exportedAttrs);\n const durationAttrs = {\n ...exportedAttrs,\n ...this.responseAttributesFromError(error),\n };\n const duration =\n hrTimeToMilliseconds(hrTimeDuration(startTime, endTime)) / 1000;\n this.duration.record(duration, durationAttrs);\n };\n }\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import type { ExportResult } from '@opentelemetry/core';
2
2
  import type { IOtlpExportDelegate } from './otlp-export-delegate';
3
+ import { type ExporterMetrics } from './ExporterMetrics';
3
4
  export declare class OTLPExporterBase<Internal> {
4
5
  private _delegate;
5
6
  constructor(delegate: IOtlpExportDelegate<Internal>);
@@ -11,5 +12,6 @@ export declare class OTLPExporterBase<Internal> {
11
12
  export(items: Internal, resultCallback: (result: ExportResult) => void): void;
12
13
  forceFlush(): Promise<void>;
13
14
  shutdown(): Promise<void>;
15
+ protected setMetrics(metrics: ExporterMetrics<Internal>): void;
14
16
  }
15
17
  //# sourceMappingURL=OTLPExporterBase.d.ts.map
@@ -21,5 +21,8 @@ export class OTLPExporterBase {
21
21
  shutdown() {
22
22
  return this._delegate.shutdown();
23
23
  }
24
+ setMetrics(metrics) {
25
+ this._delegate.setMetrics(metrics);
26
+ }
24
27
  }
25
28
  //# sourceMappingURL=OTLPExporterBase.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OTLPExporterBase.js","sourceRoot":"","sources":["../../src/OTLPExporterBase.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,MAAM,OAAO,gBAAgB;IACnB,SAAS,CAAgC;IACjD,YAAY,QAAuC;QACjD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACH,MAAM,CACJ,KAAe,EACf,cAA8C;QAE9C,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;IAC/C,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;IACnC,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { ExportResult } from '@opentelemetry/core';\nimport type { IOtlpExportDelegate } from './otlp-export-delegate';\n\nexport class OTLPExporterBase<Internal> {\n private _delegate: IOtlpExportDelegate<Internal>;\n constructor(delegate: IOtlpExportDelegate<Internal>) {\n this._delegate = delegate;\n }\n\n /**\n * Export items.\n * @param items\n * @param resultCallback\n */\n export(\n items: Internal,\n resultCallback: (result: ExportResult) => void\n ): void {\n this._delegate.export(items, resultCallback);\n }\n\n forceFlush(): Promise<void> {\n return this._delegate.forceFlush();\n }\n\n shutdown(): Promise<void> {\n return this._delegate.shutdown();\n }\n}\n"]}
1
+ {"version":3,"file":"OTLPExporterBase.js","sourceRoot":"","sources":["../../src/OTLPExporterBase.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,OAAO,gBAAgB;IACnB,SAAS,CAAgC;IACjD,YAAY,QAAuC;QACjD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACH,MAAM,CACJ,KAAe,EACf,cAA8C;QAE9C,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;IAC/C,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;IACnC,CAAC;IAES,UAAU,CAAC,OAAkC;QACrD,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { ExportResult } from '@opentelemetry/core';\nimport type { IOtlpExportDelegate } from './otlp-export-delegate';\nimport { type ExporterMetrics } from './ExporterMetrics';\n\nexport class OTLPExporterBase<Internal> {\n private _delegate: IOtlpExportDelegate<Internal>;\n constructor(delegate: IOtlpExportDelegate<Internal>) {\n this._delegate = delegate;\n }\n\n /**\n * Export items.\n * @param items\n * @param resultCallback\n */\n export(\n items: Internal,\n resultCallback: (result: ExportResult) => void\n ): void {\n this._delegate.export(items, resultCallback);\n }\n\n forceFlush(): Promise<void> {\n return this._delegate.forceFlush();\n }\n\n shutdown(): Promise<void> {\n return this._delegate.shutdown();\n }\n\n protected setMetrics(metrics: ExporterMetrics<Internal>) {\n this._delegate.setMetrics(metrics);\n }\n}\n"]}
@@ -1,6 +1,12 @@
1
- import type { ISerializer } from '@opentelemetry/otlp-transformer';
1
+ import type { MeterProvider } from '@opentelemetry/api';
2
+ import type { IExporterMetricsHelper, ISerializer } from '@opentelemetry/otlp-transformer';
2
3
  import type { IOtlpExportDelegate } from '../otlp-export-delegate';
3
4
  import type { OTLPExporterConfigBase } from './legacy-base-configuration';
5
+ import { ExporterMetrics } from '../ExporterMetrics';
6
+ /**
7
+ * @deprecated
8
+ */
9
+ export declare function createLegacyOtlpBrowserExporterMetrics<Internal>(metricsComponentType: string, exporterMetricsHelper: IExporterMetricsHelper<Internal>, url: string | undefined, meterProvider: MeterProvider | undefined): ExporterMetrics<Internal>;
4
10
  /**
5
11
  * @deprecated
6
12
  * @param config
@@ -8,5 +14,5 @@ import type { OTLPExporterConfigBase } from './legacy-base-configuration';
8
14
  * @param signalResourcePath
9
15
  * @param requiredHeaders
10
16
  */
11
- export declare function createLegacyOtlpBrowserExportDelegate<Internal, Response>(config: OTLPExporterConfigBase, serializer: ISerializer<Internal, Response>, signalResourcePath: string, requiredHeaders: Record<string, string>): IOtlpExportDelegate<Internal>;
17
+ export declare function createLegacyOtlpBrowserExportDelegate<Internal, Response>(config: OTLPExporterConfigBase, serializer: ISerializer<Internal, Response>, metricsComponentType: string, exporterMetricsHelper: IExporterMetricsHelper<Internal>, meterProvider: MeterProvider | undefined, signalResourcePath: string, requiredHeaders: Record<string, string>): IOtlpExportDelegate<Internal>;
12
18
  //# sourceMappingURL=create-legacy-browser-delegate.d.ts.map
@@ -1,5 +1,39 @@
1
+ /*
2
+ * Copyright The OpenTelemetry Authors
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
1
5
  import { createOtlpFetchExportDelegate } from '../otlp-browser-http-export-delegate';
2
6
  import { convertLegacyBrowserHttpOptions } from './convert-legacy-browser-http-options';
7
+ import { ATTR_HTTP_RESPONSE_STATUS_CODE } from '../semconv';
8
+ import { ExporterMetrics } from '../ExporterMetrics';
9
+ /**
10
+ * @deprecated
11
+ */
12
+ export function createLegacyOtlpBrowserExporterMetrics(metricsComponentType, exporterMetricsHelper, url, meterProvider) {
13
+ return new ExporterMetrics({
14
+ componentType: metricsComponentType,
15
+ metricsHelper: exporterMetricsHelper,
16
+ url,
17
+ meterProvider,
18
+ responseAttributesFromError: (error) => {
19
+ if (!error) {
20
+ return {
21
+ [ATTR_HTTP_RESPONSE_STATUS_CODE]: 200,
22
+ };
23
+ }
24
+ if (!(error instanceof Error)) {
25
+ return {};
26
+ }
27
+ if (error.message.startsWith('Fetch request failed with non-retryable status ')) {
28
+ const statusStr = error.message.substring('Fetch request failed with non-retryable status '.length);
29
+ return {
30
+ [ATTR_HTTP_RESPONSE_STATUS_CODE]: Number(statusStr),
31
+ };
32
+ }
33
+ return {};
34
+ },
35
+ });
36
+ }
3
37
  /**
4
38
  * @deprecated
5
39
  * @param config
@@ -7,8 +41,8 @@ import { convertLegacyBrowserHttpOptions } from './convert-legacy-browser-http-o
7
41
  * @param signalResourcePath
8
42
  * @param requiredHeaders
9
43
  */
10
- export function createLegacyOtlpBrowserExportDelegate(config, serializer, signalResourcePath, requiredHeaders) {
44
+ export function createLegacyOtlpBrowserExportDelegate(config, serializer, metricsComponentType, exporterMetricsHelper, meterProvider, signalResourcePath, requiredHeaders) {
11
45
  const options = convertLegacyBrowserHttpOptions(config, signalResourcePath, requiredHeaders);
12
- return createOtlpFetchExportDelegate(options, serializer);
46
+ return createOtlpFetchExportDelegate(options, serializer, createLegacyOtlpBrowserExporterMetrics(metricsComponentType, exporterMetricsHelper, options.url, config.selfObsMeterProvider));
13
47
  }
14
48
  //# sourceMappingURL=create-legacy-browser-delegate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-legacy-browser-delegate.js","sourceRoot":"","sources":["../../../src/configuration/create-legacy-browser-delegate.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,6BAA6B,EAAE,MAAM,sCAAsC,CAAC;AACrF,OAAO,EAAE,+BAA+B,EAAE,MAAM,uCAAuC,CAAC;AAIxF;;;;;;GAMG;AACH,MAAM,UAAU,qCAAqC,CACnD,MAA8B,EAC9B,UAA2C,EAC3C,kBAA0B,EAC1B,eAAuC;IAEvC,MAAM,OAAO,GAAG,+BAA+B,CAC7C,MAAM,EACN,kBAAkB,EAClB,eAAe,CAChB,CAAC;IAEF,OAAO,6BAA6B,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;AAC5D,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { ISerializer } from '@opentelemetry/otlp-transformer';\nimport { createOtlpFetchExportDelegate } from '../otlp-browser-http-export-delegate';\nimport { convertLegacyBrowserHttpOptions } from './convert-legacy-browser-http-options';\nimport type { IOtlpExportDelegate } from '../otlp-export-delegate';\nimport type { OTLPExporterConfigBase } from './legacy-base-configuration';\n\n/**\n * @deprecated\n * @param config\n * @param serializer\n * @param signalResourcePath\n * @param requiredHeaders\n */\nexport function createLegacyOtlpBrowserExportDelegate<Internal, Response>(\n config: OTLPExporterConfigBase,\n serializer: ISerializer<Internal, Response>,\n signalResourcePath: string,\n requiredHeaders: Record<string, string>\n): IOtlpExportDelegate<Internal> {\n const options = convertLegacyBrowserHttpOptions(\n config,\n signalResourcePath,\n requiredHeaders\n );\n\n return createOtlpFetchExportDelegate(options, serializer);\n}\n"]}
1
+ {"version":3,"file":"create-legacy-browser-delegate.js","sourceRoot":"","sources":["../../../src/configuration/create-legacy-browser-delegate.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAAE,6BAA6B,EAAE,MAAM,sCAAsC,CAAC;AACrF,OAAO,EAAE,+BAA+B,EAAE,MAAM,uCAAuC,CAAC;AAGxF,OAAO,EAAE,8BAA8B,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;GAEG;AACH,MAAM,UAAU,sCAAsC,CACpD,oBAA4B,EAC5B,qBAAuD,EACvD,GAAuB,EACvB,aAAwC;IAExC,OAAO,IAAI,eAAe,CAAC;QACzB,aAAa,EAAE,oBAAoB;QACnC,aAAa,EAAE,qBAAqB;QACpC,GAAG;QACH,aAAa;QACb,2BAA2B,EAAE,CAAC,KAAiC,EAAE,EAAE;YACjE,IAAI,CAAC,KAAK,EAAE;gBACV,OAAO;oBACL,CAAC,8BAA8B,CAAC,EAAE,GAAG;iBACtC,CAAC;aACH;YACD,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC,EAAE;gBAC7B,OAAO,EAAE,CAAC;aACX;YACD,IACE,KAAK,CAAC,OAAO,CAAC,UAAU,CACtB,iDAAiD,CAClD,EACD;gBACA,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CACvC,iDAAiD,CAAC,MAAM,CACzD,CAAC;gBACF,OAAO;oBACL,CAAC,8BAA8B,CAAC,EAAE,MAAM,CAAC,SAAS,CAAC;iBACpD,CAAC;aACH;YACD,OAAO,EAAE,CAAC;QACZ,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,qCAAqC,CACnD,MAA8B,EAC9B,UAA2C,EAC3C,oBAA4B,EAC5B,qBAAuD,EACvD,aAAwC,EACxC,kBAA0B,EAC1B,eAAuC;IAEvC,MAAM,OAAO,GAAG,+BAA+B,CAC7C,MAAM,EACN,kBAAkB,EAClB,eAAe,CAChB,CAAC;IAEF,OAAO,6BAA6B,CAClC,OAAO,EACP,UAAU,EACV,sCAAsC,CACpC,oBAAoB,EACpB,qBAAqB,EACrB,OAAO,CAAC,GAAG,EACX,MAAM,CAAC,oBAAoB,CAC5B,CACF,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { MeterProvider } from '@opentelemetry/api';\nimport type {\n IExporterMetricsHelper,\n ISerializer,\n} from '@opentelemetry/otlp-transformer';\nimport { createOtlpFetchExportDelegate } from '../otlp-browser-http-export-delegate';\nimport { convertLegacyBrowserHttpOptions } from './convert-legacy-browser-http-options';\nimport type { IOtlpExportDelegate } from '../otlp-export-delegate';\nimport type { OTLPExporterConfigBase } from './legacy-base-configuration';\nimport { ATTR_HTTP_RESPONSE_STATUS_CODE } from '../semconv';\nimport { ExporterMetrics } from '../ExporterMetrics';\n\n/**\n * @deprecated\n */\nexport function createLegacyOtlpBrowserExporterMetrics<Internal>(\n metricsComponentType: string,\n exporterMetricsHelper: IExporterMetricsHelper<Internal>,\n url: string | undefined,\n meterProvider: MeterProvider | undefined\n): ExporterMetrics<Internal> {\n return new ExporterMetrics({\n componentType: metricsComponentType,\n metricsHelper: exporterMetricsHelper,\n url,\n meterProvider,\n responseAttributesFromError: (error: Error | string | undefined) => {\n if (!error) {\n return {\n [ATTR_HTTP_RESPONSE_STATUS_CODE]: 200,\n };\n }\n if (!(error instanceof Error)) {\n return {};\n }\n if (\n error.message.startsWith(\n 'Fetch request failed with non-retryable status '\n )\n ) {\n const statusStr = error.message.substring(\n 'Fetch request failed with non-retryable status '.length\n );\n return {\n [ATTR_HTTP_RESPONSE_STATUS_CODE]: Number(statusStr),\n };\n }\n return {};\n },\n });\n}\n\n/**\n * @deprecated\n * @param config\n * @param serializer\n * @param signalResourcePath\n * @param requiredHeaders\n */\nexport function createLegacyOtlpBrowserExportDelegate<Internal, Response>(\n config: OTLPExporterConfigBase,\n serializer: ISerializer<Internal, Response>,\n metricsComponentType: string,\n exporterMetricsHelper: IExporterMetricsHelper<Internal>,\n meterProvider: MeterProvider | undefined,\n signalResourcePath: string,\n requiredHeaders: Record<string, string>\n): IOtlpExportDelegate<Internal> {\n const options = convertLegacyBrowserHttpOptions(\n config,\n signalResourcePath,\n requiredHeaders\n );\n\n return createOtlpFetchExportDelegate(\n options,\n serializer,\n createLegacyOtlpBrowserExporterMetrics(\n metricsComponentType,\n exporterMetricsHelper,\n options.url,\n config.selfObsMeterProvider\n )\n );\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import type { MeterProvider } from '@opentelemetry/api';
1
2
  import type { HeadersFactory } from './otlp-http-configuration';
2
3
  export interface OTLPExporterConfigBase {
3
4
  /**
@@ -30,5 +31,10 @@ export interface OTLPExporterConfigBase {
30
31
  /** Maximum time the OTLP exporter will wait for each batch export.
31
32
  * The default value is 10000ms. */
32
33
  timeoutMillis?: number;
34
+ /**
35
+ * MeterProvider to record metrics for the exporter itself.
36
+ * @experimental This option is experimental and is subject to breaking changes in minor releases.
37
+ */
38
+ selfObsMeterProvider?: MeterProvider;
33
39
  }
34
40
  //# sourceMappingURL=legacy-base-configuration.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"legacy-base-configuration.js","sourceRoot":"","sources":["../../../src/configuration/legacy-base-configuration.ts"],"names":[],"mappings":"","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { HeadersFactory } from './otlp-http-configuration';\n\nexport interface OTLPExporterConfigBase {\n /**\n * Custom headers that will be attached to the HTTP request that's sent to the endpoint.\n *\n * @remarks\n * Prefer using a plain object over a factory function wherever possible.\n * If using a factory function (`HttpAgentFactory`), **do not import `http` or `https` at the top of the file**\n * Instead, use dynamic `import()` or `require()` to load the module. This ensures that the `http` or `https`\n * module is not loaded before `@opentelemetry/instrumentation-http` can instrument it.\n *\n * Functions passed to the exporter MUST NOT throw errors.\n *\n * @example <caption> Using headers options directly: </caption>\n * headers: {\n * Authorization: \"Api-Token my-secret-token\",\n * }\n *\n * @example <caption> Using a custom factory function </caption>\n * headers: async () => {\n * // ... do whatever you need to obtain the headers, ensuring you `await import('your-library')` to avoid breaking instrumentations ...\n * return {\n * Authorization: `Bearer ${token}`,\n * };\n * };\n */\n headers?: Record<string, string> | HeadersFactory;\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"]}
1
+ {"version":3,"file":"legacy-base-configuration.js","sourceRoot":"","sources":["../../../src/configuration/legacy-base-configuration.ts"],"names":[],"mappings":"","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { MeterProvider } from '@opentelemetry/api';\nimport type { HeadersFactory } from './otlp-http-configuration';\n\nexport interface OTLPExporterConfigBase {\n /**\n * Custom headers that will be attached to the HTTP request that's sent to the endpoint.\n *\n * @remarks\n * Prefer using a plain object over a factory function wherever possible.\n * If using a factory function (`HttpAgentFactory`), **do not import `http` or `https` at the top of the file**\n * Instead, use dynamic `import()` or `require()` to load the module. This ensures that the `http` or `https`\n * module is not loaded before `@opentelemetry/instrumentation-http` can instrument it.\n *\n * Functions passed to the exporter MUST NOT throw errors.\n *\n * @example <caption> Using headers options directly: </caption>\n * headers: {\n * Authorization: \"Api-Token my-secret-token\",\n * }\n *\n * @example <caption> Using a custom factory function </caption>\n * headers: async () => {\n * // ... do whatever you need to obtain the headers, ensuring you `await import('your-library')` to avoid breaking instrumentations ...\n * return {\n * Authorization: `Bearer ${token}`,\n * };\n * };\n */\n headers?: Record<string, string> | HeadersFactory;\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 /**\n * MeterProvider to record metrics for the exporter itself.\n * @experimental This option is experimental and is subject to breaking changes in minor releases.\n */\n selfObsMeterProvider?: MeterProvider;\n}\n"]}