@opentelemetry/exporter-metrics-otlp-http 0.28.0 → 0.29.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.md +22 -21
  2. package/build/esm/OTLPMetricExporterBase.d.ts +7 -5
  3. package/build/esm/OTLPMetricExporterBase.js +23 -5
  4. package/build/esm/OTLPMetricExporterBase.js.map +1 -1
  5. package/build/esm/OTLPMetricExporterOptions.d.ts +2 -2
  6. package/build/esm/OTLPMetricExporterOptions.js +1 -1
  7. package/build/esm/OTLPMetricExporterOptions.js.map +1 -1
  8. package/build/esm/index.d.ts +0 -1
  9. package/build/esm/index.js +0 -1
  10. package/build/esm/index.js.map +1 -1
  11. package/build/esm/platform/browser/OTLPMetricExporter.d.ts +4 -5
  12. package/build/esm/platform/browser/OTLPMetricExporter.js +8 -10
  13. package/build/esm/platform/browser/OTLPMetricExporter.js.map +1 -1
  14. package/build/esm/platform/node/OTLPMetricExporter.d.ts +4 -5
  15. package/build/esm/platform/node/OTLPMetricExporter.js +8 -10
  16. package/build/esm/platform/node/OTLPMetricExporter.js.map +1 -1
  17. package/build/esm/version.d.ts +1 -1
  18. package/build/esm/version.js +1 -1
  19. package/build/esm/version.js.map +1 -1
  20. package/build/esnext/OTLPMetricExporterBase.d.ts +7 -5
  21. package/build/esnext/OTLPMetricExporterBase.js +23 -5
  22. package/build/esnext/OTLPMetricExporterBase.js.map +1 -1
  23. package/build/esnext/OTLPMetricExporterOptions.d.ts +2 -2
  24. package/build/esnext/OTLPMetricExporterOptions.js +1 -1
  25. package/build/esnext/OTLPMetricExporterOptions.js.map +1 -1
  26. package/build/esnext/index.d.ts +0 -1
  27. package/build/esnext/index.js +0 -1
  28. package/build/esnext/index.js.map +1 -1
  29. package/build/esnext/platform/browser/OTLPMetricExporter.d.ts +4 -5
  30. package/build/esnext/platform/browser/OTLPMetricExporter.js +8 -10
  31. package/build/esnext/platform/browser/OTLPMetricExporter.js.map +1 -1
  32. package/build/esnext/platform/node/OTLPMetricExporter.d.ts +4 -5
  33. package/build/esnext/platform/node/OTLPMetricExporter.js +8 -10
  34. package/build/esnext/platform/node/OTLPMetricExporter.js.map +1 -1
  35. package/build/esnext/version.d.ts +1 -1
  36. package/build/esnext/version.js +1 -1
  37. package/build/esnext/version.js.map +1 -1
  38. package/build/src/OTLPMetricExporterBase.d.ts +7 -5
  39. package/build/src/OTLPMetricExporterBase.js +25 -5
  40. package/build/src/OTLPMetricExporterBase.js.map +1 -1
  41. package/build/src/OTLPMetricExporterOptions.d.ts +2 -2
  42. package/build/src/OTLPMetricExporterOptions.js +1 -1
  43. package/build/src/OTLPMetricExporterOptions.js.map +1 -1
  44. package/build/src/index.d.ts +0 -1
  45. package/build/src/index.js +0 -3
  46. package/build/src/index.js.map +1 -1
  47. package/build/src/platform/browser/OTLPMetricExporter.d.ts +4 -5
  48. package/build/src/platform/browser/OTLPMetricExporter.js +6 -8
  49. package/build/src/platform/browser/OTLPMetricExporter.js.map +1 -1
  50. package/build/src/platform/node/OTLPMetricExporter.d.ts +4 -5
  51. package/build/src/platform/node/OTLPMetricExporter.js +6 -8
  52. package/build/src/platform/node/OTLPMetricExporter.js.map +1 -1
  53. package/build/src/version.d.ts +1 -1
  54. package/build/src/version.js +1 -1
  55. package/build/src/version.js.map +1 -1
  56. package/package.json +9 -9
  57. package/build/esm/transformMetrics.d.ts +0 -38
  58. package/build/esm/transformMetrics.js +0 -184
  59. package/build/esm/transformMetrics.js.map +0 -1
  60. package/build/esnext/transformMetrics.d.ts +0 -38
  61. package/build/esnext/transformMetrics.js +0 -167
  62. package/build/esnext/transformMetrics.js.map +0 -1
  63. package/build/src/transformMetrics.d.ts +0 -38
  64. package/build/src/transformMetrics.js +0 -176
  65. package/build/src/transformMetrics.js.map +0 -1
