@opentelemetry/exporter-metrics-otlp-http 0.57.2 → 0.200.0-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +16 -12
  2. package/build/esm/OTLPMetricExporterBase.d.ts +2 -2
  3. package/build/esm/OTLPMetricExporterBase.js +24 -43
  4. package/build/esm/OTLPMetricExporterBase.js.map +1 -1
  5. package/build/esm/platform/browser/OTLPMetricExporter.js +4 -22
  6. package/build/esm/platform/browser/OTLPMetricExporter.js.map +1 -1
  7. package/build/esm/platform/node/OTLPMetricExporter.js +9 -35
  8. package/build/esm/platform/node/OTLPMetricExporter.js.map +1 -1
  9. package/build/esm/version.d.ts +1 -1
  10. package/build/esm/version.js +1 -1
  11. package/build/esm/version.js.map +1 -1
  12. package/build/esnext/OTLPMetricExporterBase.d.ts +2 -2
  13. package/build/esnext/OTLPMetricExporterBase.js +12 -12
  14. package/build/esnext/OTLPMetricExporterBase.js.map +1 -1
  15. package/build/esnext/platform/browser/OTLPMetricExporter.js +1 -1
  16. package/build/esnext/platform/browser/OTLPMetricExporter.js.map +1 -1
  17. package/build/esnext/platform/node/OTLPMetricExporter.js +4 -1
  18. package/build/esnext/platform/node/OTLPMetricExporter.js.map +1 -1
  19. package/build/esnext/version.d.ts +1 -1
  20. package/build/esnext/version.js +1 -1
  21. package/build/esnext/version.js.map +1 -1
  22. package/build/src/OTLPMetricExporterBase.d.ts +2 -2
  23. package/build/src/OTLPMetricExporterBase.js +10 -10
  24. package/build/src/OTLPMetricExporterBase.js.map +1 -1
  25. package/build/src/platform/browser/OTLPMetricExporter.js +1 -1
  26. package/build/src/platform/browser/OTLPMetricExporter.js.map +1 -1
  27. package/build/src/platform/node/OTLPMetricExporter.js +4 -1
  28. package/build/src/platform/node/OTLPMetricExporter.js.map +1 -1
  29. package/build/src/version.d.ts +1 -1
  30. package/build/src/version.js +1 -1
  31. package/build/src/version.js.map +1 -1
  32. package/package.json +17 -18
package/README.md CHANGED
@@ -35,12 +35,14 @@ const collectorOptions = {
35
35
  concurrencyLimit: 1, // an optional limit on pending requests
36
36
  };
37
37
  const metricExporter = new OTLPMetricExporter(collectorOptions);
38
- const meterProvider = new MeterProvider({});
39
-
40
- meterProvider.addMetricReader(new PeriodicExportingMetricReader({
41
- exporter: metricExporter,
42
- exportIntervalMillis: 1000,
43
- }));
38
+ const meterProvider = new MeterProvider({
39
+ readers: [
40
+ new PeriodicExportingMetricReader({
41
+ exporter: metricExporter,
42
+ exportIntervalMillis: 1000,
43
+ }),
44
+ ],
45
+ });
44
46
 
45
47
  // Now, start recording data
46
48
  const meter = meterProvider.getMeter('example-meter');
@@ -58,12 +60,14 @@ const collectorOptions = {
58
60
  concurrencyLimit: 1, // an optional limit on pending requests
59
61
  };
60
62
  const metricExporter = new OTLPMetricExporter(collectorOptions);
61
- const meterProvider = new MeterProvider({});
62
-
63
- meterProvider.addMetricReader(new PeriodicExportingMetricReader({
64
- exporter: metricExporter,
65
- exportIntervalMillis: 1000,
66
- }));
63
+ const meterProvider = new MeterProvider({
64
+ readers: [
65
+ new PeriodicExportingMetricReader({
66
+ exporter: metricExporter,
67
+ exportIntervalMillis: 1000,
68
+ }),
69
+ ],
70
+ });
67
71
 
68
72
  // Now, start recording data
69
73
  const meter = meterProvider.getMeter('example-meter');
@@ -1,4 +1,4 @@
1
- import { AggregationTemporality, AggregationTemporalitySelector, InstrumentType, PushMetricExporter, ResourceMetrics, Aggregation } from '@opentelemetry/sdk-metrics';
1
+ import { AggregationTemporality, AggregationTemporalitySelector, InstrumentType, PushMetricExporter, ResourceMetrics, AggregationOption } from '@opentelemetry/sdk-metrics';
2
2
  import { OTLPMetricExporterOptions } from './OTLPMetricExporterOptions';
3
3
  import { IOtlpExportDelegate, OTLPExporterBase } from '@opentelemetry/otlp-exporter-base';
4
4
  export declare const CumulativeTemporalitySelector: AggregationTemporalitySelector;
@@ -8,7 +8,7 @@ export declare class OTLPMetricExporterBase extends OTLPExporterBase<ResourceMet
8
8
  private readonly _aggregationTemporalitySelector;
9
9
  private readonly _aggregationSelector;
10
10
  constructor(delegate: IOtlpExportDelegate<ResourceMetrics>, config?: OTLPMetricExporterOptions);
11
- selectAggregation(instrumentType: InstrumentType): Aggregation;
11
+ selectAggregation(instrumentType: InstrumentType): AggregationOption;
12
12
  selectAggregationTemporality(instrumentType: InstrumentType): AggregationTemporality;
13
13
  }
14
14
  //# sourceMappingURL=OTLPMetricExporterBase.d.ts.map
@@ -13,28 +13,13 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- var __extends = (this && this.__extends) || (function () {
17
- var extendStatics = function (d, b) {
18
- extendStatics = Object.setPrototypeOf ||
19
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
20
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
21
- return extendStatics(d, b);
22
- };
23
- return function (d, b) {
24
- if (typeof b !== "function" && b !== null)
25
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
26
- extendStatics(d, b);
27
- function __() { this.constructor = d; }
28
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
29
- };
30
- })();
31
- import { getEnv } from '@opentelemetry/core';
32
- import { AggregationTemporality, InstrumentType, Aggregation, } from '@opentelemetry/sdk-metrics';
16
+ import { getStringFromEnv } from '@opentelemetry/core';
17
+ import { AggregationTemporality, InstrumentType, AggregationType, } from '@opentelemetry/sdk-metrics';
33
18
  import { AggregationTemporalityPreference, } from './OTLPMetricExporterOptions';
34
19
  import { OTLPExporterBase, } from '@opentelemetry/otlp-exporter-base';
35
20
  import { diag } from '@opentelemetry/api';
