@opentelemetry/exporter-metrics-otlp-http 0.57.2 → 0.200.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -12
- package/build/esm/OTLPMetricExporterBase.d.ts +2 -2
- package/build/esm/OTLPMetricExporterBase.js +24 -43
- package/build/esm/OTLPMetricExporterBase.js.map +1 -1
- package/build/esm/platform/browser/OTLPMetricExporter.js +4 -22
- package/build/esm/platform/browser/OTLPMetricExporter.js.map +1 -1
- package/build/esm/platform/node/OTLPMetricExporter.js +9 -35
- package/build/esm/platform/node/OTLPMetricExporter.js.map +1 -1
- package/build/esm/version.d.ts +1 -1
- package/build/esm/version.js +1 -1
- package/build/esm/version.js.map +1 -1
- package/build/esnext/OTLPMetricExporterBase.d.ts +2 -2
- package/build/esnext/OTLPMetricExporterBase.js +12 -12
- package/build/esnext/OTLPMetricExporterBase.js.map +1 -1
- package/build/esnext/platform/browser/OTLPMetricExporter.js +1 -1
- package/build/esnext/platform/browser/OTLPMetricExporter.js.map +1 -1
- package/build/esnext/platform/node/OTLPMetricExporter.js +4 -1
- package/build/esnext/platform/node/OTLPMetricExporter.js.map +1 -1
- package/build/esnext/version.d.ts +1 -1
- package/build/esnext/version.js +1 -1
- package/build/esnext/version.js.map +1 -1
- package/build/src/OTLPMetricExporterBase.d.ts +2 -2
- package/build/src/OTLPMetricExporterBase.js +10 -10
- package/build/src/OTLPMetricExporterBase.js.map +1 -1
- package/build/src/platform/browser/OTLPMetricExporter.js +1 -1
- package/build/src/platform/browser/OTLPMetricExporter.js.map +1 -1
- package/build/src/platform/node/OTLPMetricExporter.js +4 -1
- package/build/src/platform/node/OTLPMetricExporter.js.map +1 -1
- package/build/src/version.d.ts +1 -1
- package/build/src/version.js +1 -1
- package/build/src/version.js.map +1 -1
- package/package.json +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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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,
|
|
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):
|
|
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
|
-
|
|
17
|
-
|
|
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
|
|
37
|
-
export
|
|
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
|
|
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
|
-
|
|
65
|
-
|
|
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(
|
|
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
|
-
|
|
93
|
-
return config.aggregationPreference;
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
return function (_instrumentType) { return Aggregation.Default(); };
|
|
97
|
-
}
|
|
80
|
+
return config?.aggregationPreference ?? (() => DEFAULT_AGGREGATION);
|
|
98
81
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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
|
-
|
|
90
|
+
selectAggregation(instrumentType) {
|
|
108
91
|
return this._aggregationSelector(instrumentType);
|
|
109
|
-
}
|
|
110
|
-
|
|
92
|
+
}
|
|
93
|
+
selectAggregationTemporality(instrumentType) {
|
|
111
94
|
return this._aggregationTemporalitySelector(instrumentType);
|
|
112
|
-
}
|
|
113
|
-
|
|
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
|
|
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,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,cAA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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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
47
|
-
'User-Agent':
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
|
|
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
|
|
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"]}
|
package/build/esm/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.200.0-dev.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/build/esm/version.js
CHANGED
package/build/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,
|
|
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.1';\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AggregationTemporality, AggregationTemporalitySelector, InstrumentType, PushMetricExporter, ResourceMetrics,
|
|
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):
|
|
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 {
|
|
17
|
-
import { AggregationTemporality, InstrumentType,
|
|
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
|
|
50
|
-
|
|
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 '${
|
|
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
|
-
|
|
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
|
|
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,
|
|
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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ED,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"]}
|
|
@@ -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
|
|
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,
|
|
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
|
|
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,
|
|
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.
|
|
1
|
+
export declare const VERSION = "0.200.0-dev.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/build/esnext/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
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.1';\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AggregationTemporality, AggregationTemporalitySelector, InstrumentType, PushMetricExporter, ResourceMetrics,
|
|
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):
|
|
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
|
|
56
|
-
|
|
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 '${
|
|
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
|
-
|
|
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
|
|
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,
|
|
1
|
+
{"version":3,"file":"OTLPMetricExporterBase.js","sourceRoot":"","sources":["../../src/OTLPMetricExporterBase.ts"],"names":[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ACJ,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
|
|
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,
|
|
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
|
|
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,
|
|
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"]}
|
package/build/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.200.0-dev.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/build/src/version.js
CHANGED
|
@@ -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.
|
|
20
|
+
exports.VERSION = '0.200.0-dev.1';
|
|
21
21
|
//# sourceMappingURL=version.js.map
|
package/build/src/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,
|
|
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.1';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentelemetry/exporter-metrics-otlp-http",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.200.0-dev.1",
|
|
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": ">=
|
|
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.
|
|
66
|
-
"@babel/preset-env": "7.26.
|
|
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.
|
|
70
|
+
"@types/sinon": "17.0.4",
|
|
71
71
|
"@types/webpack-env": "1.16.3",
|
|
72
|
-
"babel-loader": "
|
|
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": "
|
|
83
|
-
"nyc": "
|
|
82
|
+
"mocha": "11.1.0",
|
|
83
|
+
"nyc": "17.1.0",
|
|
84
84
|
"sinon": "15.1.2",
|
|
85
|
-
"ts-loader": "9.5.
|
|
86
|
-
"typescript": "
|
|
85
|
+
"ts-loader": "9.5.2",
|
|
86
|
+
"typescript": "5.0.4",
|
|
87
87
|
"webpack": "5.96.1",
|
|
88
|
-
"webpack-cli": "
|
|
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": "
|
|
96
|
-
"@opentelemetry/otlp-exporter-base": "0.
|
|
97
|
-
"@opentelemetry/otlp-transformer": "0.
|
|
98
|
-
"@opentelemetry/resources": "
|
|
99
|
-
"@opentelemetry/sdk-metrics": "
|
|
94
|
+
"@opentelemetry/core": "2.0.0-dev.1",
|
|
95
|
+
"@opentelemetry/otlp-exporter-base": "0.200.0-dev.1",
|
|
96
|
+
"@opentelemetry/otlp-transformer": "0.200.0-dev.1",
|
|
97
|
+
"@opentelemetry/resources": "2.0.0-dev.1",
|
|
98
|
+
"@opentelemetry/sdk-metrics": "2.0.0-dev.1"
|
|
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": "
|
|
102
|
+
"gitHead": "92fde6aa77e464ee85c4a18f279fe12294f625d1"
|
|
104
103
|
}
|