@@ -1,13 +1,12 @@
1
- import { AggregationTemporality, ResourceMetrics } from '@opentelemetry/sdk-metrics-base';
2
- import { otlpTypes } from '@opentelemetry/exporter-trace-otlp-http';
1
+ import { ResourceMetrics } from '@opentelemetry/sdk-metrics-base';
3
2
  import { OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions';
4
3
  import { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';
5
4
  import { OTLPExporterBrowserBase, OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base';
6
- declare class OTLPExporterBrowserProxy extends OTLPExporterBrowserBase<ResourceMetrics, otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest> {
7
- protected readonly _aggregationTemporality: AggregationTemporality;
5
+ import { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';
6
+ declare class OTLPExporterBrowserProxy extends OTLPExporterBrowserBase<ResourceMetrics, IExportMetricsServiceRequest> {
8
7
  constructor(config?: OTLPMetricExporterOptions & OTLPExporterConfigBase);
9
8
  getDefaultUrl(config: OTLPExporterConfigBase): string;
10
- convert(metrics: ResourceMetrics[]): otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest;
9
+ convert(metrics: ResourceMetrics[]): IExportMetricsServiceRequest;
11
10
  }
12
11
  /**
13
12
  * Collector Metric Exporter for Web
@@ -13,31 +13,29 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { toOTLPExportMetricServiceRequest } from '../../transformMetrics';
17
16
  import { baggageUtils, getEnv } from '@opentelemetry/core';
18
- import { defaultExporterTemporality, defaultOptions } from '../../OTLPMetricExporterOptions';
17
+ import { defaultOptions } from '../../OTLPMetricExporterOptions';
19
18
  import { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';
20
- import { appendResourcePathToUrlIfNotPresent, OTLPExporterBrowserBase } from '@opentelemetry/otlp-exporter-base';
21
- const DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/metrics';
22
- const DEFAULT_COLLECTOR_URL = `http://localhost:4318${DEFAULT_COLLECTOR_RESOURCE_PATH}`;
19
+ import { OTLPExporterBrowserBase, appendResourcePathToUrl, appendRootPathToUrlIfNeeded } from '@opentelemetry/otlp-exporter-base';
20
+ import { createExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';
21
+ const DEFAULT_COLLECTOR_RESOURCE_PATH = 'v1/metrics';
22
+ const DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`;
23
23
  class OTLPExporterBrowserProxy extends OTLPExporterBrowserBase {
24
24
  constructor(config = defaultOptions) {
25
- var _a;
26
25
  super(config);
27
26
  this._headers = Object.assign(this._headers, baggageUtils.parseKeyPairsIntoRecord(getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS));
28
- this._aggregationTemporality = (_a = config.aggregationTemporality) !== null && _a !== void 0 ? _a : defaultExporterTemporality;
29
27
  }
30
28
  getDefaultUrl(config) {
31
29
  return typeof config.url === 'string'
32
30
  ? config.url
33
31
  : getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0
34
- ? getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT
32
+ ? appendRootPathToUrlIfNeeded(getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)
35
33
  : getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0
36
- ? appendResourcePathToUrlIfNotPresent(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)
34
+ ? appendResourcePathToUrl(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)
37
35
  : DEFAULT_COLLECTOR_URL;
38
36
  }
39
37
  convert(metrics) {
40
- return toOTLPExportMetricServiceRequest(metrics[0], this._aggregationTemporality, this);
38
+ return createExportMetricsServiceRequest(metrics);
41
39
  }
42
40
  }
43
41
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../../../src/platform/browser/OTLPMetricExporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,cAAc,EAA6B,MAAM,iCAAiC,CAAC;AACxH,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EACL,mCAAmC,EACnC,uBAAuB,EAExB,MAAM,mCAAmC,CAAC;AAE3C,MAAM,+BAA+B,GAAG,aAAa,CAAC;AACtD,MAAM,qBAAqB,GAAG,wBAAwB,+BAA+B,EAAE,CAAC;AAExF,MAAM,wBAAyB,SAAQ,uBACyC;IAG9E,YAAY,SAA6D,cAAc;;QACrF,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAC3B,IAAI,CAAC,QAAQ,EACb,YAAY,CAAC,uBAAuB,CAClC,MAAM,EAAE,CAAC,kCAAkC,CAC5C,CACF,CAAC;QACF,IAAI,CAAC,uBAAuB,GAAG,MAAA,MAAM,CAAC,sBAAsB,mCAAI,0BAA0B,CAAC;IAC7F,CAAC;IAED,aAAa,CAAC,MAA8B;QAC1C,OAAO,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ;YACnC,CAAC,CAAC,MAAM,CAAC,GAAG;YACZ,CAAC,CAAC,MAAM,EAAE,CAAC,mCAAmC,CAAC,MAAM,GAAG,CAAC;gBACvD,CAAC,CAAC,MAAM,EAAE,CAAC,mCAAmC;gBAC9C,CAAC,CAAC,MAAM,EAAE,CAAC,2BAA2B,CAAC,MAAM,GAAG,CAAC;oBAC/C,CAAC,CAAC,mCAAmC,CAAC,MAAM,EAAE,CAAC,2BAA2B,EAAE,+BAA+B,CAAC;oBAC5G,CAAC,CAAC,qBAAqB,CAAC;IAChC,CAAC;IAED,OAAO,CACL,OAA0B;QAE1B,OAAO,gCAAgC,CACrC,OAAO,CAAC,CAAC,CAAC,EACV,IAAI,CAAC,uBAAuB,EAC5B,IAAI,CACL,CAAC;IACJ,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,sBAAgD;IACtF,YAAY,SAA6D,cAAc;QACrF,KAAK,CAAC,IAAI,wBAAwB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;IACtD,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 { AggregationTemporality, ResourceMetrics } from '@opentelemetry/sdk-metrics-base';\nimport {\n otlpTypes\n} from '@opentelemetry/exporter-trace-otlp-http';\nimport { toOTLPExportMetricServiceRequest } from '../../transformMetrics';\nimport { baggageUtils, getEnv } from '@opentelemetry/core';\nimport { defaultExporterTemporality, defaultOptions, OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions';\nimport { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';\nimport {\n appendResourcePathToUrlIfNotPresent,\n OTLPExporterBrowserBase,\n OTLPExporterConfigBase\n} from '@opentelemetry/otlp-exporter-base';\n\nconst DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/metrics';\nconst DEFAULT_COLLECTOR_URL = `http://localhost:4318${DEFAULT_COLLECTOR_RESOURCE_PATH}`;\n\nclass OTLPExporterBrowserProxy extends OTLPExporterBrowserBase<ResourceMetrics,\n otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest> {\n protected readonly _aggregationTemporality: AggregationTemporality;\n\n constructor(config: OTLPMetricExporterOptions & OTLPExporterConfigBase = defaultOptions) {\n super(config);\n this._headers = Object.assign(\n this._headers,\n baggageUtils.parseKeyPairsIntoRecord(\n getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS\n )\n );\n this._aggregationTemporality = config.aggregationTemporality ?? defaultExporterTemporality;\n }\n\n getDefaultUrl(config: OTLPExporterConfigBase): string {\n return typeof config.url === 'string'\n ? config.url\n : getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0\n ? getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT\n : getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0\n ? appendResourcePathToUrlIfNotPresent(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)\n : DEFAULT_COLLECTOR_URL;\n }\n\n convert(\n metrics: ResourceMetrics[]\n ): otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest {\n return toOTLPExportMetricServiceRequest(\n metrics[0],\n this._aggregationTemporality,\n this\n );\n }\n}\n\n/**\n * Collector Metric Exporter for Web\n */\nexport class OTLPMetricExporter extends OTLPMetricExporterBase<OTLPExporterBrowserProxy> {\n constructor(config: OTLPExporterConfigBase & OTLPMetricExporterOptions = defaultOptions) {\n super(new OTLPExporterBrowserProxy(config), config);\n }\n}\n"]}
1
+ {"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../../../src/platform/browser/OTLPMetricExporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAA6B,MAAM,iCAAiC,CAAC;AAC5F,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EACL,uBAAuB,EAEvB,uBAAuB,EACvB,2BAA2B,EAC5B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,iCAAiC,EAAgC,MAAM,iCAAiC,CAAC;AAElH,MAAM,+BAA+B,GAAG,YAAY,CAAC;AACrD,MAAM,qBAAqB,GAAG,yBAAyB,+BAA+B,EAAE,CAAC;AAEzF,MAAM,wBAAyB,SAAQ,uBAAsE;IAE3G,YAAY,SAA6D,cAAc;QACrF,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAC3B,IAAI,CAAC,QAAQ,EACb,YAAY,CAAC,uBAAuB,CAClC,MAAM,EAAE,CAAC,kCAAkC,CAC5C,CACF,CAAC;IACJ,CAAC;IAED,aAAa,CAAC,MAA8B;QAC1C,OAAO,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ;YACnC,CAAC,CAAC,MAAM,CAAC,GAAG;YACZ,CAAC,CAAC,MAAM,EAAE,CAAC,mCAAmC,CAAC,MAAM,GAAG,CAAC;gBACvD,CAAC,CAAC,2BAA2B,CAAC,MAAM,EAAE,CAAC,mCAAmC,EAAE,+BAA+B,CAAC;gBAC5G,CAAC,CAAC,MAAM,EAAE,CAAC,2BAA2B,CAAC,MAAM,GAAG,CAAC;oBAC/C,CAAC,CAAC,uBAAuB,CAAC,MAAM,EAAE,CAAC,2BAA2B,EAAE,+BAA+B,CAAC;oBAChG,CAAC,CAAC,qBAAqB,CAAC;IAChC,CAAC;IAED,OAAO,CAAC,OAA0B;QAChC,OAAO,iCAAiC,CAAC,OAAO,CAAC,CAAC;IACpD,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,sBAAgD;IACtF,YAAY,SAA6D,cAAc;QACrF,KAAK,CAAC,IAAI,wBAAwB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;IACtD,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 { ResourceMetrics } from '@opentelemetry/sdk-metrics-base';\nimport { baggageUtils, getEnv } from '@opentelemetry/core';\nimport { defaultOptions, OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions';\nimport { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';\nimport {\n OTLPExporterBrowserBase,\n OTLPExporterConfigBase,\n appendResourcePathToUrl,\n appendRootPathToUrlIfNeeded\n} from '@opentelemetry/otlp-exporter-base';\nimport { createExportMetricsServiceRequest, IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';\n\nconst DEFAULT_COLLECTOR_RESOURCE_PATH = 'v1/metrics';\nconst DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`;\n\nclass OTLPExporterBrowserProxy extends OTLPExporterBrowserBase<ResourceMetrics, IExportMetricsServiceRequest> {\n\n constructor(config: OTLPMetricExporterOptions & OTLPExporterConfigBase = defaultOptions) {\n super(config);\n this._headers = Object.assign(\n this._headers,\n baggageUtils.parseKeyPairsIntoRecord(\n getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS\n )\n );\n }\n\n getDefaultUrl(config: OTLPExporterConfigBase): string {\n return typeof config.url === 'string'\n ? config.url\n : getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0\n ? appendRootPathToUrlIfNeeded(getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)\n : getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0\n ? appendResourcePathToUrl(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)\n : DEFAULT_COLLECTOR_URL;\n }\n\n convert(metrics: ResourceMetrics[]): IExportMetricsServiceRequest {\n return createExportMetricsServiceRequest(metrics);\n }\n}\n\n/**\n * Collector Metric Exporter for Web\n */\nexport class OTLPMetricExporter extends OTLPMetricExporterBase<OTLPExporterBrowserProxy> {\n constructor(config: OTLPExporterConfigBase & OTLPMetricExporterOptions = defaultOptions) {\n super(new OTLPExporterBrowserProxy(config), config);\n }\n}\n"]}
@@ -1,12 +1,11 @@
1
- import { ResourceMetrics, AggregationTemporality } from '@opentelemetry/sdk-metrics-base';
2
- import { otlpTypes } from '@opentelemetry/exporter-trace-otlp-http';
1
+ import { ResourceMetrics } from '@opentelemetry/sdk-metrics-base';
3
2
  import { OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions';
4
3
  import { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';
5
4
  import { OTLPExporterNodeBase, OTLPExporterNodeConfigBase } from '@opentelemetry/otlp-exporter-base';
6
- declare class OTLPExporterNodeProxy extends OTLPExporterNodeBase<ResourceMetrics, otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest> {
7
- protected readonly _aggregationTemporality: AggregationTemporality;
5
+ import { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';
6
+ declare class OTLPExporterNodeProxy extends OTLPExporterNodeBase<ResourceMetrics, IExportMetricsServiceRequest> {
8
7
  constructor(config?: OTLPExporterNodeConfigBase & OTLPMetricExporterOptions);
9
- convert(metrics: ResourceMetrics[]): otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest;
8
+ convert(metrics: ResourceMetrics[]): IExportMetricsServiceRequest;
10
9
  getDefaultUrl(config: OTLPExporterNodeConfigBase): string;
11
10
  }
12
11
  /**
@@ -13,30 +13,28 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { toOTLPExportMetricServiceRequest } from '../../transformMetrics';
17
16
  import { getEnv, baggageUtils } from '@opentelemetry/core';
18
- import { defaultExporterTemporality, defaultOptions } from '../../OTLPMetricExporterOptions';
17
+ import { defaultOptions } from '../../OTLPMetricExporterOptions';
19
18
  import { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';
20
- import { appendResourcePathToUrlIfNotPresent, OTLPExporterNodeBase } from '@opentelemetry/otlp-exporter-base';
21
- const DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/metrics';
22
- const DEFAULT_COLLECTOR_URL = `http://localhost:4318${DEFAULT_COLLECTOR_RESOURCE_PATH}`;
19
+ import { OTLPExporterNodeBase, appendResourcePathToUrl, appendRootPathToUrlIfNeeded } from '@opentelemetry/otlp-exporter-base';
20
+ import { createExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';
21
+ const DEFAULT_COLLECTOR_RESOURCE_PATH = 'v1/metrics';
22
+ const DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`;
23
23
  class OTLPExporterNodeProxy extends OTLPExporterNodeBase {
24
24
  constructor(config = defaultOptions) {
25
- var _a;
26
25
  super(config);
27
26
  this.headers = Object.assign(this.headers, baggageUtils.parseKeyPairsIntoRecord(getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS));
28
- this._aggregationTemporality = (_a = config.aggregationTemporality) !== null && _a !== void 0 ? _a : defaultExporterTemporality;
29
27
  }
30
28
  convert(metrics) {
31
- return toOTLPExportMetricServiceRequest(metrics[0], this._aggregationTemporality, this);
29
+ return createExportMetricsServiceRequest(metrics);
32
30
  }
33
31
  getDefaultUrl(config) {
34
32
  return typeof config.url === 'string'
35
33
  ? config.url
36
34
  : getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0
37
- ? getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT
35
+ ? appendRootPathToUrlIfNeeded(getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)
38
36
  : getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0
39
- ? appendResourcePathToUrlIfNotPresent(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)
37
+ ? appendResourcePathToUrl(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)
40
38
  : DEFAULT_COLLECTOR_URL;
41
39
  }
42
40
  }
@@ -1 +1 @@
1
- {"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../../../src/platform/node/OTLPMetricExporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,cAAc,EAA6B,MAAM,iCAAiC,CAAC;AACxH,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EACL,mCAAmC,EACnC,oBAAoB,EAErB,MAAM,mCAAmC,CAAC;AAE3C,MAAM,+BAA+B,GAAG,aAAa,CAAC;AACtD,MAAM,qBAAqB,GAAG,wBAAwB,+BAA+B,EAAE,CAAC;AAExF,MAAM,qBAAsB,SAAQ,oBAC4C;IAG9E,YAAY,SAAiE,cAAc;;QACzF,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAC1B,IAAI,CAAC,OAAO,EACZ,YAAY,CAAC,uBAAuB,CAClC,MAAM,EAAE,CAAC,kCAAkC,CAC5C,CACF,CAAC;QACF,IAAI,CAAC,uBAAuB,GAAG,MAAA,MAAM,CAAC,sBAAsB,mCAAI,0BAA0B,CAAC;IAC7F,CAAC;IAED,OAAO,CACL,OAA0B;QAE1B,OAAO,gCAAgC,CACrC,OAAO,CAAC,CAAC,CAAC,EACV,IAAI,CAAC,uBAAuB,EAC5B,IAAI,CACL,CAAC;IACJ,CAAC;IAED,aAAa,CAAC,MAAkC;QAC9C,OAAO,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ;YACnC,CAAC,CAAC,MAAM,CAAC,GAAG;YACZ,CAAC,CAAC,MAAM,EAAE,CAAC,mCAAmC,CAAC,MAAM,GAAG,CAAC;gBACvD,CAAC,CAAC,MAAM,EAAE,CAAC,mCAAmC;gBAC9C,CAAC,CAAC,MAAM,EAAE,CAAC,2BAA2B,CAAC,MAAM,GAAG,CAAC;oBAC/C,CAAC,CAAC,mCAAmC,CAAC,MAAM,EAAE,CAAC,2BAA2B,EAAE,+BAA+B,CAAC;oBAC5G,CAAC,CAAC,qBAAqB,CAAC;IAChC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,sBAA6C;IACnF,YAAY,SAAiE,cAAc;QACzF,KAAK,CAAC,IAAI,qBAAqB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;IACnD,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 { ResourceMetrics, AggregationTemporality } from '@opentelemetry/sdk-metrics-base';\nimport {\n otlpTypes,\n} from '@opentelemetry/exporter-trace-otlp-http';\nimport { toOTLPExportMetricServiceRequest } from '../../transformMetrics';\nimport { getEnv, baggageUtils} from '@opentelemetry/core';\nimport { defaultExporterTemporality, defaultOptions, OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions';\nimport { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';\nimport {\n appendResourcePathToUrlIfNotPresent,\n OTLPExporterNodeBase,\n OTLPExporterNodeConfigBase\n} from '@opentelemetry/otlp-exporter-base';\n\nconst DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/metrics';\nconst DEFAULT_COLLECTOR_URL = `http://localhost:4318${DEFAULT_COLLECTOR_RESOURCE_PATH}`;\n\nclass OTLPExporterNodeProxy extends OTLPExporterNodeBase<ResourceMetrics,\n otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest> {\n protected readonly _aggregationTemporality: AggregationTemporality;\n\n constructor(config: OTLPExporterNodeConfigBase & OTLPMetricExporterOptions = defaultOptions) {\n super(config);\n this.headers = Object.assign(\n this.headers,\n baggageUtils.parseKeyPairsIntoRecord(\n getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS\n )\n );\n this._aggregationTemporality = config.aggregationTemporality ?? defaultExporterTemporality;\n }\n\n convert(\n metrics: ResourceMetrics[]\n ): otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest {\n return toOTLPExportMetricServiceRequest(\n metrics[0],\n this._aggregationTemporality,\n this\n );\n }\n\n getDefaultUrl(config: OTLPExporterNodeConfigBase): string {\n return typeof config.url === 'string'\n ? config.url\n : getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0\n ? getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT\n : getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0\n ? appendResourcePathToUrlIfNotPresent(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)\n : DEFAULT_COLLECTOR_URL;\n }\n}\n\n/**\n * Collector Metric Exporter for Node\n */\nexport class OTLPMetricExporter extends OTLPMetricExporterBase<OTLPExporterNodeProxy> {\n constructor(config: OTLPExporterNodeConfigBase & OTLPMetricExporterOptions = defaultOptions) {\n super(new OTLPExporterNodeProxy(config), config);\n }\n}\n"]}
1
+ {"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../../../src/platform/node/OTLPMetricExporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,MAAM,EAAE,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAA6B,MAAM,iCAAiC,CAAC;AAC5F,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EACL,oBAAoB,EAEpB,uBAAuB,EACvB,2BAA2B,EAC5B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,iCAAiC,EAAgC,MAAM,iCAAiC,CAAC;AAElH,MAAM,+BAA+B,GAAG,YAAY,CAAC;AACrD,MAAM,qBAAqB,GAAG,yBAAyB,+BAA+B,EAAE,CAAC;AAEzF,MAAM,qBAAsB,SAAQ,oBAAmE;IAErG,YAAY,SAAiE,cAAc;QACzF,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAC1B,IAAI,CAAC,OAAO,EACZ,YAAY,CAAC,uBAAuB,CAClC,MAAM,EAAE,CAAC,kCAAkC,CAC5C,CACF,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,OAA0B;QAChC,OAAO,iCAAiC,CAAC,OAAO,CAAC,CAAC;IACpD,CAAC;IAED,aAAa,CAAC,MAAkC;QAC9C,OAAO,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ;YACnC,CAAC,CAAC,MAAM,CAAC,GAAG;YACZ,CAAC,CAAC,MAAM,EAAE,CAAC,mCAAmC,CAAC,MAAM,GAAG,CAAC;gBACvD,CAAC,CAAC,2BAA2B,CAAC,MAAM,EAAE,CAAC,mCAAmC,EAAE,+BAA+B,CAAC;gBAC5G,CAAC,CAAC,MAAM,EAAE,CAAC,2BAA2B,CAAC,MAAM,GAAG,CAAC;oBAC/C,CAAC,CAAC,uBAAuB,CAAC,MAAM,EAAE,CAAC,2BAA2B,EAAE,+BAA+B,CAAC;oBAChG,CAAC,CAAC,qBAAqB,CAAC;IAChC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,sBAA6C;IACnF,YAAY,SAAiE,cAAc;QACzF,KAAK,CAAC,IAAI,qBAAqB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;IACnD,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 { ResourceMetrics } from '@opentelemetry/sdk-metrics-base';\nimport { getEnv, baggageUtils} from '@opentelemetry/core';\nimport { defaultOptions, OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions';\nimport { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';\nimport {\n OTLPExporterNodeBase,\n OTLPExporterNodeConfigBase,\n appendResourcePathToUrl,\n appendRootPathToUrlIfNeeded\n} from '@opentelemetry/otlp-exporter-base';\nimport { createExportMetricsServiceRequest, IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';\n\nconst DEFAULT_COLLECTOR_RESOURCE_PATH = 'v1/metrics';\nconst DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`;\n\nclass OTLPExporterNodeProxy extends OTLPExporterNodeBase<ResourceMetrics, IExportMetricsServiceRequest> {\n\n constructor(config: OTLPExporterNodeConfigBase & OTLPMetricExporterOptions = defaultOptions) {\n super(config);\n this.headers = Object.assign(\n this.headers,\n baggageUtils.parseKeyPairsIntoRecord(\n getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS\n )\n );\n }\n\n convert(metrics: ResourceMetrics[]): IExportMetricsServiceRequest {\n return createExportMetricsServiceRequest(metrics);\n }\n\n getDefaultUrl(config: OTLPExporterNodeConfigBase): string {\n return typeof config.url === 'string'\n ? config.url\n : getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0\n ? appendRootPathToUrlIfNeeded(getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)\n : getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0\n ? appendResourcePathToUrl(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)\n : DEFAULT_COLLECTOR_URL;\n }\n}\n\n/**\n * Collector Metric Exporter for Node\n */\nexport class OTLPMetricExporter extends OTLPMetricExporterBase<OTLPExporterNodeProxy> {\n constructor(config: OTLPExporterNodeConfigBase & OTLPMetricExporterOptions = defaultOptions) {\n super(new OTLPExporterNodeProxy(config), config);\n }\n}\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.28.0";
1
+ export declare const VERSION = "0.29.2";
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 = '0.28.0';
17
+ export const VERSION = '0.29.2';
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,QAAQ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.28.0';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.29.2';\n"]}
@@ -1,15 +1,17 @@
1
1
  import { ExportResult } from '@opentelemetry/core';
2
- import { AggregationTemporality, PushMetricExporter, ResourceMetrics } from '@opentelemetry/sdk-metrics-base';
3
- import { otlpTypes } from '@opentelemetry/exporter-trace-otlp-http';
2
+ import { AggregationTemporality, AggregationTemporalitySelector, InstrumentType, PushMetricExporter, ResourceMetrics } from '@opentelemetry/sdk-metrics-base';
4
3
  import { OTLPMetricExporterOptions } from './OTLPMetricExporterOptions';
5
4
  import { OTLPExporterBase } from '@opentelemetry/otlp-exporter-base';
6
- export declare class OTLPMetricExporterBase<T extends OTLPExporterBase<OTLPMetricExporterOptions, ResourceMetrics, otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest>> implements PushMetricExporter {
5
+ import { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';
6
+ export declare const CumulativeTemporalitySelector: AggregationTemporalitySelector;
7
+ export declare const DeltaTemporalitySelector: AggregationTemporalitySelector;
8
+ export declare class OTLPMetricExporterBase<T extends OTLPExporterBase<OTLPMetricExporterOptions, ResourceMetrics, IExportMetricsServiceRequest>> implements PushMetricExporter {
7
9
  _otlpExporter: T;
8
- protected _preferredAggregationTemporality: AggregationTemporality;
10
+ protected _aggregationTemporalitySelector: AggregationTemporalitySelector;
9
11
  constructor(exporter: T, config?: OTLPMetricExporterOptions);
10
12
  export(metrics: ResourceMetrics, resultCallback: (result: ExportResult) => void): void;
11
13
  shutdown(): Promise<void>;
12
14
  forceFlush(): Promise<void>;
13
- getPreferredAggregationTemporality(): AggregationTemporality;
15
+ selectAggregationTemporality(instrumentType: InstrumentType): AggregationTemporality;
14
16
  }
15
17
  //# sourceMappingURL=OTLPMetricExporterBase.d.ts.map
@@ -15,14 +15,34 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.OTLPMetricExporterBase = void 0;
18
+ exports.OTLPMetricExporterBase = exports.DeltaTemporalitySelector = exports.CumulativeTemporalitySelector = void 0;
19
19
  const sdk_metrics_base_1 = require("@opentelemetry/sdk-metrics-base");
20
20
  const OTLPMetricExporterOptions_1 = require("./OTLPMetricExporterOptions");
21
+ const CumulativeTemporalitySelector = () => sdk_metrics_base_1.AggregationTemporality.CUMULATIVE;
22
+ exports.CumulativeTemporalitySelector = CumulativeTemporalitySelector;
23
+ const DeltaTemporalitySelector = (instrumentType) => {
24
+ switch (instrumentType) {
25
+ case sdk_metrics_base_1.InstrumentType.COUNTER:
26
+ case sdk_metrics_base_1.InstrumentType.OBSERVABLE_COUNTER:
27
+ case sdk_metrics_base_1.InstrumentType.HISTOGRAM:
28
+ case sdk_metrics_base_1.InstrumentType.OBSERVABLE_GAUGE:
29
+ return sdk_metrics_base_1.AggregationTemporality.DELTA;
30
+ case sdk_metrics_base_1.InstrumentType.UP_DOWN_COUNTER:
31
+ case sdk_metrics_base_1.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER:
32
+ return sdk_metrics_base_1.AggregationTemporality.CUMULATIVE;
33
+ }
34
+ };
35
+ exports.DeltaTemporalitySelector = DeltaTemporalitySelector;
36
+ function chooseTemporalitySelector(temporalityPreference) {
37
+ if (temporalityPreference === sdk_metrics_base_1.AggregationTemporality.DELTA) {
38
+ return exports.DeltaTemporalitySelector;
39
+ }
40
+ return exports.CumulativeTemporalitySelector;
41
+ }
21
42
  class OTLPMetricExporterBase {
22
43
  constructor(exporter, config = OTLPMetricExporterOptions_1.defaultOptions) {
23
- var _a;
24
44
  this._otlpExporter = exporter;
25
- this._preferredAggregationTemporality = (_a = config.aggregationTemporality) !== null && _a !== void 0 ? _a : sdk_metrics_base_1.AggregationTemporality.CUMULATIVE;
45
+ this._aggregationTemporalitySelector = chooseTemporalitySelector(config.temporalityPreference);
26
46
  }
27
47
  export(metrics, resultCallback) {
28
48
  this._otlpExporter.export([metrics], resultCallback);
@@ -33,8 +53,8 @@ class OTLPMetricExporterBase {
33
53
  forceFlush() {
34
54
  return Promise.resolve();
35
55
  }
36
- getPreferredAggregationTemporality() {
37
- return this._preferredAggregationTemporality;
56
+ selectAggregationTemporality(instrumentType) {
57
+ return this._aggregationTemporalitySelector(instrumentType);
38
58
  }
39
59
  }
40
60
  exports.OTLPMetricExporterBase = OTLPMetricExporterBase;
@@ -1 +1 @@
1
- {"version":3,"file":"OTLPMetricExporterBase.js","sourceRoot":"","sources":["../../src/OTLPMetricExporterBase.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAGH,sEAA8G;AAE9G,2EAAwF;AAGxF,MAAa,sBAAsB;IAOjC,YAAY,QAAW,EACX,SAAoC,0CAAc;;QAC5D,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAC;QAC9B,IAAI,CAAC,gCAAgC,GAAG,MAAA,MAAM,CAAC,sBAAsB,mCAAI,yCAAsB,CAAC,UAAU,CAAC;IAC7G,CAAC;IAED,MAAM,CAAC,OAAwB,EAAE,cAA8C;QAC7E,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,MAAM,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC;IACtC,CAAC;IAED,UAAU;QACR,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,kCAAkC;QAChC,OAAO,IAAI,CAAC,gCAAgC,CAAC;IAC/C,CAAC;CAEF;AA7BD,wDA6BC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ExportResult } from '@opentelemetry/core';\nimport { AggregationTemporality, PushMetricExporter, ResourceMetrics } from '@opentelemetry/sdk-metrics-base';\nimport { otlpTypes } from '@opentelemetry/exporter-trace-otlp-http';\nimport { defaultOptions, OTLPMetricExporterOptions } from './OTLPMetricExporterOptions';\nimport { OTLPExporterBase } from '@opentelemetry/otlp-exporter-base';\n\nexport class OTLPMetricExporterBase<T extends OTLPExporterBase<OTLPMetricExporterOptions,\n ResourceMetrics,\n otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest>>\n implements PushMetricExporter {\n public _otlpExporter: T;\n protected _preferredAggregationTemporality: AggregationTemporality;\n\n constructor(exporter: T,\n config: OTLPMetricExporterOptions = defaultOptions) {\n this._otlpExporter = exporter;\n this._preferredAggregationTemporality = config.aggregationTemporality ?? AggregationTemporality.CUMULATIVE;\n }\n\n export(metrics: ResourceMetrics, resultCallback: (result: ExportResult) => void): void {\n this._otlpExporter.export([metrics], resultCallback);\n }\n\n async shutdown(): Promise<void> {\n await this._otlpExporter.shutdown();\n }\n\n forceFlush(): Promise<void> {\n return Promise.resolve();\n }\n\n getPreferredAggregationTemporality(): AggregationTemporality {\n return this._preferredAggregationTemporality;\n }\n\n}\n"]}
1
+ {"version":3,"file":"OTLPMetricExporterBase.js","sourceRoot":"","sources":["../../src/OTLPMetricExporterBase.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAGH,sEAMyC;AACzC,2EAAwF;AAIjF,MAAM,6BAA6B,GAAmC,GAAG,EAAE,CAAC,yCAAsB,CAAC,UAAU,CAAC;AAAxG,QAAA,6BAA6B,iCAA2E;AAE9G,MAAM,wBAAwB,GAAmC,CAAC,cAA8B,EAAE,EAAE;IACzG,QAAQ,cAAc,EAAE;QACtB,KAAK,iCAAc,CAAC,OAAO,CAAC;QAC5B,KAAK,iCAAc,CAAC,kBAAkB,CAAC;QACvC,KAAK,iCAAc,CAAC,SAAS,CAAC;QAC9B,KAAK,iCAAc,CAAC,gBAAgB;YAClC,OAAO,yCAAsB,CAAC,KAAK,CAAC;QACtC,KAAK,iCAAc,CAAC,eAAe,CAAC;QACpC,KAAK,iCAAc,CAAC,0BAA0B;YAC5C,OAAO,yCAAsB,CAAC,UAAU,CAAC;KAC5C;AACH,CAAC,CAAC;AAXW,QAAA,wBAAwB,4BAWnC;AAEF,SAAS,yBAAyB,CAAC,qBAA8C;IAC/E,IAAI,qBAAqB,KAAK,yCAAsB,CAAC,KAAK,EAAE;QAC1D,OAAO,gCAAwB,CAAC;KACjC;IAED,OAAO,qCAA6B,CAAC;AACvC,CAAC;AAED,MAAa,sBAAsB;IAOjC,YAAY,QAAW,EACrB,SAAoC,0CAAc;QAClD,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAC;QAC9B,IAAI,CAAC,+BAA+B,GAAG,yBAAyB,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;IACjG,CAAC;IAED,MAAM,CAAC,OAAwB,EAAE,cAA8C;QAC7E,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,MAAM,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC;IACtC,CAAC;IAED,UAAU;QACR,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,4BAA4B,CAAC,cAA8B;QACzD,OAAO,IAAI,CAAC,+BAA+B,CAAC,cAAc,CAAC,CAAC;IAC9D,CAAC;CACF;AA5BD,wDA4BC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ExportResult } from '@opentelemetry/core';\nimport {\n AggregationTemporality,\n AggregationTemporalitySelector,\n InstrumentType,\n PushMetricExporter,\n ResourceMetrics\n} from '@opentelemetry/sdk-metrics-base';\nimport { defaultOptions, OTLPMetricExporterOptions } from './OTLPMetricExporterOptions';\nimport { OTLPExporterBase } from '@opentelemetry/otlp-exporter-base';\nimport { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';\n\nexport const CumulativeTemporalitySelector: AggregationTemporalitySelector = () => AggregationTemporality.CUMULATIVE;\n\nexport const DeltaTemporalitySelector: AggregationTemporalitySelector = (instrumentType: InstrumentType) => {\n switch (instrumentType) {\n case InstrumentType.COUNTER:\n case InstrumentType.OBSERVABLE_COUNTER:\n case InstrumentType.HISTOGRAM:\n case InstrumentType.OBSERVABLE_GAUGE:\n return AggregationTemporality.DELTA;\n case InstrumentType.UP_DOWN_COUNTER:\n case InstrumentType.OBSERVABLE_UP_DOWN_COUNTER:\n return AggregationTemporality.CUMULATIVE;\n }\n};\n\nfunction chooseTemporalitySelector(temporalityPreference?: AggregationTemporality): AggregationTemporalitySelector {\n if (temporalityPreference === AggregationTemporality.DELTA) {\n return DeltaTemporalitySelector;\n }\n\n return CumulativeTemporalitySelector;\n}\n\nexport class OTLPMetricExporterBase<T extends OTLPExporterBase<OTLPMetricExporterOptions,\n ResourceMetrics,\n IExportMetricsServiceRequest>>\nimplements PushMetricExporter {\n public _otlpExporter: T;\n protected _aggregationTemporalitySelector: AggregationTemporalitySelector;\n\n constructor(exporter: T,\n config: OTLPMetricExporterOptions = defaultOptions) {\n this._otlpExporter = exporter;\n this._aggregationTemporalitySelector = chooseTemporalitySelector(config.temporalityPreference);\n }\n\n export(metrics: ResourceMetrics, resultCallback: (result: ExportResult) => void): void {\n this._otlpExporter.export([metrics], resultCallback);\n }\n\n async shutdown(): Promise<void> {\n await this._otlpExporter.shutdown();\n }\n\n forceFlush(): Promise<void> {\n return Promise.resolve();\n }\n\n selectAggregationTemporality(instrumentType: InstrumentType): AggregationTemporality {\n return this._aggregationTemporalitySelector(instrumentType);\n }\n}\n"]}
@@ -1,10 +1,10 @@
1
1
  import { AggregationTemporality } from '@opentelemetry/sdk-metrics-base';
2
2
  import { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base';
3
3
  export interface OTLPMetricExporterOptions extends OTLPExporterConfigBase {
4
- aggregationTemporality?: AggregationTemporality;
4
+ temporalityPreference?: AggregationTemporality;
5
5
  }
6
6
  export declare const defaultExporterTemporality = AggregationTemporality.CUMULATIVE;
7
7
  export declare const defaultOptions: {
8
- aggregationTemporality: AggregationTemporality;
8
+ temporalityPreference: AggregationTemporality;
9
9
  };
10
10
  //# sourceMappingURL=OTLPMetricExporterOptions.d.ts.map
@@ -18,5 +18,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.defaultOptions = exports.defaultExporterTemporality = void 0;
19
19
  const sdk_metrics_base_1 = require("@opentelemetry/sdk-metrics-base");
20
20
  exports.defaultExporterTemporality = sdk_metrics_base_1.AggregationTemporality.CUMULATIVE;
21
- exports.defaultOptions = { aggregationTemporality: exports.defaultExporterTemporality };
21
+ exports.defaultOptions = { temporalityPreference: exports.defaultExporterTemporality };
22
22
  //# sourceMappingURL=OTLPMetricExporterOptions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OTLPMetricExporterOptions.js","sourceRoot":"","sources":["../../src/OTLPMetricExporterOptions.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,sEAAyE;AAM5D,QAAA,0BAA0B,GAAG,yCAAsB,CAAC,UAAU,CAAC;AAC/D,QAAA,cAAc,GAAG,EAAC,sBAAsB,EAAE,kCAA0B,EAAC,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AggregationTemporality } from '@opentelemetry/sdk-metrics-base';\nimport { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base';\n\nexport interface OTLPMetricExporterOptions extends OTLPExporterConfigBase {\n aggregationTemporality?: AggregationTemporality\n}\nexport const defaultExporterTemporality = AggregationTemporality.CUMULATIVE;\nexport const defaultOptions = {aggregationTemporality: defaultExporterTemporality};\n"]}
1
+ {"version":3,"file":"OTLPMetricExporterOptions.js","sourceRoot":"","sources":["../../src/OTLPMetricExporterOptions.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,sEAAyE;AAM5D,QAAA,0BAA0B,GAAG,yCAAsB,CAAC,UAAU,CAAC;AAC/D,QAAA,cAAc,GAAG,EAAC,qBAAqB,EAAE,kCAA0B,EAAC,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AggregationTemporality } from '@opentelemetry/sdk-metrics-base';\nimport { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base';\n\nexport interface OTLPMetricExporterOptions extends OTLPExporterConfigBase {\n temporalityPreference?: AggregationTemporality\n}\nexport const defaultExporterTemporality = AggregationTemporality.CUMULATIVE;\nexport const defaultOptions = {temporalityPreference: defaultExporterTemporality};\n"]}
@@ -1,5 +1,4 @@
1
1
  export * from './platform';
2
2
  export * from './OTLPMetricExporterOptions';
3
3
  export * from './OTLPMetricExporterBase';
4
- export { toOTLPExportMetricServiceRequest } from './transformMetrics';
5
4
  //# sourceMappingURL=index.d.ts.map
@@ -25,10 +25,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
25
25
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
26
26
  };
27
27
  Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.toOTLPExportMetricServiceRequest = void 0;
29
28
  __exportStar(require("./platform"), exports);
30
29
  __exportStar(require("./OTLPMetricExporterOptions"), exports);
31
30
  __exportStar(require("./OTLPMetricExporterBase"), exports);
32
- var transformMetrics_1 = require("./transformMetrics");
33
- Object.defineProperty(exports, "toOTLPExportMetricServiceRequest", { enumerable: true, get: function () { return transformMetrics_1.toOTLPExportMetricServiceRequest; } });
34
31
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;AAEH,6CAA2B;AAC3B,8DAA4C;AAC5C,2DAAyC;AACzC,uDAAsE;AAA7D,oIAAA,gCAAgC,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 * from './platform';\nexport * from './OTLPMetricExporterOptions';\nexport * from './OTLPMetricExporterBase';\nexport { toOTLPExportMetricServiceRequest } from './transformMetrics';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;AAEH,6CAA2B;AAC3B,8DAA4C;AAC5C,2DAAyC","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 * from './platform';\nexport * from './OTLPMetricExporterOptions';\nexport * from './OTLPMetricExporterBase';\n"]}
@@ -1,13 +1,12 @@
1
- import { AggregationTemporality, ResourceMetrics } from '@opentelemetry/sdk-metrics-base';
2
- import { otlpTypes } from '@opentelemetry/exporter-trace-otlp-http';
1
+ import { ResourceMetrics } from '@opentelemetry/sdk-metrics-base';
3
2
  import { OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions';
4
3
  import { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';
5
4
  import { OTLPExporterBrowserBase, OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base';
6
- declare class OTLPExporterBrowserProxy extends OTLPExporterBrowserBase<ResourceMetrics, otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest> {
7
- protected readonly _aggregationTemporality: AggregationTemporality;
5
+ import { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';
6
+ declare class OTLPExporterBrowserProxy extends OTLPExporterBrowserBase<ResourceMetrics, IExportMetricsServiceRequest> {
8
7
  constructor(config?: OTLPMetricExporterOptions & OTLPExporterConfigBase);
9
8
  getDefaultUrl(config: OTLPExporterConfigBase): string;
10
- convert(metrics: ResourceMetrics[]): otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest;
9
+ convert(metrics: ResourceMetrics[]): IExportMetricsServiceRequest;
11
10
  }
12
11
  /**
13
12
  * Collector Metric Exporter for Web
@@ -16,31 +16,29 @@
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.OTLPMetricExporter = void 0;
19
- const transformMetrics_1 = require("../../transformMetrics");
20
19
  const core_1 = require("@opentelemetry/core");
21
20
  const OTLPMetricExporterOptions_1 = require("../../OTLPMetricExporterOptions");
22
21
  const OTLPMetricExporterBase_1 = require("../../OTLPMetricExporterBase");
23
22
  const otlp_exporter_base_1 = require("@opentelemetry/otlp-exporter-base");
24
- const DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/metrics';
25
- const DEFAULT_COLLECTOR_URL = `http://localhost:4318${DEFAULT_COLLECTOR_RESOURCE_PATH}`;
23
+ const otlp_transformer_1 = require("@opentelemetry/otlp-transformer");
24
+ const DEFAULT_COLLECTOR_RESOURCE_PATH = 'v1/metrics';
25
+ const DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`;
26
26
  class OTLPExporterBrowserProxy extends otlp_exporter_base_1.OTLPExporterBrowserBase {
27
27
  constructor(config = OTLPMetricExporterOptions_1.defaultOptions) {
28
- var _a;
29
28
  super(config);
30
29
  this._headers = Object.assign(this._headers, core_1.baggageUtils.parseKeyPairsIntoRecord((0, core_1.getEnv)().OTEL_EXPORTER_OTLP_METRICS_HEADERS));
31
- this._aggregationTemporality = (_a = config.aggregationTemporality) !== null && _a !== void 0 ? _a : OTLPMetricExporterOptions_1.defaultExporterTemporality;
32
30
  }
33
31
  getDefaultUrl(config) {
34
32
  return typeof config.url === 'string'
35
33
  ? config.url
36
34
  : (0, core_1.getEnv)().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0
37
- ? (0, core_1.getEnv)().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT
35
+ ? (0, otlp_exporter_base_1.appendRootPathToUrlIfNeeded)((0, core_1.getEnv)().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)
38
36
  : (0, core_1.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0
39
- ? (0, otlp_exporter_base_1.appendResourcePathToUrlIfNotPresent)((0, core_1.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)
37
+ ? (0, otlp_exporter_base_1.appendResourcePathToUrl)((0, core_1.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)
40
38
  : DEFAULT_COLLECTOR_URL;
41
39
  }
42
40
  convert(metrics) {
43
- return (0, transformMetrics_1.toOTLPExportMetricServiceRequest)(metrics[0], this._aggregationTemporality, this);
41
+ return (0, otlp_transformer_1.createExportMetricsServiceRequest)(metrics);
44
42
  }
45
43
  }
46
44
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../../../src/platform/browser/OTLPMetricExporter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAMH,6DAA0E;AAC1E,8CAA2D;AAC3D,+EAAwH;AACxH,yEAAsE;AACtE,0EAI2C;AAE3C,MAAM,+BAA+B,GAAG,aAAa,CAAC;AACtD,MAAM,qBAAqB,GAAG,wBAAwB,+BAA+B,EAAE,CAAC;AAExF,MAAM,wBAAyB,SAAQ,4CACyC;IAG9E,YAAY,SAA6D,0CAAc;;QACrF,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAC3B,IAAI,CAAC,QAAQ,EACb,mBAAY,CAAC,uBAAuB,CAClC,IAAA,aAAM,GAAE,CAAC,kCAAkC,CAC5C,CACF,CAAC;QACF,IAAI,CAAC,uBAAuB,GAAG,MAAA,MAAM,CAAC,sBAAsB,mCAAI,sDAA0B,CAAC;IAC7F,CAAC;IAED,aAAa,CAAC,MAA8B;QAC1C,OAAO,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ;YACnC,CAAC,CAAC,MAAM,CAAC,GAAG;YACZ,CAAC,CAAC,IAAA,aAAM,GAAE,CAAC,mCAAmC,CAAC,MAAM,GAAG,CAAC;gBACvD,CAAC,CAAC,IAAA,aAAM,GAAE,CAAC,mCAAmC;gBAC9C,CAAC,CAAC,IAAA,aAAM,GAAE,CAAC,2BAA2B,CAAC,MAAM,GAAG,CAAC;oBAC/C,CAAC,CAAC,IAAA,wDAAmC,EAAC,IAAA,aAAM,GAAE,CAAC,2BAA2B,EAAE,+BAA+B,CAAC;oBAC5G,CAAC,CAAC,qBAAqB,CAAC;IAChC,CAAC;IAED,OAAO,CACL,OAA0B;QAE1B,OAAO,IAAA,mDAAgC,EACrC,OAAO,CAAC,CAAC,CAAC,EACV,IAAI,CAAC,uBAAuB,EAC5B,IAAI,CACL,CAAC;IACJ,CAAC;CACF;AAED;;GAEG;AACH,MAAa,kBAAmB,SAAQ,+CAAgD;IACtF,YAAY,SAA6D,0CAAc;QACrF,KAAK,CAAC,IAAI,wBAAwB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;IACtD,CAAC;CACF;AAJD,gDAIC","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 { AggregationTemporality, ResourceMetrics } from '@opentelemetry/sdk-metrics-base';\nimport {\n otlpTypes\n} from '@opentelemetry/exporter-trace-otlp-http';\nimport { toOTLPExportMetricServiceRequest } from '../../transformMetrics';\nimport { baggageUtils, getEnv } from '@opentelemetry/core';\nimport { defaultExporterTemporality, defaultOptions, OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions';\nimport { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';\nimport {\n appendResourcePathToUrlIfNotPresent,\n OTLPExporterBrowserBase,\n OTLPExporterConfigBase\n} from '@opentelemetry/otlp-exporter-base';\n\nconst DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/metrics';\nconst DEFAULT_COLLECTOR_URL = `http://localhost:4318${DEFAULT_COLLECTOR_RESOURCE_PATH}`;\n\nclass OTLPExporterBrowserProxy extends OTLPExporterBrowserBase<ResourceMetrics,\n otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest> {\n protected readonly _aggregationTemporality: AggregationTemporality;\n\n constructor(config: OTLPMetricExporterOptions & OTLPExporterConfigBase = defaultOptions) {\n super(config);\n this._headers = Object.assign(\n this._headers,\n baggageUtils.parseKeyPairsIntoRecord(\n getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS\n )\n );\n this._aggregationTemporality = config.aggregationTemporality ?? defaultExporterTemporality;\n }\n\n getDefaultUrl(config: OTLPExporterConfigBase): string {\n return typeof config.url === 'string'\n ? config.url\n : getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0\n ? getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT\n : getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0\n ? appendResourcePathToUrlIfNotPresent(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)\n : DEFAULT_COLLECTOR_URL;\n }\n\n convert(\n metrics: ResourceMetrics[]\n ): otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest {\n return toOTLPExportMetricServiceRequest(\n metrics[0],\n this._aggregationTemporality,\n this\n );\n }\n}\n\n/**\n * Collector Metric Exporter for Web\n */\nexport class OTLPMetricExporter extends OTLPMetricExporterBase<OTLPExporterBrowserProxy> {\n constructor(config: OTLPExporterConfigBase & OTLPMetricExporterOptions = defaultOptions) {\n super(new OTLPExporterBrowserProxy(config), config);\n }\n}\n"]}
1
+ {"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../../../src/platform/browser/OTLPMetricExporter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAGH,8CAA2D;AAC3D,+EAA4F;AAC5F,yEAAsE;AACtE,0EAK2C;AAC3C,sEAAkH;AAElH,MAAM,+BAA+B,GAAG,YAAY,CAAC;AACrD,MAAM,qBAAqB,GAAG,yBAAyB,+BAA+B,EAAE,CAAC;AAEzF,MAAM,wBAAyB,SAAQ,4CAAsE;IAE3G,YAAY,SAA6D,0CAAc;QACrF,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAC3B,IAAI,CAAC,QAAQ,EACb,mBAAY,CAAC,uBAAuB,CAClC,IAAA,aAAM,GAAE,CAAC,kCAAkC,CAC5C,CACF,CAAC;IACJ,CAAC;IAED,aAAa,CAAC,MAA8B;QAC1C,OAAO,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ;YACnC,CAAC,CAAC,MAAM,CAAC,GAAG;YACZ,CAAC,CAAC,IAAA,aAAM,GAAE,CAAC,mCAAmC,CAAC,MAAM,GAAG,CAAC;gBACvD,CAAC,CAAC,IAAA,gDAA2B,EAAC,IAAA,aAAM,GAAE,CAAC,mCAAmC,EAAE,+BAA+B,CAAC;gBAC5G,CAAC,CAAC,IAAA,aAAM,GAAE,CAAC,2BAA2B,CAAC,MAAM,GAAG,CAAC;oBAC/C,CAAC,CAAC,IAAA,4CAAuB,EAAC,IAAA,aAAM,GAAE,CAAC,2BAA2B,EAAE,+BAA+B,CAAC;oBAChG,CAAC,CAAC,qBAAqB,CAAC;IAChC,CAAC;IAED,OAAO,CAAC,OAA0B;QAChC,OAAO,IAAA,oDAAiC,EAAC,OAAO,CAAC,CAAC;IACpD,CAAC;CACF;AAED;;GAEG;AACH,MAAa,kBAAmB,SAAQ,+CAAgD;IACtF,YAAY,SAA6D,0CAAc;QACrF,KAAK,CAAC,IAAI,wBAAwB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;IACtD,CAAC;CACF;AAJD,gDAIC","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 { ResourceMetrics } from '@opentelemetry/sdk-metrics-base';\nimport { baggageUtils, getEnv } from '@opentelemetry/core';\nimport { defaultOptions, OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions';\nimport { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';\nimport {\n OTLPExporterBrowserBase,\n OTLPExporterConfigBase,\n appendResourcePathToUrl,\n appendRootPathToUrlIfNeeded\n} from '@opentelemetry/otlp-exporter-base';\nimport { createExportMetricsServiceRequest, IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';\n\nconst DEFAULT_COLLECTOR_RESOURCE_PATH = 'v1/metrics';\nconst DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`;\n\nclass OTLPExporterBrowserProxy extends OTLPExporterBrowserBase<ResourceMetrics, IExportMetricsServiceRequest> {\n\n constructor(config: OTLPMetricExporterOptions & OTLPExporterConfigBase = defaultOptions) {\n super(config);\n this._headers = Object.assign(\n this._headers,\n baggageUtils.parseKeyPairsIntoRecord(\n getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS\n )\n );\n }\n\n getDefaultUrl(config: OTLPExporterConfigBase): string {\n return typeof config.url === 'string'\n ? config.url\n : getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0\n ? appendRootPathToUrlIfNeeded(getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)\n : getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0\n ? appendResourcePathToUrl(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)\n : DEFAULT_COLLECTOR_URL;\n }\n\n convert(metrics: ResourceMetrics[]): IExportMetricsServiceRequest {\n return createExportMetricsServiceRequest(metrics);\n }\n}\n\n/**\n * Collector Metric Exporter for Web\n */\nexport class OTLPMetricExporter extends OTLPMetricExporterBase<OTLPExporterBrowserProxy> {\n constructor(config: OTLPExporterConfigBase & OTLPMetricExporterOptions = defaultOptions) {\n super(new OTLPExporterBrowserProxy(config), config);\n }\n}\n"]}
@@ -1,12 +1,11 @@
1
- import { ResourceMetrics, AggregationTemporality } from '@opentelemetry/sdk-metrics-base';
2
- import { otlpTypes } from '@opentelemetry/exporter-trace-otlp-http';
1
+ import { ResourceMetrics } from '@opentelemetry/sdk-metrics-base';
3
2
  import { OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions';
4
3
  import { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';
5
4
  import { OTLPExporterNodeBase, OTLPExporterNodeConfigBase } from '@opentelemetry/otlp-exporter-base';
6
- declare class OTLPExporterNodeProxy extends OTLPExporterNodeBase<ResourceMetrics, otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest> {
7
- protected readonly _aggregationTemporality: AggregationTemporality;
5
+ import { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';
6
+ declare class OTLPExporterNodeProxy extends OTLPExporterNodeBase<ResourceMetrics, IExportMetricsServiceRequest> {
8
7
  constructor(config?: OTLPExporterNodeConfigBase & OTLPMetricExporterOptions);
9
- convert(metrics: ResourceMetrics[]): otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest;
8
+ convert(metrics: ResourceMetrics[]): IExportMetricsServiceRequest;
10
9
  getDefaultUrl(config: OTLPExporterNodeConfigBase): string;
11
10
  }
12
11
  /**
@@ -16,30 +16,28 @@
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.OTLPMetricExporter = void 0;
19
- const transformMetrics_1 = require("../../transformMetrics");
20
19
  const core_1 = require("@opentelemetry/core");
21
20
  const OTLPMetricExporterOptions_1 = require("../../OTLPMetricExporterOptions");
22
21
  const OTLPMetricExporterBase_1 = require("../../OTLPMetricExporterBase");
23
22
  const otlp_exporter_base_1 = require("@opentelemetry/otlp-exporter-base");
24
- const DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/metrics';
25
- const DEFAULT_COLLECTOR_URL = `http://localhost:4318${DEFAULT_COLLECTOR_RESOURCE_PATH}`;
23
+ const otlp_transformer_1 = require("@opentelemetry/otlp-transformer");
24
+ const DEFAULT_COLLECTOR_RESOURCE_PATH = 'v1/metrics';
25
+ const DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`;
26
26
  class OTLPExporterNodeProxy extends otlp_exporter_base_1.OTLPExporterNodeBase {
27
27
  constructor(config = OTLPMetricExporterOptions_1.defaultOptions) {
28
- var _a;
29
28
  super(config);
30
29
  this.headers = Object.assign(this.headers, core_1.baggageUtils.parseKeyPairsIntoRecord((0, core_1.getEnv)().OTEL_EXPORTER_OTLP_METRICS_HEADERS));
31
- this._aggregationTemporality = (_a = config.aggregationTemporality) !== null && _a !== void 0 ? _a : OTLPMetricExporterOptions_1.defaultExporterTemporality;
32
30
  }
33
31
  convert(metrics) {
34
- return (0, transformMetrics_1.toOTLPExportMetricServiceRequest)(metrics[0], this._aggregationTemporality, this);
32
+ return (0, otlp_transformer_1.createExportMetricsServiceRequest)(metrics);
35
33
  }
36
34
  getDefaultUrl(config) {
37
35
  return typeof config.url === 'string'
38
36
  ? config.url
39
37
  : (0, core_1.getEnv)().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0
40
- ? (0, core_1.getEnv)().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT
38
+ ? (0, otlp_exporter_base_1.appendRootPathToUrlIfNeeded)((0, core_1.getEnv)().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)
41
39
  : (0, core_1.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0
42
- ? (0, otlp_exporter_base_1.appendResourcePathToUrlIfNotPresent)((0, core_1.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)
40
+ ? (0, otlp_exporter_base_1.appendResourcePathToUrl)((0, core_1.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)
43
41
  : DEFAULT_COLLECTOR_URL;
44
42
  }
45
43
  }
@@ -1 +1 @@
1
- {"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../../../src/platform/node/OTLPMetricExporter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAMH,6DAA0E;AAC1E,8CAA0D;AAC1D,+EAAwH;AACxH,yEAAsE;AACtE,0EAI2C;AAE3C,MAAM,+BAA+B,GAAG,aAAa,CAAC;AACtD,MAAM,qBAAqB,GAAG,wBAAwB,+BAA+B,EAAE,CAAC;AAExF,MAAM,qBAAsB,SAAQ,yCAC4C;IAG9E,YAAY,SAAiE,0CAAc;;QACzF,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAC1B,IAAI,CAAC,OAAO,EACZ,mBAAY,CAAC,uBAAuB,CAClC,IAAA,aAAM,GAAE,CAAC,kCAAkC,CAC5C,CACF,CAAC;QACF,IAAI,CAAC,uBAAuB,GAAG,MAAA,MAAM,CAAC,sBAAsB,mCAAI,sDAA0B,CAAC;IAC7F,CAAC;IAED,OAAO,CACL,OAA0B;QAE1B,OAAO,IAAA,mDAAgC,EACrC,OAAO,CAAC,CAAC,CAAC,EACV,IAAI,CAAC,uBAAuB,EAC5B,IAAI,CACL,CAAC;IACJ,CAAC;IAED,aAAa,CAAC,MAAkC;QAC9C,OAAO,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ;YACnC,CAAC,CAAC,MAAM,CAAC,GAAG;YACZ,CAAC,CAAC,IAAA,aAAM,GAAE,CAAC,mCAAmC,CAAC,MAAM,GAAG,CAAC;gBACvD,CAAC,CAAC,IAAA,aAAM,GAAE,CAAC,mCAAmC;gBAC9C,CAAC,CAAC,IAAA,aAAM,GAAE,CAAC,2BAA2B,CAAC,MAAM,GAAG,CAAC;oBAC/C,CAAC,CAAC,IAAA,wDAAmC,EAAC,IAAA,aAAM,GAAE,CAAC,2BAA2B,EAAE,+BAA+B,CAAC;oBAC5G,CAAC,CAAC,qBAAqB,CAAC;IAChC,CAAC;CACF;AAED;;GAEG;AACH,MAAa,kBAAmB,SAAQ,+CAA6C;IACnF,YAAY,SAAiE,0CAAc;QACzF,KAAK,CAAC,IAAI,qBAAqB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;IACnD,CAAC;CACF;AAJD,gDAIC","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 { ResourceMetrics, AggregationTemporality } from '@opentelemetry/sdk-metrics-base';\nimport {\n otlpTypes,\n} from '@opentelemetry/exporter-trace-otlp-http';\nimport { toOTLPExportMetricServiceRequest } from '../../transformMetrics';\nimport { getEnv, baggageUtils} from '@opentelemetry/core';\nimport { defaultExporterTemporality, defaultOptions, OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions';\nimport { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';\nimport {\n appendResourcePathToUrlIfNotPresent,\n OTLPExporterNodeBase,\n OTLPExporterNodeConfigBase\n} from '@opentelemetry/otlp-exporter-base';\n\nconst DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/metrics';\nconst DEFAULT_COLLECTOR_URL = `http://localhost:4318${DEFAULT_COLLECTOR_RESOURCE_PATH}`;\n\nclass OTLPExporterNodeProxy extends OTLPExporterNodeBase<ResourceMetrics,\n otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest> {\n protected readonly _aggregationTemporality: AggregationTemporality;\n\n constructor(config: OTLPExporterNodeConfigBase & OTLPMetricExporterOptions = defaultOptions) {\n super(config);\n this.headers = Object.assign(\n this.headers,\n baggageUtils.parseKeyPairsIntoRecord(\n getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS\n )\n );\n this._aggregationTemporality = config.aggregationTemporality ?? defaultExporterTemporality;\n }\n\n convert(\n metrics: ResourceMetrics[]\n ): otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest {\n return toOTLPExportMetricServiceRequest(\n metrics[0],\n this._aggregationTemporality,\n this\n );\n }\n\n getDefaultUrl(config: OTLPExporterNodeConfigBase): string {\n return typeof config.url === 'string'\n ? config.url\n : getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0\n ? getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT\n : getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0\n ? appendResourcePathToUrlIfNotPresent(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)\n : DEFAULT_COLLECTOR_URL;\n }\n}\n\n/**\n * Collector Metric Exporter for Node\n */\nexport class OTLPMetricExporter extends OTLPMetricExporterBase<OTLPExporterNodeProxy> {\n constructor(config: OTLPExporterNodeConfigBase & OTLPMetricExporterOptions = defaultOptions) {\n super(new OTLPExporterNodeProxy(config), config);\n }\n}\n"]}
1
+ {"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../../../src/platform/node/OTLPMetricExporter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAGH,8CAA0D;AAC1D,+EAA4F;AAC5F,yEAAsE;AACtE,0EAK2C;AAC3C,sEAAkH;AAElH,MAAM,+BAA+B,GAAG,YAAY,CAAC;AACrD,MAAM,qBAAqB,GAAG,yBAAyB,+BAA+B,EAAE,CAAC;AAEzF,MAAM,qBAAsB,SAAQ,yCAAmE;IAErG,YAAY,SAAiE,0CAAc;QACzF,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAC1B,IAAI,CAAC,OAAO,EACZ,mBAAY,CAAC,uBAAuB,CAClC,IAAA,aAAM,GAAE,CAAC,kCAAkC,CAC5C,CACF,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,OAA0B;QAChC,OAAO,IAAA,oDAAiC,EAAC,OAAO,CAAC,CAAC;IACpD,CAAC;IAED,aAAa,CAAC,MAAkC;QAC9C,OAAO,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ;YACnC,CAAC,CAAC,MAAM,CAAC,GAAG;YACZ,CAAC,CAAC,IAAA,aAAM,GAAE,CAAC,mCAAmC,CAAC,MAAM,GAAG,CAAC;gBACvD,CAAC,CAAC,IAAA,gDAA2B,EAAC,IAAA,aAAM,GAAE,CAAC,mCAAmC,EAAE,+BAA+B,CAAC;gBAC5G,CAAC,CAAC,IAAA,aAAM,GAAE,CAAC,2BAA2B,CAAC,MAAM,GAAG,CAAC;oBAC/C,CAAC,CAAC,IAAA,4CAAuB,EAAC,IAAA,aAAM,GAAE,CAAC,2BAA2B,EAAE,+BAA+B,CAAC;oBAChG,CAAC,CAAC,qBAAqB,CAAC;IAChC,CAAC;CACF;AAED;;GAEG;AACH,MAAa,kBAAmB,SAAQ,+CAA6C;IACnF,YAAY,SAAiE,0CAAc;QACzF,KAAK,CAAC,IAAI,qBAAqB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;IACnD,CAAC;CACF;AAJD,gDAIC","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 { ResourceMetrics } from '@opentelemetry/sdk-metrics-base';\nimport { getEnv, baggageUtils} from '@opentelemetry/core';\nimport { defaultOptions, OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions';\nimport { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';\nimport {\n OTLPExporterNodeBase,\n OTLPExporterNodeConfigBase,\n appendResourcePathToUrl,\n appendRootPathToUrlIfNeeded\n} from '@opentelemetry/otlp-exporter-base';\nimport { createExportMetricsServiceRequest, IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';\n\nconst DEFAULT_COLLECTOR_RESOURCE_PATH = 'v1/metrics';\nconst DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`;\n\nclass OTLPExporterNodeProxy extends OTLPExporterNodeBase<ResourceMetrics, IExportMetricsServiceRequest> {\n\n constructor(config: OTLPExporterNodeConfigBase & OTLPMetricExporterOptions = defaultOptions) {\n super(config);\n this.headers = Object.assign(\n this.headers,\n baggageUtils.parseKeyPairsIntoRecord(\n getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS\n )\n );\n }\n\n convert(metrics: ResourceMetrics[]): IExportMetricsServiceRequest {\n return createExportMetricsServiceRequest(metrics);\n }\n\n getDefaultUrl(config: OTLPExporterNodeConfigBase): string {\n return typeof config.url === 'string'\n ? config.url\n : getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0\n ? appendRootPathToUrlIfNeeded(getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)\n : getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0\n ? appendResourcePathToUrl(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)\n : DEFAULT_COLLECTOR_URL;\n }\n}\n\n/**\n * Collector Metric Exporter for Node\n */\nexport class OTLPMetricExporter extends OTLPMetricExporterBase<OTLPExporterNodeProxy> {\n constructor(config: OTLPExporterNodeConfigBase & OTLPMetricExporterOptions = defaultOptions) {\n super(new OTLPExporterNodeProxy(config), config);\n }\n}\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.28.0";
1
+ export declare const VERSION = "0.29.2";
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 = '0.28.0';
20
+ exports.VERSION = '0.29.2';
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,QAAQ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.28.0';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.29.2';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentelemetry/exporter-metrics-otlp-http",
3
- "version": "0.28.0",
3
+ "version": "0.29.2",
4
4
  "description": "OpenTelemetry Collector Metrics Exporter allows user to send collected metrics to the OpenTelemetry Collector",
5
5
  "main": "build/src/index.js",
6
6
  "module": "build/esm/index.js",
@@ -84,7 +84,7 @@
84
84
  "rimraf": "3.0.2",
85
85
  "sinon": "12.0.1",
86
86
  "ts-loader": "8.3.0",
87
- "ts-mocha": "8.0.0",
87
+ "ts-mocha": "9.0.2",
88
88
  "typescript": "4.4.4",
89
89
  "webpack": "4.46.0",
90
90
  "webpack-cli": "4.9.1",
@@ -94,12 +94,12 @@
94
94
  "@opentelemetry/api": "^1.0.0"
95
95
  },
96
96
  "dependencies": {
97
- "@opentelemetry/api-metrics": "0.28.0",
98
- "@opentelemetry/core": "1.2.0",
99
- "@opentelemetry/exporter-trace-otlp-http": "0.28.0",
100
- "@opentelemetry/otlp-exporter-base": "0.28.0",
101
- "@opentelemetry/resources": "1.2.0",
102
- "@opentelemetry/sdk-metrics-base": "0.28.0"
97
+ "@opentelemetry/api-metrics": "0.29.2",
98
+ "@opentelemetry/core": "1.3.1",
99
+ "@opentelemetry/otlp-exporter-base": "0.29.2",
100
+ "@opentelemetry/otlp-transformer": "0.29.2",
101
+ "@opentelemetry/resources": "1.3.1",
102
+ "@opentelemetry/sdk-metrics-base": "0.29.2"
103
103
  },
104
- "gitHead": "a0a670a03fd35b0799bee8cc466f79e93b5b6dd2"
104
+ "gitHead": "51afd54bd63e46d5d530266761144c7be2f6b3a7"
105
105
  }