36
- export var CumulativeTemporalitySelector = function () { return AggregationTemporality.CUMULATIVE; };
37
- export var DeltaTemporalitySelector = function (instrumentType) {
21
+ export const CumulativeTemporalitySelector = () => AggregationTemporality.CUMULATIVE;
22
+ export const DeltaTemporalitySelector = (instrumentType) => {
38
23
  switch (instrumentType) {
39
24
  case InstrumentType.COUNTER:
40
25
  case InstrumentType.OBSERVABLE_COUNTER:
@@ -47,7 +32,7 @@ export var DeltaTemporalitySelector = function (instrumentType) {
47
32
  return AggregationTemporality.CUMULATIVE;
48
33
  }
49
34
  };
50
- export var LowMemoryTemporalitySelector = function (instrumentType) {
35
+ export const LowMemoryTemporalitySelector = (instrumentType) => {
51
36
  switch (instrumentType) {
52
37
  case InstrumentType.COUNTER:
53
38
  case InstrumentType.HISTOGRAM:
@@ -61,8 +46,8 @@ export var LowMemoryTemporalitySelector = function (instrumentType) {
61
46
  }
62
47
  };
63
48
  function chooseTemporalitySelectorFromEnvironment() {
64
- var env = getEnv();
65
- var configuredTemporality = env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE.trim().toLowerCase();
49
+ const configuredTemporality = (getStringFromEnv('OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE') ??
50
+ 'cumulative').toLowerCase();
66
51
  if (configuredTemporality === 'cumulative') {
67
52
  return CumulativeTemporalitySelector;
68
53
  }
@@ -72,7 +57,7 @@ function chooseTemporalitySelectorFromEnvironment() {
72
57
  if (configuredTemporality === 'lowmemory') {
73
58
  return LowMemoryTemporalitySelector;
74
59
  }
75
- diag.warn("OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '" + env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE + "', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.");
60
+ diag.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${configuredTemporality}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`);
76
61
  return CumulativeTemporalitySelector;
77
62
  }
78
63
  function chooseTemporalitySelector(temporalityPreference) {
@@ -88,29 +73,25 @@ function chooseTemporalitySelector(temporalityPreference) {
88
73
  }
89
74
  return chooseTemporalitySelectorFromEnvironment();
90
75
  }
76
+ const DEFAULT_AGGREGATION = Object.freeze({
77
+ type: AggregationType.DEFAULT,
78
+ });
91
79
  function chooseAggregationSelector(config) {
92
- if (config === null || config === void 0 ? void 0 : config.aggregationPreference) {
93
- return config.aggregationPreference;
94
- }
95
- else {
96
- return function (_instrumentType) { return Aggregation.Default(); };
97
- }
80
+ return config?.aggregationPreference ?? (() => DEFAULT_AGGREGATION);
98
81
  }
99
- var OTLPMetricExporterBase = /** @class */ (function (_super) {
100
- __extends(OTLPMetricExporterBase, _super);
101
- function OTLPMetricExporterBase(delegate, config) {
102
- var _this = _super.call(this, delegate) || this;
103
- _this._aggregationSelector = chooseAggregationSelector(config);
104
- _this._aggregationTemporalitySelector = chooseTemporalitySelector(config === null || config === void 0 ? void 0 : config.temporalityPreference);
105
- return _this;
82
+ export class OTLPMetricExporterBase extends OTLPExporterBase {
83
+ _aggregationTemporalitySelector;
84
+ _aggregationSelector;
85
+ constructor(delegate, config) {
86
+ super(delegate);
87
+ this._aggregationSelector = chooseAggregationSelector(config);
88
+ this._aggregationTemporalitySelector = chooseTemporalitySelector(config?.temporalityPreference);
106
89
  }
107
- OTLPMetricExporterBase.prototype.selectAggregation = function (instrumentType) {
90
+ selectAggregation(instrumentType) {
108
91
  return this._aggregationSelector(instrumentType);
109
- };
110
- OTLPMetricExporterBase.prototype.selectAggregationTemporality = function (instrumentType) {
92
+ }
93
+ selectAggregationTemporality(instrumentType) {
111
94
  return this._aggregationTemporalitySelector(instrumentType);
112
- };
113
- return OTLPMetricExporterBase;
114
- }(OTLPExporterBase));
115
- export { OTLPMetricExporterBase };
95
+ }
96
+ }
116
97
  //# sourceMappingURL=OTLPMetricExporterBase.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OTLPMetricExporterBase.js","sourceRoot":"","sources":["../../src/OTLPMetricExporterBase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBA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yB,CAC9D,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,qBAAqB,CAC9B,CAAC;;IACJ,CAAC;IAED,kDAAiB,GAAjB,UAAkB,cAA8B;QAC9C,OAAO,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;IACnD,CAAC;IAED,6DAA4B,GAA5B,UACE,cAA8B;QAE9B,OAAO,IAAI,CAAC,+BAA+B,CAAC,cAAc,CAAC,CAAC;IAC9D,CAAC;IACH,6BAAC;AAAD,CAAC,AA3BD,CACU,gBAAgB,GA0BzB","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 { getEnv } from '@opentelemetry/core';\nimport {\n AggregationTemporality,\n AggregationTemporalitySelector,\n InstrumentType,\n PushMetricExporter,\n ResourceMetrics,\n Aggregation,\n AggregationSelector,\n} from '@opentelemetry/sdk-metrics';\nimport {\n AggregationTemporalityPreference,\n OTLPMetricExporterOptions,\n} from './OTLPMetricExporterOptions';\nimport {\n IOtlpExportDelegate,\n OTLPExporterBase,\n} from '@opentelemetry/otlp-exporter-base';\nimport { diag } from '@opentelemetry/api';\n\nexport const CumulativeTemporalitySelector: AggregationTemporalitySelector =\n () => AggregationTemporality.CUMULATIVE;\n\nexport const DeltaTemporalitySelector: AggregationTemporalitySelector = (\n instrumentType: InstrumentType\n) => {\n switch (instrumentType) {\n case InstrumentType.COUNTER:\n case InstrumentType.OBSERVABLE_COUNTER:\n case InstrumentType.GAUGE:\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\nexport const LowMemoryTemporalitySelector: AggregationTemporalitySelector = (\n instrumentType: InstrumentType\n) => {\n switch (instrumentType) {\n case InstrumentType.COUNTER:\n case InstrumentType.HISTOGRAM:\n return AggregationTemporality.DELTA;\n case InstrumentType.GAUGE:\n case InstrumentType.UP_DOWN_COUNTER:\n case InstrumentType.OBSERVABLE_UP_DOWN_COUNTER:\n case InstrumentType.OBSERVABLE_COUNTER:\n case InstrumentType.OBSERVABLE_GAUGE:\n return AggregationTemporality.CUMULATIVE;\n }\n};\n\nfunction chooseTemporalitySelectorFromEnvironment() {\n const env = getEnv();\n const configuredTemporality =\n env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE.trim().toLowerCase();\n\n if (configuredTemporality === 'cumulative') {\n return CumulativeTemporalitySelector;\n }\n if (configuredTemporality === 'delta') {\n return DeltaTemporalitySelector;\n }\n if (configuredTemporality === 'lowmemory') {\n return LowMemoryTemporalitySelector;\n }\n\n diag.warn(\n `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`\n );\n return CumulativeTemporalitySelector;\n}\n\nfunction chooseTemporalitySelector(\n temporalityPreference?:\n | AggregationTemporalityPreference\n | AggregationTemporality\n): AggregationTemporalitySelector {\n // Directly passed preference has priority.\n if (temporalityPreference != null) {\n if (temporalityPreference === AggregationTemporalityPreference.DELTA) {\n return DeltaTemporalitySelector;\n } else if (\n temporalityPreference === AggregationTemporalityPreference.LOWMEMORY\n ) {\n return LowMemoryTemporalitySelector;\n }\n return CumulativeTemporalitySelector;\n }\n\n return chooseTemporalitySelectorFromEnvironment();\n}\n\nfunction chooseAggregationSelector(\n config: OTLPMetricExporterOptions | undefined\n) {\n if (config?.aggregationPreference) {\n return config.aggregationPreference;\n } else {\n return (_instrumentType: any) => Aggregation.Default();\n }\n}\n\nexport class OTLPMetricExporterBase\n extends OTLPExporterBase<ResourceMetrics>\n implements PushMetricExporter\n{\n private readonly _aggregationTemporalitySelector: AggregationTemporalitySelector;\n private readonly _aggregationSelector: AggregationSelector;\n\n constructor(\n delegate: IOtlpExportDelegate<ResourceMetrics>,\n config?: OTLPMetricExporterOptions\n ) {\n super(delegate);\n this._aggregationSelector = chooseAggregationSelector(config);\n this._aggregationTemporalitySelector = chooseTemporalitySelector(\n config?.temporalityPreference\n );\n }\n\n selectAggregation(instrumentType: InstrumentType): Aggregation {\n return this._aggregationSelector(instrumentType);\n }\n\n selectAggregationTemporality(\n instrumentType: InstrumentType\n ): AggregationTemporality {\n return this._aggregationTemporalitySelector(instrumentType);\n }\n}\n"]}
1
+ {"version":3,"file":"OTLPMetricExporterBase.js","sourceRoot":"","sources":["../../src/OTLPMetricExporterBase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EACL,sBAAsB,EAEtB,cAAc,EAKd,eAAe,GAChB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,gCAAgC,GAEjC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,gBAAgB,GACjB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,MAAM,CAAC,MAAM,6BAA6B,GACxC,GAAG,EAAE,CAAC,sBAAsB,CAAC,UAAU,CAAC;AAE1C,MAAM,CAAC,MAAM,wBAAwB,GAAmC,CACtE,cAA8B,EAC9B,EAAE;IACF,QAAQ,cAAc,EAAE;QACtB,KAAK,cAAc,CAAC,OAAO,CAAC;QAC5B,KAAK,cAAc,CAAC,kBAAkB,CAAC;QACvC,KAAK,cAAc,CAAC,KAAK,C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I,qBAAqB,KAAK,gCAAgC,CAAC,KAAK,EAAE;YACpE,OAAO,wBAAwB,CAAC;SACjC;aAAM,IACL,qBAAqB,KAAK,gCAAgC,CAAC,SAAS,EACpE;YACA,OAAO,4BAA4B,CAAC;SACrC;QACD,OAAO,6BAA6B,CAAC;KACtC;IAED,OAAO,wCAAwC,EAAE,CAAC;AACpD,CAAC;AAED,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC;IACxC,IAAI,EAAE,eAAe,CAAC,OAAO;CAC9B,CAAC,CAAC;AAEH,SAAS,yBAAyB,CAChC,MAA6C;IAE7C,OAAO,MAAM,EAAE,qBAAqB,IAAI,CAAC,GAAG,EAAE,CAAC,mBAAmB,CAAC,CAAC;AACtE,CAAC;AAED,MAAM,OAAO,sBACX,SAAQ,gBAAiC;IAGxB,+BAA+B,CAAiC;IAChE,oBAAoB,CAAsB;IAE3D,YACE,QAA8C,EAC9C,MAAkC;QAElC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChB,IAAI,CAAC,oBAAoB,GAAG,yBAAyB,CAAC,MAAM,CAAC,CAAC;QAC9D,IAAI,CAAC,+BAA+B,GAAG,yBAAyB,CAC9D,MAAM,EAAE,qBAAqB,CAC9B,CAAC;IACJ,CAAC;IAED,iBAAiB,CAAC,cAA8B;QAC9C,OAAO,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;IACnD,CAAC;IAED,4BAA4B,CAC1B,cAA8B;QAE9B,OAAO,IAAI,CAAC,+BAA+B,CAAC,cAAc,CAAC,CAAC;IAC9D,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 { getStringFromEnv } from '@opentelemetry/core';\nimport {\n AggregationTemporality,\n AggregationTemporalitySelector,\n InstrumentType,\n PushMetricExporter,\n ResourceMetrics,\n AggregationSelector,\n AggregationOption,\n AggregationType,\n} from '@opentelemetry/sdk-metrics';\nimport {\n AggregationTemporalityPreference,\n OTLPMetricExporterOptions,\n} from './OTLPMetricExporterOptions';\nimport {\n IOtlpExportDelegate,\n OTLPExporterBase,\n} from '@opentelemetry/otlp-exporter-base';\nimport { diag } from '@opentelemetry/api';\n\nexport const CumulativeTemporalitySelector: AggregationTemporalitySelector =\n () => AggregationTemporality.CUMULATIVE;\n\nexport const DeltaTemporalitySelector: AggregationTemporalitySelector = (\n instrumentType: InstrumentType\n) => {\n switch (instrumentType) {\n case InstrumentType.COUNTER:\n case InstrumentType.OBSERVABLE_COUNTER:\n case InstrumentType.GAUGE:\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\nexport const LowMemoryTemporalitySelector: AggregationTemporalitySelector = (\n instrumentType: InstrumentType\n) => {\n switch (instrumentType) {\n case InstrumentType.COUNTER:\n case InstrumentType.HISTOGRAM:\n return AggregationTemporality.DELTA;\n case InstrumentType.GAUGE:\n case InstrumentType.UP_DOWN_COUNTER:\n case InstrumentType.OBSERVABLE_UP_DOWN_COUNTER:\n case InstrumentType.OBSERVABLE_COUNTER:\n case InstrumentType.OBSERVABLE_GAUGE:\n return AggregationTemporality.CUMULATIVE;\n }\n};\n\nfunction chooseTemporalitySelectorFromEnvironment() {\n const configuredTemporality = (\n getStringFromEnv('OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE') ??\n 'cumulative'\n ).toLowerCase();\n\n if (configuredTemporality === 'cumulative') {\n return CumulativeTemporalitySelector;\n }\n if (configuredTemporality === 'delta') {\n return DeltaTemporalitySelector;\n }\n if (configuredTemporality === 'lowmemory') {\n return LowMemoryTemporalitySelector;\n }\n\n diag.warn(\n `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${configuredTemporality}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`\n );\n return CumulativeTemporalitySelector;\n}\n\nfunction chooseTemporalitySelector(\n temporalityPreference?:\n | AggregationTemporalityPreference\n | AggregationTemporality\n): AggregationTemporalitySelector {\n // Directly passed preference has priority.\n if (temporalityPreference != null) {\n if (temporalityPreference === AggregationTemporalityPreference.DELTA) {\n return DeltaTemporalitySelector;\n } else if (\n temporalityPreference === AggregationTemporalityPreference.LOWMEMORY\n ) {\n return LowMemoryTemporalitySelector;\n }\n return CumulativeTemporalitySelector;\n }\n\n return chooseTemporalitySelectorFromEnvironment();\n}\n\nconst DEFAULT_AGGREGATION = Object.freeze({\n type: AggregationType.DEFAULT,\n});\n\nfunction chooseAggregationSelector(\n config: OTLPMetricExporterOptions | undefined\n): AggregationSelector {\n return config?.aggregationPreference ?? (() => DEFAULT_AGGREGATION);\n}\n\nexport class OTLPMetricExporterBase\n extends OTLPExporterBase<ResourceMetrics>\n implements PushMetricExporter\n{\n private readonly _aggregationTemporalitySelector: AggregationTemporalitySelector;\n private readonly _aggregationSelector: AggregationSelector;\n\n constructor(\n delegate: IOtlpExportDelegate<ResourceMetrics>,\n config?: OTLPMetricExporterOptions\n ) {\n super(delegate);\n this._aggregationSelector = chooseAggregationSelector(config);\n this._aggregationTemporalitySelector = chooseTemporalitySelector(\n config?.temporalityPreference\n );\n }\n\n selectAggregation(instrumentType: InstrumentType): AggregationOption {\n return this._aggregationSelector(instrumentType);\n }\n\n selectAggregationTemporality(\n instrumentType: InstrumentType\n ): AggregationTemporality {\n return this._aggregationTemporalitySelector(instrumentType);\n }\n}\n"]}
@@ -13,33 +13,15 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- var __extends = (this && this.__extends) || (function () {
17
- var extendStatics = function (d, b) {
18
- extendStatics = Object.setPrototypeOf ||
19
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
20
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
21
- return extendStatics(d, b);
22
- };
23
- return function (d, b) {
24
- if (typeof b !== "function" && b !== null)
25
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
26
- extendStatics(d, b);
27
- function __() { this.constructor = d; }
28
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
29
- };
30
- })();
31
16
  import { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';
32
17
  import { JsonMetricsSerializer } from '@opentelemetry/otlp-transformer';
33
18
  import { createLegacyOtlpBrowserExportDelegate } from '@opentelemetry/otlp-exporter-base/browser-http';
34
19
  /**
35
20
  * Collector Metric Exporter for Web
36
21
  */
37
- var OTLPMetricExporter = /** @class */ (function (_super) {
38
- __extends(OTLPMetricExporter, _super);
39
- function OTLPMetricExporter(config) {
40
- return _super.call(this, createLegacyOtlpBrowserExportDelegate(config !== null && config !== void 0 ? config : {}, JsonMetricsSerializer, 'v1/metrics', { 'Content-Type': 'application/json' }), config) || this;
22
+ export class OTLPMetricExporter extends OTLPMetricExporterBase {
23
+ constructor(config) {
24
+ super(createLegacyOtlpBrowserExportDelegate(config ?? {}, JsonMetricsSerializer, 'v1/metrics', { 'Content-Type': 'application/json' }), config);
41
25
  }
42
- return OTLPMetricExporter;
43
- }(OTLPMetricExporterBase));
44
- export { OTLPMetricExporter };
26
+ }
45
27
  //# sourceMappingURL=OTLPMetricExporter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../../../src/platform/browser/OTLPMetricExporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;AAGH,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AAEvG;;GAEG;AACH;IAAwC,sCAAsB;IAC5D,4BAAY,MAA2D;eACrE,kBACE,qCAAqC,CACnC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,EACZ,qBAAqB,EACrB,YAAY,EACZ,EAAE,cAAc,EAAE,kBAAkB,EAAE,CACvC,EACD,MAAM,CACP;IACH,CAAC;IACH,yBAAC;AAAD,CAAC,AAZD,CAAwC,sBAAsB,GAY7D","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 { OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions';\nimport { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';\nimport { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base';\nimport { JsonMetricsSerializer } from '@opentelemetry/otlp-transformer';\nimport { createLegacyOtlpBrowserExportDelegate } from '@opentelemetry/otlp-exporter-base/browser-http';\n\n/**\n * Collector Metric Exporter for Web\n */\nexport class OTLPMetricExporter extends OTLPMetricExporterBase {\n constructor(config?: OTLPExporterConfigBase & OTLPMetricExporterOptions) {\n super(\n createLegacyOtlpBrowserExportDelegate(\n config ?? {},\n JsonMetricsSerializer,\n 'v1/metrics',\n { 'Content-Type': 'application/json' }\n ),\n config\n );\n }\n}\n"]}
1
+ {"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../../../src/platform/browser/OTLPMetricExporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AAEvG;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,sBAAsB;IAC5D,YAAY,MAA2D;QACrE,KAAK,CACH,qCAAqC,CACnC,MAAM,IAAI,EAAE,EACZ,qBAAqB,EACrB,YAAY,EACZ,EAAE,cAAc,EAAE,kBAAkB,EAAE,CACvC,EACD,MAAM,CACP,CAAC;IACJ,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 { OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions';\nimport { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';\nimport { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base';\nimport { JsonMetricsSerializer } from '@opentelemetry/otlp-transformer';\nimport { createLegacyOtlpBrowserExportDelegate } from '@opentelemetry/otlp-exporter-base/browser-http';\n\n/**\n * Collector Metric Exporter for Web\n */\nexport class OTLPMetricExporter extends OTLPMetricExporterBase {\n constructor(config?: OTLPExporterConfigBase & OTLPMetricExporterOptions) {\n super(\n createLegacyOtlpBrowserExportDelegate(\n config ?? {},\n JsonMetricsSerializer,\n 'v1/metrics',\n { 'Content-Type': 'application/json' }\n ),\n config\n );\n }\n}\n"]}
@@ -13,48 +13,22 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- var __extends = (this && this.__extends) || (function () {
17
- var extendStatics = function (d, b) {
18
- extendStatics = Object.setPrototypeOf ||
19
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
20
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
21
- return extendStatics(d, b);
22
- };
23
- return function (d, b) {
24
- if (typeof b !== "function" && b !== null)
25
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
26
- extendStatics(d, b);
27
- function __() { this.constructor = d; }
28
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
29
- };
30
- })();
31
- var __assign = (this && this.__assign) || function () {
32
- __assign = Object.assign || function(t) {
33
- for (var s, i = 1, n = arguments.length; i < n; i++) {
34
- s = arguments[i];
35
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
36
- t[p] = s[p];
37
- }
38
- return t;
39
- };
40
- return __assign.apply(this, arguments);
41
- };
42
16
  import { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';
43
17
  import { JsonMetricsSerializer } from '@opentelemetry/otlp-transformer';
44
18
  import { VERSION } from '../../version';
45
19
  import { convertLegacyHttpOptions, createOtlpHttpExportDelegate, } from '@opentelemetry/otlp-exporter-base/node-http';
46
- var USER_AGENT = {
47
- 'User-Agent': "OTel-OTLP-Exporter-JavaScript/" + VERSION,
20
+ const USER_AGENT = {
21
+ 'User-Agent': `OTel-OTLP-Exporter-JavaScript/${VERSION}`,
48
22
  };
49
23
  /**
50
24
  * OTLP Metric Exporter for Node.js
51
25
  */
52
- var OTLPMetricExporter = /** @class */ (function (_super) {
53
- __extends(OTLPMetricExporter, _super);
54
- function OTLPMetricExporter(config) {
55
- return _super.call(this, createOtlpHttpExportDelegate(convertLegacyHttpOptions(config !== null && config !== void 0 ? config : {}, 'METRICS', 'v1/metrics', __assign(__assign({}, USER_AGENT), { 'Content-Type': 'application/json' })), JsonMetricsSerializer), config) || this;
26
+ export class OTLPMetricExporter extends OTLPMetricExporterBase {
27
+ constructor(config) {
28
+ super(createOtlpHttpExportDelegate(convertLegacyHttpOptions(config ?? {}, 'METRICS', 'v1/metrics', {
29
+ ...USER_AGENT,
30
+ 'Content-Type': 'application/json',
31
+ }), JsonMetricsSerializer), config);
56
32
  }
57
- return OTLPMetricExporter;
58
- }(OTLPMetricExporterBase));
59
- export { OTLPMetricExporter };
33
+ }
60
34
  //# sourceMappingURL=OTLPMetricExporter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../../../src/platform/node/OTLPMetricExporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EACL,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,6CAA6C,CAAC;AAErD,IAAM,UAAU,GAAG;IACjB,YAAY,EAAE,mCAAiC,OAAS;CACzD,CAAC;AAEF;;GAEG;AACH;IAAwC,sCAAsB;IAC5D,4BAAY,MAA+D;eACzE,kBACE,4BAA4B,CAC1B,wBAAwB,CAAC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,EAAE,SAAS,EAAE,YAAY,wBACzD,UAAU,KACb,cAAc,EAAE,kBAAkB,IAClC,EACF,qBAAqB,CACtB,EACD,MAAM,CACP;IACH,CAAC;IACH,yBAAC;AAAD,CAAC,AAbD,CAAwC,sBAAsB,GAa7D","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 { OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions';\nimport { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';\nimport { OTLPExporterNodeConfigBase } from '@opentelemetry/otlp-exporter-base';\nimport { JsonMetricsSerializer } from '@opentelemetry/otlp-transformer';\nimport { VERSION } from '../../version';\nimport {\n convertLegacyHttpOptions,\n createOtlpHttpExportDelegate,\n} from '@opentelemetry/otlp-exporter-base/node-http';\n\nconst USER_AGENT = {\n 'User-Agent': `OTel-OTLP-Exporter-JavaScript/${VERSION}`,\n};\n\n/**\n * OTLP Metric Exporter for Node.js\n */\nexport class OTLPMetricExporter extends OTLPMetricExporterBase {\n constructor(config?: OTLPExporterNodeConfigBase & OTLPMetricExporterOptions) {\n super(\n createOtlpHttpExportDelegate(\n convertLegacyHttpOptions(config ?? {}, 'METRICS', 'v1/metrics', {\n ...USER_AGENT,\n 'Content-Type': 'application/json',\n }),\n JsonMetricsSerializer\n ),\n config\n );\n }\n}\n"]}
1
+ {"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../../../src/platform/node/OTLPMetricExporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EACL,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,6CAA6C,CAAC;AAErD,MAAM,UAAU,GAAG;IACjB,YAAY,EAAE,iCAAiC,OAAO,EAAE;CACzD,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,sBAAsB;IAC5D,YAAY,MAA+D;QACzE,KAAK,CACH,4BAA4B,CAC1B,wBAAwB,CAAC,MAAM,IAAI,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE;YAC9D,GAAG,UAAU;YACb,cAAc,EAAE,kBAAkB;SACnC,CAAC,EACF,qBAAqB,CACtB,EACD,MAAM,CACP,CAAC;IACJ,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 { OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions';\nimport { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';\nimport { OTLPExporterNodeConfigBase } from '@opentelemetry/otlp-exporter-base';\nimport { JsonMetricsSerializer } from '@opentelemetry/otlp-transformer';\nimport { VERSION } from '../../version';\nimport {\n convertLegacyHttpOptions,\n createOtlpHttpExportDelegate,\n} from '@opentelemetry/otlp-exporter-base/node-http';\n\nconst USER_AGENT = {\n 'User-Agent': `OTel-OTLP-Exporter-JavaScript/${VERSION}`,\n};\n\n/**\n * OTLP Metric Exporter for Node.js\n */\nexport class OTLPMetricExporter extends OTLPMetricExporterBase {\n constructor(config?: OTLPExporterNodeConfigBase & OTLPMetricExporterOptions) {\n super(\n createOtlpHttpExportDelegate(\n convertLegacyHttpOptions(config ?? {}, 'METRICS', 'v1/metrics', {\n ...USER_AGENT,\n 'Content-Type': 'application/json',\n }),\n JsonMetricsSerializer\n ),\n config\n );\n }\n}\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.57.2";
1
+ export declare const VERSION = "0.200.0-dev.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -14,5 +14,5 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  // this is autogenerated file, see scripts/version-update.js
17
- export var VERSION = '0.57.2';
17
+ export const VERSION = '0.200.0-dev.0';
18
18
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,IAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.57.2';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,OAAO,GAAG,eAAe,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.200.0-dev.0';\n"]}
@@ -1,4 +1,4 @@
1
- import { AggregationTemporality, AggregationTemporalitySelector, InstrumentType, PushMetricExporter, ResourceMetrics, Aggregation } from '@opentelemetry/sdk-metrics';
1
+ import { AggregationTemporality, AggregationTemporalitySelector, InstrumentType, PushMetricExporter, ResourceMetrics, AggregationOption } from '@opentelemetry/sdk-metrics';
2
2
  import { OTLPMetricExporterOptions } from './OTLPMetricExporterOptions';
3
3
  import { IOtlpExportDelegate, OTLPExporterBase } from '@opentelemetry/otlp-exporter-base';
4
4
  export declare const CumulativeTemporalitySelector: AggregationTemporalitySelector;
@@ -8,7 +8,7 @@ export declare class OTLPMetricExporterBase extends OTLPExporterBase<ResourceMet
8
8
  private readonly _aggregationTemporalitySelector;
9
9
  private readonly _aggregationSelector;
10
10
  constructor(delegate: IOtlpExportDelegate<ResourceMetrics>, config?: OTLPMetricExporterOptions);
11
- selectAggregation(instrumentType: InstrumentType): Aggregation;
11
+ selectAggregation(instrumentType: InstrumentType): AggregationOption;
12
12
  selectAggregationTemporality(instrumentType: InstrumentType): AggregationTemporality;
13
13
  }
14
14
  //# sourceMappingURL=OTLPMetricExporterBase.d.ts.map
@@ -13,8 +13,8 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { getEnv } from '@opentelemetry/core';
17
- import { AggregationTemporality, InstrumentType, Aggregation, } from '@opentelemetry/sdk-metrics';
16
+ import { getStringFromEnv } from '@opentelemetry/core';
17
+ import { AggregationTemporality, InstrumentType, AggregationType, } from '@opentelemetry/sdk-metrics';
18
18
  import { AggregationTemporalityPreference, } from './OTLPMetricExporterOptions';
19
19
  import { OTLPExporterBase, } from '@opentelemetry/otlp-exporter-base';
20
20
  import { diag } from '@opentelemetry/api';
@@ -46,8 +46,8 @@ export const LowMemoryTemporalitySelector = (instrumentType) => {
46
46
  }
47
47
  };
48
48
  function chooseTemporalitySelectorFromEnvironment() {
49
- const env = getEnv();
50
- const configuredTemporality = env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE.trim().toLowerCase();
49
+ const configuredTemporality = (getStringFromEnv('OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE') ??
50
+ 'cumulative').toLowerCase();
51
51
  if (configuredTemporality === 'cumulative') {
52
52
  return CumulativeTemporalitySelector;
53
53
  }
@@ -57,7 +57,7 @@ function chooseTemporalitySelectorFromEnvironment() {
57
57
  if (configuredTemporality === 'lowmemory') {
58
58
  return LowMemoryTemporalitySelector;
59
59
  }
60
- diag.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`);
60
+ diag.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${configuredTemporality}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`);
61
61
  return CumulativeTemporalitySelector;
62
62
  }
63
63
  function chooseTemporalitySelector(temporalityPreference) {
@@ -73,19 +73,19 @@ function chooseTemporalitySelector(temporalityPreference) {
73
73
  }
74
74
  return chooseTemporalitySelectorFromEnvironment();
75
75
  }
76
+ const DEFAULT_AGGREGATION = Object.freeze({
77
+ type: AggregationType.DEFAULT,
78
+ });
76
79
  function chooseAggregationSelector(config) {
77
- if (config === null || config === void 0 ? void 0 : config.aggregationPreference) {
78
- return config.aggregationPreference;
79
- }
80
- else {
81
- return (_instrumentType) => Aggregation.Default();
82
- }
80
+ return config?.aggregationPreference ?? (() => DEFAULT_AGGREGATION);
83
81
  }
84
82
  export class OTLPMetricExporterBase extends OTLPExporterBase {
83
+ _aggregationTemporalitySelector;
84
+ _aggregationSelector;
85
85
  constructor(delegate, config) {
86
86
  super(delegate);
87
87
  this._aggregationSelector = chooseAggregationSelector(config);
88
- this._aggregationTemporalitySelector = chooseTemporalitySelector(config === null || config === void 0 ? void 0 : config.temporalityPreference);
88
+ this._aggregationTemporalitySelector = chooseTemporalitySelector(config?.temporalityPreference);
89
89
  }
90
90
  selectAggregation(instrumentType) {
91
91
  return this._aggregationSelector(instrumentType);
@@ -1 +1 @@
1
- {"version":3,"file":"OTLPMetricExporterBase.js","sourceRoot":"","sources":["../../src/OTLPMetricExporterBase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EACL,sBAAsB,EAEtB,cAAc,EAGd,WAAW,GAEZ,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,gCAAgC,GAEjC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,gBAAgB,GACjB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,MAAM,CAAC,MAAM,6BAA6B,GACxC,GAAG,EAAE,CAAC,sBAAsB,CAAC,UAAU,CAAC;AAE1C,MAAM,CAAC,MAAM,wBAAwB,GAAmC,CACtE,cAA8B,EAC9B,EAAE;IACF,QAAQ,cAAc,EAAE;QACtB,KAAK,cAAc,CAAC,OAAO,CAAC;QAC5B,KAAK,cAAc,CAAC,kBAAkB,CAAC;QACvC,KAAK,cAAc,CAAC,KAAK,CAAC;QAC1B,KAAK,cAAc,CAAC,SAAS,CAAC;QAC9B,KAAK,cAAc,CAAC,gBAAgB;YAClC,OAAO,sBAAsB,CAAC,KAAK,CAAC;QACtC,KAAK,cAAc,CAAC,eAAe,CAAC;QACpC,KAAK,cAAc,CAAC,0BAA0B;YAC5C,OAAO,sBAAsB,CAAC,UAAU,CAAC;KAC5C;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAmC,CAC1E,cAA8B,EAC9B,EAAE;IACF,QAAQ,cAAc,EAAE;QACtB,KAAK,cAAc,CAAC,OAAO,CAAC;QAC5B,KAAK,cAAc,CAAC,SAAS;YAC3B,O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;SAAM;QACL,OAAO,CAAC,eAAoB,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;KACxD;AACH,CAAC;AAED,MAAM,OAAO,sBACX,SAAQ,gBAAiC;IAMzC,YACE,QAA8C,EAC9C,MAAkC;QAElC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChB,IAAI,CAAC,oBAAoB,GAAG,yBAAyB,CAAC,MAAM,CAAC,CAAC;QAC9D,IAAI,CAAC,+BAA+B,GAAG,yBAAyB,CAC9D,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,qBAAqB,CAC9B,CAAC;IACJ,CAAC;IAED,iBAAiB,CAAC,cAA8B;QAC9C,OAAO,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;IACnD,CAAC;IAED,4BAA4B,CAC1B,cAA8B;QAE9B,OAAO,IAAI,CAAC,+BAA+B,CAAC,cAAc,CAAC,CAAC;IAC9D,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 { getEnv } from '@opentelemetry/core';\nimport {\n AggregationTemporality,\n AggregationTemporalitySelector,\n InstrumentType,\n PushMetricExporter,\n ResourceMetrics,\n Aggregation,\n AggregationSelector,\n} from '@opentelemetry/sdk-metrics';\nimport {\n AggregationTemporalityPreference,\n OTLPMetricExporterOptions,\n} from './OTLPMetricExporterOptions';\nimport {\n IOtlpExportDelegate,\n OTLPExporterBase,\n} from '@opentelemetry/otlp-exporter-base';\nimport { diag } from '@opentelemetry/api';\n\nexport const CumulativeTemporalitySelector: AggregationTemporalitySelector =\n () => AggregationTemporality.CUMULATIVE;\n\nexport const DeltaTemporalitySelector: AggregationTemporalitySelector = (\n instrumentType: InstrumentType\n) => {\n switch (instrumentType) {\n case InstrumentType.COUNTER:\n case InstrumentType.OBSERVABLE_COUNTER:\n case InstrumentType.GAUGE:\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\nexport const LowMemoryTemporalitySelector: AggregationTemporalitySelector = (\n instrumentType: InstrumentType\n) => {\n switch (instrumentType) {\n case InstrumentType.COUNTER:\n case InstrumentType.HISTOGRAM:\n return AggregationTemporality.DELTA;\n case InstrumentType.GAUGE:\n case InstrumentType.UP_DOWN_COUNTER:\n case InstrumentType.OBSERVABLE_UP_DOWN_COUNTER:\n case InstrumentType.OBSERVABLE_COUNTER:\n case InstrumentType.OBSERVABLE_GAUGE:\n return AggregationTemporality.CUMULATIVE;\n }\n};\n\nfunction chooseTemporalitySelectorFromEnvironment() {\n const env = getEnv();\n const configuredTemporality =\n env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE.trim().toLowerCase();\n\n if (configuredTemporality === 'cumulative') {\n return CumulativeTemporalitySelector;\n }\n if (configuredTemporality === 'delta') {\n return DeltaTemporalitySelector;\n }\n if (configuredTemporality === 'lowmemory') {\n return LowMemoryTemporalitySelector;\n }\n\n diag.warn(\n `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`\n );\n return CumulativeTemporalitySelector;\n}\n\nfunction chooseTemporalitySelector(\n temporalityPreference?:\n | AggregationTemporalityPreference\n | AggregationTemporality\n): AggregationTemporalitySelector {\n // Directly passed preference has priority.\n if (temporalityPreference != null) {\n if (temporalityPreference === AggregationTemporalityPreference.DELTA) {\n return DeltaTemporalitySelector;\n } else if (\n temporalityPreference === AggregationTemporalityPreference.LOWMEMORY\n ) {\n return LowMemoryTemporalitySelector;\n }\n return CumulativeTemporalitySelector;\n }\n\n return chooseTemporalitySelectorFromEnvironment();\n}\n\nfunction chooseAggregationSelector(\n config: OTLPMetricExporterOptions | undefined\n) {\n if (config?.aggregationPreference) {\n return config.aggregationPreference;\n } else {\n return (_instrumentType: any) => Aggregation.Default();\n }\n}\n\nexport class OTLPMetricExporterBase\n extends OTLPExporterBase<ResourceMetrics>\n implements PushMetricExporter\n{\n private readonly _aggregationTemporalitySelector: AggregationTemporalitySelector;\n private readonly _aggregationSelector: AggregationSelector;\n\n constructor(\n delegate: IOtlpExportDelegate<ResourceMetrics>,\n config?: OTLPMetricExporterOptions\n ) {\n super(delegate);\n this._aggregationSelector = chooseAggregationSelector(config);\n this._aggregationTemporalitySelector = chooseTemporalitySelector(\n config?.temporalityPreference\n );\n }\n\n selectAggregation(instrumentType: InstrumentType): Aggregation {\n return this._aggregationSelector(instrumentType);\n }\n\n selectAggregationTemporality(\n instrumentType: InstrumentType\n ): AggregationTemporality {\n return this._aggregationTemporalitySelector(instrumentType);\n }\n}\n"]}
1
+ {"version":3,"file":"OTLPMetricExporterBase.js","sourceRoot":"","sources":["../../src/OTLPMetricExporterBase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EACL,sBAAsB,EAEtB,cAAc,EAKd,eAAe,GAChB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,gCAAgC,GAEjC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,gBAAgB,GACjB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,MAAM,CAAC,MAAM,6BAA6B,GAC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esContent":["/*\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 { getStringFromEnv } from '@opentelemetry/core';\nimport {\n AggregationTemporality,\n AggregationTemporalitySelector,\n InstrumentType,\n PushMetricExporter,\n ResourceMetrics,\n AggregationSelector,\n AggregationOption,\n AggregationType,\n} from '@opentelemetry/sdk-metrics';\nimport {\n AggregationTemporalityPreference,\n OTLPMetricExporterOptions,\n} from './OTLPMetricExporterOptions';\nimport {\n IOtlpExportDelegate,\n OTLPExporterBase,\n} from '@opentelemetry/otlp-exporter-base';\nimport { diag } from '@opentelemetry/api';\n\nexport const CumulativeTemporalitySelector: AggregationTemporalitySelector =\n () => AggregationTemporality.CUMULATIVE;\n\nexport const DeltaTemporalitySelector: AggregationTemporalitySelector = (\n instrumentType: InstrumentType\n) => {\n switch (instrumentType) {\n case InstrumentType.COUNTER:\n case InstrumentType.OBSERVABLE_COUNTER:\n case InstrumentType.GAUGE:\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\nexport const LowMemoryTemporalitySelector: AggregationTemporalitySelector = (\n instrumentType: InstrumentType\n) => {\n switch (instrumentType) {\n case InstrumentType.COUNTER:\n case InstrumentType.HISTOGRAM:\n return AggregationTemporality.DELTA;\n case InstrumentType.GAUGE:\n case InstrumentType.UP_DOWN_COUNTER:\n case InstrumentType.OBSERVABLE_UP_DOWN_COUNTER:\n case InstrumentType.OBSERVABLE_COUNTER:\n case InstrumentType.OBSERVABLE_GAUGE:\n return AggregationTemporality.CUMULATIVE;\n }\n};\n\nfunction chooseTemporalitySelectorFromEnvironment() {\n const configuredTemporality = (\n getStringFromEnv('OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE') ??\n 'cumulative'\n ).toLowerCase();\n\n if (configuredTemporality === 'cumulative') {\n return CumulativeTemporalitySelector;\n }\n if (configuredTemporality === 'delta') {\n return DeltaTemporalitySelector;\n }\n if (configuredTemporality === 'lowmemory') {\n return LowMemoryTemporalitySelector;\n }\n\n diag.warn(\n `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${configuredTemporality}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`\n );\n return CumulativeTemporalitySelector;\n}\n\nfunction chooseTemporalitySelector(\n temporalityPreference?:\n | AggregationTemporalityPreference\n | AggregationTemporality\n): AggregationTemporalitySelector {\n // Directly passed preference has priority.\n if (temporalityPreference != null) {\n if (temporalityPreference === AggregationTemporalityPreference.DELTA) {\n return DeltaTemporalitySelector;\n } else if (\n temporalityPreference === AggregationTemporalityPreference.LOWMEMORY\n ) {\n return LowMemoryTemporalitySelector;\n }\n return CumulativeTemporalitySelector;\n }\n\n return chooseTemporalitySelectorFromEnvironment();\n}\n\nconst DEFAULT_AGGREGATION = Object.freeze({\n type: AggregationType.DEFAULT,\n});\n\nfunction chooseAggregationSelector(\n config: OTLPMetricExporterOptions | undefined\n): AggregationSelector {\n return config?.aggregationPreference ?? (() => DEFAULT_AGGREGATION);\n}\n\nexport class OTLPMetricExporterBase\n extends OTLPExporterBase<ResourceMetrics>\n implements PushMetricExporter\n{\n private readonly _aggregationTemporalitySelector: AggregationTemporalitySelector;\n private readonly _aggregationSelector: AggregationSelector;\n\n constructor(\n delegate: IOtlpExportDelegate<ResourceMetrics>,\n config?: OTLPMetricExporterOptions\n ) {\n super(delegate);\n this._aggregationSelector = chooseAggregationSelector(config);\n this._aggregationTemporalitySelector = chooseTemporalitySelector(\n config?.temporalityPreference\n );\n }\n\n selectAggregation(instrumentType: InstrumentType): AggregationOption {\n return this._aggregationSelector(instrumentType);\n }\n\n selectAggregationTemporality(\n instrumentType: InstrumentType\n ): AggregationTemporality {\n return this._aggregationTemporalitySelector(instrumentType);\n }\n}\n"]}
@@ -21,7 +21,7 @@ import { createLegacyOtlpBrowserExportDelegate } from '@opentelemetry/otlp-expor
21
21
  */
22
22
  export class OTLPMetricExporter extends OTLPMetricExporterBase {
23
23
  constructor(config) {
24
- super(createLegacyOtlpBrowserExportDelegate(config !== null && config !== void 0 ? config : {}, JsonMetricsSerializer, 'v1/metrics', { 'Content-Type': 'application/json' }), config);
24
+ super(createLegacyOtlpBrowserExportDelegate(config ?? {}, JsonMetricsSerializer, 'v1/metrics', { 'Content-Type': 'application/json' }), config);
25
25
  }
26
26
  }
27
27
  //# sourceMappingURL=OTLPMetricExporter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../../../src/platform/browser/OTLPMetricExporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AAEvG;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,sBAAsB;IAC5D,YAAY,MAA2D;QACrE,KAAK,CACH,qCAAqC,CACnC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,EACZ,qBAAqB,EACrB,YAAY,EACZ,EAAE,cAAc,EAAE,kBAAkB,EAAE,CACvC,EACD,MAAM,CACP,CAAC;IACJ,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 { OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions';\nimport { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';\nimport { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base';\nimport { JsonMetricsSerializer } from '@opentelemetry/otlp-transformer';\nimport { createLegacyOtlpBrowserExportDelegate } from '@opentelemetry/otlp-exporter-base/browser-http';\n\n/**\n * Collector Metric Exporter for Web\n */\nexport class OTLPMetricExporter extends OTLPMetricExporterBase {\n constructor(config?: OTLPExporterConfigBase & OTLPMetricExporterOptions) {\n super(\n createLegacyOtlpBrowserExportDelegate(\n config ?? {},\n JsonMetricsSerializer,\n 'v1/metrics',\n { 'Content-Type': 'application/json' }\n ),\n config\n );\n }\n}\n"]}
1
+ {"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../../../src/platform/browser/OTLPMetricExporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AAEvG;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,sBAAsB;IAC5D,YAAY,MAA2D;QACrE,KAAK,CACH,qCAAqC,CACnC,MAAM,IAAI,EAAE,EACZ,qBAAqB,EACrB,YAAY,EACZ,EAAE,cAAc,EAAE,kBAAkB,EAAE,CACvC,EACD,MAAM,CACP,CAAC;IACJ,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 { OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions';\nimport { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';\nimport { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base';\nimport { JsonMetricsSerializer } from '@opentelemetry/otlp-transformer';\nimport { createLegacyOtlpBrowserExportDelegate } from '@opentelemetry/otlp-exporter-base/browser-http';\n\n/**\n * Collector Metric Exporter for Web\n */\nexport class OTLPMetricExporter extends OTLPMetricExporterBase {\n constructor(config?: OTLPExporterConfigBase & OTLPMetricExporterOptions) {\n super(\n createLegacyOtlpBrowserExportDelegate(\n config ?? {},\n JsonMetricsSerializer,\n 'v1/metrics',\n { 'Content-Type': 'application/json' }\n ),\n config\n );\n }\n}\n"]}
@@ -25,7 +25,10 @@ const USER_AGENT = {
25
25
  */
26
26
  export class OTLPMetricExporter extends OTLPMetricExporterBase {
27
27
  constructor(config) {
28
- super(createOtlpHttpExportDelegate(convertLegacyHttpOptions(config !== null && config !== void 0 ? config : {}, 'METRICS', 'v1/metrics', Object.assign(Object.assign({}, USER_AGENT), { 'Content-Type': 'application/json' })), JsonMetricsSerializer), config);
28
+ super(createOtlpHttpExportDelegate(convertLegacyHttpOptions(config ?? {}, 'METRICS', 'v1/metrics', {
29
+ ...USER_AGENT,
30
+ 'Content-Type': 'application/json',
31
+ }), JsonMetricsSerializer), config);
29
32
  }
30
33
  }
31
34
  //# sourceMappingURL=OTLPMetricExporter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../../../src/platform/node/OTLPMetricExporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EACL,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,6CAA6C,CAAC;AAErD,MAAM,UAAU,GAAG;IACjB,YAAY,EAAE,iCAAiC,OAAO,EAAE;CACzD,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,sBAAsB;IAC5D,YAAY,MAA+D;QACzE,KAAK,CACH,4BAA4B,CAC1B,wBAAwB,CAAC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,EAAE,SAAS,EAAE,YAAY,kCACzD,UAAU,KACb,cAAc,EAAE,kBAAkB,IAClC,EACF,qBAAqB,CACtB,EACD,MAAM,CACP,CAAC;IACJ,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 { OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions';\nimport { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';\nimport { OTLPExporterNodeConfigBase } from '@opentelemetry/otlp-exporter-base';\nimport { JsonMetricsSerializer } from '@opentelemetry/otlp-transformer';\nimport { VERSION } from '../../version';\nimport {\n convertLegacyHttpOptions,\n createOtlpHttpExportDelegate,\n} from '@opentelemetry/otlp-exporter-base/node-http';\n\nconst USER_AGENT = {\n 'User-Agent': `OTel-OTLP-Exporter-JavaScript/${VERSION}`,\n};\n\n/**\n * OTLP Metric Exporter for Node.js\n */\nexport class OTLPMetricExporter extends OTLPMetricExporterBase {\n constructor(config?: OTLPExporterNodeConfigBase & OTLPMetricExporterOptions) {\n super(\n createOtlpHttpExportDelegate(\n convertLegacyHttpOptions(config ?? {}, 'METRICS', 'v1/metrics', {\n ...USER_AGENT,\n 'Content-Type': 'application/json',\n }),\n JsonMetricsSerializer\n ),\n config\n );\n }\n}\n"]}
1
+ {"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../../../src/platform/node/OTLPMetricExporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EACL,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,6CAA6C,CAAC;AAErD,MAAM,UAAU,GAAG;IACjB,YAAY,EAAE,iCAAiC,OAAO,EAAE;CACzD,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,sBAAsB;IAC5D,YAAY,MAA+D;QACzE,KAAK,CACH,4BAA4B,CAC1B,wBAAwB,CAAC,MAAM,IAAI,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE;YAC9D,GAAG,UAAU;YACb,cAAc,EAAE,kBAAkB;SACnC,CAAC,EACF,qBAAqB,CACtB,EACD,MAAM,CACP,CAAC;IACJ,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 { OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions';\nimport { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';\nimport { OTLPExporterNodeConfigBase } from '@opentelemetry/otlp-exporter-base';\nimport { JsonMetricsSerializer } from '@opentelemetry/otlp-transformer';\nimport { VERSION } from '../../version';\nimport {\n convertLegacyHttpOptions,\n createOtlpHttpExportDelegate,\n} from '@opentelemetry/otlp-exporter-base/node-http';\n\nconst USER_AGENT = {\n 'User-Agent': `OTel-OTLP-Exporter-JavaScript/${VERSION}`,\n};\n\n/**\n * OTLP Metric Exporter for Node.js\n */\nexport class OTLPMetricExporter extends OTLPMetricExporterBase {\n constructor(config?: OTLPExporterNodeConfigBase & OTLPMetricExporterOptions) {\n super(\n createOtlpHttpExportDelegate(\n convertLegacyHttpOptions(config ?? {}, 'METRICS', 'v1/metrics', {\n ...USER_AGENT,\n 'Content-Type': 'application/json',\n }),\n JsonMetricsSerializer\n ),\n config\n );\n }\n}\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.57.2";
1
+ export declare const VERSION = "0.200.0-dev.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -14,5 +14,5 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  // this is autogenerated file, see scripts/version-update.js
17
- export const VERSION = '0.57.2';
17
+ export const VERSION = '0.200.0-dev.0';
18
18
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,OAAO,GAAG,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.57.2';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,OAAO,GAAG,eAAe,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.200.0-dev.0';\n"]}
@@ -1,4 +1,4 @@
1
- import { AggregationTemporality, AggregationTemporalitySelector, InstrumentType, PushMetricExporter, ResourceMetrics, Aggregation } from '@opentelemetry/sdk-metrics';
1
+ import { AggregationTemporality, AggregationTemporalitySelector, InstrumentType, PushMetricExporter, ResourceMetrics, AggregationOption } from '@opentelemetry/sdk-metrics';
2
2
  import { OTLPMetricExporterOptions } from './OTLPMetricExporterOptions';
3
3
  import { IOtlpExportDelegate, OTLPExporterBase } from '@opentelemetry/otlp-exporter-base';
4
4
  export declare const CumulativeTemporalitySelector: AggregationTemporalitySelector;
@@ -8,7 +8,7 @@ export declare class OTLPMetricExporterBase extends OTLPExporterBase<ResourceMet
8
8
  private readonly _aggregationTemporalitySelector;
9
9
  private readonly _aggregationSelector;
10
10
  constructor(delegate: IOtlpExportDelegate<ResourceMetrics>, config?: OTLPMetricExporterOptions);
11
- selectAggregation(instrumentType: InstrumentType): Aggregation;
11
+ selectAggregation(instrumentType: InstrumentType): AggregationOption;
12
12
  selectAggregationTemporality(instrumentType: InstrumentType): AggregationTemporality;
13
13
  }
14
14
  //# sourceMappingURL=OTLPMetricExporterBase.d.ts.map
@@ -52,8 +52,8 @@ const LowMemoryTemporalitySelector = (instrumentType) => {
52
52
  };
53
53
  exports.LowMemoryTemporalitySelector = LowMemoryTemporalitySelector;
54
54
  function chooseTemporalitySelectorFromEnvironment() {
55
- const env = (0, core_1.getEnv)();
56
- const configuredTemporality = env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE.trim().toLowerCase();
55
+ const configuredTemporality = ((0, core_1.getStringFromEnv)('OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE') ??
56
+ 'cumulative').toLowerCase();
57
57
  if (configuredTemporality === 'cumulative') {
58
58
  return exports.CumulativeTemporalitySelector;
59
59
  }
@@ -63,7 +63,7 @@ function chooseTemporalitySelectorFromEnvironment() {
63
63
  if (configuredTemporality === 'lowmemory') {
64
64
  return exports.LowMemoryTemporalitySelector;
65
65
  }
66
- api_1.diag.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`);
66
+ api_1.diag.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${configuredTemporality}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`);
67
67
  return exports.CumulativeTemporalitySelector;
68
68
  }
69
69
  function chooseTemporalitySelector(temporalityPreference) {
@@ -79,19 +79,19 @@ function chooseTemporalitySelector(temporalityPreference) {
79
79
  }
80
80
  return chooseTemporalitySelectorFromEnvironment();
81
81
  }
82
+ const DEFAULT_AGGREGATION = Object.freeze({
83
+ type: sdk_metrics_1.AggregationType.DEFAULT,
84
+ });
82
85
  function chooseAggregationSelector(config) {
83
- if (config === null || config === void 0 ? void 0 : config.aggregationPreference) {
84
- return config.aggregationPreference;
85
- }
86
- else {
87
- return (_instrumentType) => sdk_metrics_1.Aggregation.Default();
88
- }
86
+ return config?.aggregationPreference ?? (() => DEFAULT_AGGREGATION);
89
87
  }
90
88
  class OTLPMetricExporterBase extends otlp_exporter_base_1.OTLPExporterBase {
89
+ _aggregationTemporalitySelector;
90
+ _aggregationSelector;
91
91
  constructor(delegate, config) {
92
92
  super(delegate);
93
93
  this._aggregationSelector = chooseAggregationSelector(config);
94
- this._aggregationTemporalitySelector = chooseTemporalitySelector(config === null || config === void 0 ? void 0 : config.temporalityPreference);
94
+ this._aggregationTemporalitySelector = chooseTemporalitySelector(config?.temporalityPreference);
95
95
  }
96
96
  selectAggregation(instrumentType) {
97
97
  return this._aggregationSelector(instrumentType);
@@ -1 +1 @@
1
- {"version":3,"file":"OTLPMetricExporterBase.js","sourceRoot":"","sources":["../../src/OTLPMetricExporterBase.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,8CAA6C;AAC7C,4DAQoC;AACpC,2EAGqC;AACrC,0EAG2C;AAC3C,4CAA0C;AAEnC,MAAM,6BAA6B,GACxC,GAAG,EAAE,CAAC,oCAAsB,CAAC,UAAU,CAAC;AAD7B,QAAA,6BAA6B,iCACA;AAEnC,MAAM,wBAAwB,GAAmC,CACtE,cAA8B,EAC9B,EAAE;IACF,QAAQ,cAAc,EAAE;QACtB,KAAK,4BAAc,CAAC,OAAO,CAAC;QAC5B,KAAK,4BAAc,CAAC,kBAAkB,CAAC;QACvC,KAAK,4BAAc,CAAC,KAAK,CAAC;QAC1B,KAAK,4BAAc,CAAC,SAAS,CAAC;QAC9B,KAAK,4BAAc,CAAC,gBAAgB;YAClC,OAAO,oCAAsB,CAAC,KAAK,CAAC;QACtC,KAAK,4BA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AC,KAAK,EAAE;YACpE,OAAO,gCAAwB,CAAC;SACjC;aAAM,IACL,qBAAqB,KAAK,4DAAgC,CAAC,SAAS,EACpE;YACA,OAAO,oCAA4B,CAAC;SACrC;QACD,OAAO,qCAA6B,CAAC;KACtC;IAED,OAAO,wCAAwC,EAAE,CAAC;AACpD,CAAC;AAED,SAAS,yBAAyB,CAChC,MAA6C;IAE7C,IAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,qBAAqB,EAAE;QACjC,OAAO,MAAM,CAAC,qBAAqB,CAAC;KACrC;SAAM;QACL,OAAO,CAAC,eAAoB,EAAE,EAAE,CAAC,yBAAW,CAAC,OAAO,EAAE,CAAC;KACxD;AACH,CAAC;AAED,MAAa,sBACX,SAAQ,qCAAiC;IAMzC,YACE,QAA8C,EAC9C,MAAkC;QAElC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChB,IAAI,CAAC,oBAAoB,GAAG,yBAAyB,CAAC,MAAM,CAAC,CAAC;QAC9D,IAAI,CAAC,+BAA+B,GAAG,yBAAyB,CAC9D,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,qBAAqB,CAC9B,CAAC;IACJ,CAAC;IAED,iBAAiB,CAAC,cAA8B;QAC9C,OAAO,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;IACnD,CAAC;IAED,4BAA4B,CAC1B,cAA8B;QAE9B,OAAO,IAAI,CAAC,+BAA+B,CAAC,cAAc,CAAC,CAAC;IAC9D,CAAC;CACF;AA3BD,wDA2BC","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 { getEnv } from '@opentelemetry/core';\nimport {\n AggregationTemporality,\n AggregationTemporalitySelector,\n InstrumentType,\n PushMetricExporter,\n ResourceMetrics,\n Aggregation,\n AggregationSelector,\n} from '@opentelemetry/sdk-metrics';\nimport {\n AggregationTemporalityPreference,\n OTLPMetricExporterOptions,\n} from './OTLPMetricExporterOptions';\nimport {\n IOtlpExportDelegate,\n OTLPExporterBase,\n} from '@opentelemetry/otlp-exporter-base';\nimport { diag } from '@opentelemetry/api';\n\nexport const CumulativeTemporalitySelector: AggregationTemporalitySelector =\n () => AggregationTemporality.CUMULATIVE;\n\nexport const DeltaTemporalitySelector: AggregationTemporalitySelector = (\n instrumentType: InstrumentType\n) => {\n switch (instrumentType) {\n case InstrumentType.COUNTER:\n case InstrumentType.OBSERVABLE_COUNTER:\n case InstrumentType.GAUGE:\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\nexport const LowMemoryTemporalitySelector: AggregationTemporalitySelector = (\n instrumentType: InstrumentType\n) => {\n switch (instrumentType) {\n case InstrumentType.COUNTER:\n case InstrumentType.HISTOGRAM:\n return AggregationTemporality.DELTA;\n case InstrumentType.GAUGE:\n case InstrumentType.UP_DOWN_COUNTER:\n case InstrumentType.OBSERVABLE_UP_DOWN_COUNTER:\n case InstrumentType.OBSERVABLE_COUNTER:\n case InstrumentType.OBSERVABLE_GAUGE:\n return AggregationTemporality.CUMULATIVE;\n }\n};\n\nfunction chooseTemporalitySelectorFromEnvironment() {\n const env = getEnv();\n const configuredTemporality =\n env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE.trim().toLowerCase();\n\n if (configuredTemporality === 'cumulative') {\n return CumulativeTemporalitySelector;\n }\n if (configuredTemporality === 'delta') {\n return DeltaTemporalitySelector;\n }\n if (configuredTemporality === 'lowmemory') {\n return LowMemoryTemporalitySelector;\n }\n\n diag.warn(\n `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`\n );\n return CumulativeTemporalitySelector;\n}\n\nfunction chooseTemporalitySelector(\n temporalityPreference?:\n | AggregationTemporalityPreference\n | AggregationTemporality\n): AggregationTemporalitySelector {\n // Directly passed preference has priority.\n if (temporalityPreference != null) {\n if (temporalityPreference === AggregationTemporalityPreference.DELTA) {\n return DeltaTemporalitySelector;\n } else if (\n temporalityPreference === AggregationTemporalityPreference.LOWMEMORY\n ) {\n return LowMemoryTemporalitySelector;\n }\n return CumulativeTemporalitySelector;\n }\n\n return chooseTemporalitySelectorFromEnvironment();\n}\n\nfunction chooseAggregationSelector(\n config: OTLPMetricExporterOptions | undefined\n) {\n if (config?.aggregationPreference) {\n return config.aggregationPreference;\n } else {\n return (_instrumentType: any) => Aggregation.Default();\n }\n}\n\nexport class OTLPMetricExporterBase\n extends OTLPExporterBase<ResourceMetrics>\n implements PushMetricExporter\n{\n private readonly _aggregationTemporalitySelector: AggregationTemporalitySelector;\n private readonly _aggregationSelector: AggregationSelector;\n\n constructor(\n delegate: IOtlpExportDelegate<ResourceMetrics>,\n config?: OTLPMetricExporterOptions\n ) {\n super(delegate);\n this._aggregationSelector = chooseAggregationSelector(config);\n this._aggregationTemporalitySelector = chooseTemporalitySelector(\n config?.temporalityPreference\n );\n }\n\n selectAggregation(instrumentType: InstrumentType): Aggregation {\n return this._aggregationSelector(instrumentType);\n }\n\n selectAggregationTemporality(\n instrumentType: InstrumentType\n ): AggregationTemporality {\n return this._aggregationTemporalitySelector(instrumentType);\n }\n}\n"]}
1
+ {"version":3,"file":"OTLPMetricExporterBase.js","sourceRoot":"","sources":["../../src/OTLPMetricExporterBase.ts"],"names":[],"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,CAAC;IAED,iBAAiB,CAAC,cAA8B;QAC9C,OAAO,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;IACnD,CAAC;IAED,4BAA4B,CAC1B,cAA8B;QAE9B,OAAO,IAAI,CAAC,+BAA+B,CAAC,cAAc,CAAC,CAAC;IAC9D,CAAC;CACF;AA3BD,wDA2BC","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 { getStringFromEnv } from '@opentelemetry/core';\nimport {\n AggregationTemporality,\n AggregationTemporalitySelector,\n InstrumentType,\n PushMetricExporter,\n ResourceMetrics,\n AggregationSelector,\n AggregationOption,\n AggregationType,\n} from '@opentelemetry/sdk-metrics';\nimport {\n AggregationTemporalityPreference,\n OTLPMetricExporterOptions,\n} from './OTLPMetricExporterOptions';\nimport {\n IOtlpExportDelegate,\n OTLPExporterBase,\n} from '@opentelemetry/otlp-exporter-base';\nimport { diag } from '@opentelemetry/api';\n\nexport const CumulativeTemporalitySelector: AggregationTemporalitySelector =\n () => AggregationTemporality.CUMULATIVE;\n\nexport const DeltaTemporalitySelector: AggregationTemporalitySelector = (\n instrumentType: InstrumentType\n) => {\n switch (instrumentType) {\n case InstrumentType.COUNTER:\n case InstrumentType.OBSERVABLE_COUNTER:\n case InstrumentType.GAUGE:\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\nexport const LowMemoryTemporalitySelector: AggregationTemporalitySelector = (\n instrumentType: InstrumentType\n) => {\n switch (instrumentType) {\n case InstrumentType.COUNTER:\n case InstrumentType.HISTOGRAM:\n return AggregationTemporality.DELTA;\n case InstrumentType.GAUGE:\n case InstrumentType.UP_DOWN_COUNTER:\n case InstrumentType.OBSERVABLE_UP_DOWN_COUNTER:\n case InstrumentType.OBSERVABLE_COUNTER:\n case InstrumentType.OBSERVABLE_GAUGE:\n return AggregationTemporality.CUMULATIVE;\n }\n};\n\nfunction chooseTemporalitySelectorFromEnvironment() {\n const configuredTemporality = (\n getStringFromEnv('OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE') ??\n 'cumulative'\n ).toLowerCase();\n\n if (configuredTemporality === 'cumulative') {\n return CumulativeTemporalitySelector;\n }\n if (configuredTemporality === 'delta') {\n return DeltaTemporalitySelector;\n }\n if (configuredTemporality === 'lowmemory') {\n return LowMemoryTemporalitySelector;\n }\n\n diag.warn(\n `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${configuredTemporality}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`\n );\n return CumulativeTemporalitySelector;\n}\n\nfunction chooseTemporalitySelector(\n temporalityPreference?:\n | AggregationTemporalityPreference\n | AggregationTemporality\n): AggregationTemporalitySelector {\n // Directly passed preference has priority.\n if (temporalityPreference != null) {\n if (temporalityPreference === AggregationTemporalityPreference.DELTA) {\n return DeltaTemporalitySelector;\n } else if (\n temporalityPreference === AggregationTemporalityPreference.LOWMEMORY\n ) {\n return LowMemoryTemporalitySelector;\n }\n return CumulativeTemporalitySelector;\n }\n\n return chooseTemporalitySelectorFromEnvironment();\n}\n\nconst DEFAULT_AGGREGATION = Object.freeze({\n type: AggregationType.DEFAULT,\n});\n\nfunction chooseAggregationSelector(\n config: OTLPMetricExporterOptions | undefined\n): AggregationSelector {\n return config?.aggregationPreference ?? (() => DEFAULT_AGGREGATION);\n}\n\nexport class OTLPMetricExporterBase\n extends OTLPExporterBase<ResourceMetrics>\n implements PushMetricExporter\n{\n private readonly _aggregationTemporalitySelector: AggregationTemporalitySelector;\n private readonly _aggregationSelector: AggregationSelector;\n\n constructor(\n delegate: IOtlpExportDelegate<ResourceMetrics>,\n config?: OTLPMetricExporterOptions\n ) {\n super(delegate);\n this._aggregationSelector = chooseAggregationSelector(config);\n this._aggregationTemporalitySelector = chooseTemporalitySelector(\n config?.temporalityPreference\n );\n }\n\n selectAggregation(instrumentType: InstrumentType): AggregationOption {\n return this._aggregationSelector(instrumentType);\n }\n\n selectAggregationTemporality(\n instrumentType: InstrumentType\n ): AggregationTemporality {\n return this._aggregationTemporalitySelector(instrumentType);\n }\n}\n"]}
@@ -24,7 +24,7 @@ const browser_http_1 = require("@opentelemetry/otlp-exporter-base/browser-http")
24
24
  */
25
25
  class OTLPMetricExporter extends OTLPMetricExporterBase_1.OTLPMetricExporterBase {
26
26
  constructor(config) {
27
- super((0, browser_http_1.createLegacyOtlpBrowserExportDelegate)(config !== null && config !== void 0 ? config : {}, otlp_transformer_1.JsonMetricsSerializer, 'v1/metrics', { 'Content-Type': 'application/json' }), config);
27
+ super((0, browser_http_1.createLegacyOtlpBrowserExportDelegate)(config ?? {}, otlp_transformer_1.JsonMetricsSerializer, 'v1/metrics', { 'Content-Type': 'application/json' }), config);
28
28
  }
29
29
  }
30
30
  exports.OTLPMetricExporter = OTLPMetricExporter;
@@ -1 +1 @@
1
- {"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../../../src/platform/browser/OTLPMetricExporter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAGH,yEAAsE;AAEtE,sEAAwE;AACxE,iFAAuG;AAEvG;;GAEG;AACH,MAAa,kBAAmB,SAAQ,+CAAsB;IAC5D,YAAY,MAA2D;QACrE,KAAK,CACH,IAAA,oDAAqC,EACnC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,EACZ,wCAAqB,EACrB,YAAY,EACZ,EAAE,cAAc,EAAE,kBAAkB,EAAE,CACvC,EACD,MAAM,CACP,CAAC;IACJ,CAAC;CACF;AAZD,gDAYC","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 { OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions';\nimport { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';\nimport { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base';\nimport { JsonMetricsSerializer } from '@opentelemetry/otlp-transformer';\nimport { createLegacyOtlpBrowserExportDelegate } from '@opentelemetry/otlp-exporter-base/browser-http';\n\n/**\n * Collector Metric Exporter for Web\n */\nexport class OTLPMetricExporter extends OTLPMetricExporterBase {\n constructor(config?: OTLPExporterConfigBase & OTLPMetricExporterOptions) {\n super(\n createLegacyOtlpBrowserExportDelegate(\n config ?? {},\n JsonMetricsSerializer,\n 'v1/metrics',\n { 'Content-Type': 'application/json' }\n ),\n config\n );\n }\n}\n"]}
1
+ {"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../../../src/platform/browser/OTLPMetricExporter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAGH,yEAAsE;AAEtE,sEAAwE;AACxE,iFAAuG;AAEvG;;GAEG;AACH,MAAa,kBAAmB,SAAQ,+CAAsB;IAC5D,YAAY,MAA2D;QACrE,KAAK,CACH,IAAA,oDAAqC,EACnC,MAAM,IAAI,EAAE,EACZ,wCAAqB,EACrB,YAAY,EACZ,EAAE,cAAc,EAAE,kBAAkB,EAAE,CACvC,EACD,MAAM,CACP,CAAC;IACJ,CAAC;CACF;AAZD,gDAYC","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 { OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions';\nimport { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';\nimport { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base';\nimport { JsonMetricsSerializer } from '@opentelemetry/otlp-transformer';\nimport { createLegacyOtlpBrowserExportDelegate } from '@opentelemetry/otlp-exporter-base/browser-http';\n\n/**\n * Collector Metric Exporter for Web\n */\nexport class OTLPMetricExporter extends OTLPMetricExporterBase {\n constructor(config?: OTLPExporterConfigBase & OTLPMetricExporterOptions) {\n super(\n createLegacyOtlpBrowserExportDelegate(\n config ?? {},\n JsonMetricsSerializer,\n 'v1/metrics',\n { 'Content-Type': 'application/json' }\n ),\n config\n );\n }\n}\n"]}
@@ -28,7 +28,10 @@ const USER_AGENT = {
28
28
  */
29
29
  class OTLPMetricExporter extends OTLPMetricExporterBase_1.OTLPMetricExporterBase {
30
30
  constructor(config) {
31
- super((0, node_http_1.createOtlpHttpExportDelegate)((0, node_http_1.convertLegacyHttpOptions)(config !== null && config !== void 0 ? config : {}, 'METRICS', 'v1/metrics', Object.assign(Object.assign({}, USER_AGENT), { 'Content-Type': 'application/json' })), otlp_transformer_1.JsonMetricsSerializer), config);
31
+ super((0, node_http_1.createOtlpHttpExportDelegate)((0, node_http_1.convertLegacyHttpOptions)(config ?? {}, 'METRICS', 'v1/metrics', {
32
+ ...USER_AGENT,
33
+ 'Content-Type': 'application/json',
34
+ }), otlp_transformer_1.JsonMetricsSerializer), config);
32
35
  }
33
36
  }
34
37
  exports.OTLPMetricExporter = OTLPMetricExporter;
@@ -1 +1 @@
1
- {"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../../../src/platform/node/OTLPMetricExporter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAGH,yEAAsE;AAEtE,sEAAwE;AACxE,2CAAwC;AACxC,2EAGqD;AAErD,MAAM,UAAU,GAAG;IACjB,YAAY,EAAE,iCAAiC,iBAAO,EAAE;CACzD,CAAC;AAEF;;GAEG;AACH,MAAa,kBAAmB,SAAQ,+CAAsB;IAC5D,YAAY,MAA+D;QACzE,KAAK,CACH,IAAA,wCAA4B,EAC1B,IAAA,oCAAwB,EAAC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,EAAE,SAAS,EAAE,YAAY,kCACzD,UAAU,KACb,cAAc,EAAE,kBAAkB,IAClC,EACF,wCAAqB,CACtB,EACD,MAAM,CACP,CAAC;IACJ,CAAC;CACF;AAbD,gDAaC","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 { OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions';\nimport { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';\nimport { OTLPExporterNodeConfigBase } from '@opentelemetry/otlp-exporter-base';\nimport { JsonMetricsSerializer } from '@opentelemetry/otlp-transformer';\nimport { VERSION } from '../../version';\nimport {\n convertLegacyHttpOptions,\n createOtlpHttpExportDelegate,\n} from '@opentelemetry/otlp-exporter-base/node-http';\n\nconst USER_AGENT = {\n 'User-Agent': `OTel-OTLP-Exporter-JavaScript/${VERSION}`,\n};\n\n/**\n * OTLP Metric Exporter for Node.js\n */\nexport class OTLPMetricExporter extends OTLPMetricExporterBase {\n constructor(config?: OTLPExporterNodeConfigBase & OTLPMetricExporterOptions) {\n super(\n createOtlpHttpExportDelegate(\n convertLegacyHttpOptions(config ?? {}, 'METRICS', 'v1/metrics', {\n ...USER_AGENT,\n 'Content-Type': 'application/json',\n }),\n JsonMetricsSerializer\n ),\n config\n );\n }\n}\n"]}
1
+ {"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../../../src/platform/node/OTLPMetricExporter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAGH,yEAAsE;AAEtE,sEAAwE;AACxE,2CAAwC;AACxC,2EAGqD;AAErD,MAAM,UAAU,GAAG;IACjB,YAAY,EAAE,iCAAiC,iBAAO,EAAE;CACzD,CAAC;AAEF;;GAEG;AACH,MAAa,kBAAmB,SAAQ,+CAAsB;IAC5D,YAAY,MAA+D;QACzE,KAAK,CACH,IAAA,wCAA4B,EAC1B,IAAA,oCAAwB,EAAC,MAAM,IAAI,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE;YAC9D,GAAG,UAAU;YACb,cAAc,EAAE,kBAAkB;SACnC,CAAC,EACF,wCAAqB,CACtB,EACD,MAAM,CACP,CAAC;IACJ,CAAC;CACF;AAbD,gDAaC","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 { OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions';\nimport { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';\nimport { OTLPExporterNodeConfigBase } from '@opentelemetry/otlp-exporter-base';\nimport { JsonMetricsSerializer } from '@opentelemetry/otlp-transformer';\nimport { VERSION } from '../../version';\nimport {\n convertLegacyHttpOptions,\n createOtlpHttpExportDelegate,\n} from '@opentelemetry/otlp-exporter-base/node-http';\n\nconst USER_AGENT = {\n 'User-Agent': `OTel-OTLP-Exporter-JavaScript/${VERSION}`,\n};\n\n/**\n * OTLP Metric Exporter for Node.js\n */\nexport class OTLPMetricExporter extends OTLPMetricExporterBase {\n constructor(config?: OTLPExporterNodeConfigBase & OTLPMetricExporterOptions) {\n super(\n createOtlpHttpExportDelegate(\n convertLegacyHttpOptions(config ?? {}, 'METRICS', 'v1/metrics', {\n ...USER_AGENT,\n 'Content-Type': 'application/json',\n }),\n JsonMetricsSerializer\n ),\n config\n );\n }\n}\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.57.2";
1
+ export declare const VERSION = "0.200.0-dev.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -17,5 +17,5 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.VERSION = void 0;
19
19
  // this is autogenerated file, see scripts/version-update.js
20
- exports.VERSION = '0.57.2';
20
+ exports.VERSION = '0.200.0-dev.0';
21
21
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,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.57.2';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,eAAe,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.200.0-dev.0';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentelemetry/exporter-metrics-otlp-http",
3
- "version": "0.57.2",
3
+ "version": "0.200.0-dev.0",
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",
@@ -42,7 +42,7 @@
42
42
  "author": "OpenTelemetry Authors",
43
43
  "license": "Apache-2.0",
44
44
  "engines": {
45
- "node": ">=14"
45
+ "node": "^18.19.0 || >=20.6.0"
46
46
  },
47
47
  "files": [
48
48
  "build/esm/**/*.js",
@@ -62,14 +62,14 @@
62
62
  "access": "public"
63
63
  },
64
64
  "devDependencies": {
65
- "@babel/core": "7.26.0",
66
- "@babel/preset-env": "7.26.0",
65
+ "@babel/core": "7.26.9",
66
+ "@babel/preset-env": "7.26.9",
67
67
  "@opentelemetry/api": "1.9.0",
68
68
  "@types/mocha": "10.0.10",
69
69
  "@types/node": "18.6.5",
70
- "@types/sinon": "17.0.3",
70
+ "@types/sinon": "17.0.4",
71
71
  "@types/webpack-env": "1.16.3",
72
- "babel-loader": "8.4.1",
72
+ "babel-loader": "9.2.1",
73
73
  "babel-plugin-istanbul": "7.0.0",
74
74
  "cross-var": "1.1.0",
75
75
  "karma": "6.4.4",
@@ -79,26 +79,25 @@
79
79
  "karma-spec-reporter": "0.0.36",
80
80
  "karma-webpack": "5.0.1",
81
81
  "lerna": "6.6.2",
82
- "mocha": "10.8.2",
83
- "nyc": "15.1.0",
82
+ "mocha": "11.1.0",
83
+ "nyc": "17.1.0",
84
84
  "sinon": "15.1.2",
85
- "ts-loader": "9.5.1",
86
- "typescript": "4.4.4",
85
+ "ts-loader": "9.5.2",
86
+ "typescript": "5.0.4",
87
87
  "webpack": "5.96.1",
88
- "webpack-cli": "5.1.4",
89
- "webpack-merge": "5.10.0"
88
+ "webpack-cli": "6.0.1"
90
89
  },
91
90
  "peerDependencies": {
92
91
  "@opentelemetry/api": "^1.3.0"
93
92
  },
94
93
  "dependencies": {
95
- "@opentelemetry/core": "1.30.1",
96
- "@opentelemetry/otlp-exporter-base": "0.57.2",
97
- "@opentelemetry/otlp-transformer": "0.57.2",
98
- "@opentelemetry/resources": "1.30.1",
99
- "@opentelemetry/sdk-metrics": "1.30.1"
94
+ "@opentelemetry/core": "2.0.0-dev.0",
95
+ "@opentelemetry/otlp-exporter-base": "0.200.0-dev.0",
96
+ "@opentelemetry/otlp-transformer": "0.200.0-dev.0",
97
+ "@opentelemetry/resources": "2.0.0-dev.0",
98
+ "@opentelemetry/sdk-metrics": "2.0.0-dev.0"
100
99
  },
101
100
  "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-exporter-metrics-otlp-http",
102
101
  "sideEffects": false,
103
- "gitHead": "ac8641a5dbb5df1169bd5ed25a6667a6a6f730ca"
102
+ "gitHead": "544c40984797dd2e2cccb92cce0e88b30f235b02"
104
103
  }