@opentelemetry/exporter-metrics-otlp-http 0.48.0 → 0.49.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.
- package/build/esm/OTLPMetricExporterBase.d.ts +3 -1
- package/build/esm/OTLPMetricExporterBase.js +13 -1
- package/build/esm/OTLPMetricExporterBase.js.map +1 -1
- package/build/esm/OTLPMetricExporterOptions.d.ts +2 -1
- package/build/esm/OTLPMetricExporterOptions.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 +3 -1
- package/build/esnext/OTLPMetricExporterBase.js +13 -1
- package/build/esnext/OTLPMetricExporterBase.js.map +1 -1
- package/build/esnext/OTLPMetricExporterOptions.d.ts +2 -1
- package/build/esnext/OTLPMetricExporterOptions.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 +3 -1
- package/build/src/OTLPMetricExporterBase.js +12 -0
- package/build/src/OTLPMetricExporterBase.js.map +1 -1
- package/build/src/OTLPMetricExporterOptions.d.ts +2 -1
- package/build/src/OTLPMetricExporterOptions.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 +8 -8
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExportResult } from '@opentelemetry/core';
|
|
2
|
-
import { AggregationTemporality, AggregationTemporalitySelector, InstrumentType, PushMetricExporter, ResourceMetrics } from '@opentelemetry/sdk-metrics';
|
|
2
|
+
import { AggregationTemporality, AggregationTemporalitySelector, InstrumentType, PushMetricExporter, ResourceMetrics, Aggregation } from '@opentelemetry/sdk-metrics';
|
|
3
3
|
import { OTLPMetricExporterOptions } from './OTLPMetricExporterOptions';
|
|
4
4
|
import { OTLPExporterBase } from '@opentelemetry/otlp-exporter-base';
|
|
5
5
|
import { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';
|
|
@@ -9,10 +9,12 @@ export declare const LowMemoryTemporalitySelector: AggregationTemporalitySelecto
|
|
|
9
9
|
export declare class OTLPMetricExporterBase<T extends OTLPExporterBase<OTLPMetricExporterOptions, ResourceMetrics, IExportMetricsServiceRequest>> implements PushMetricExporter {
|
|
10
10
|
_otlpExporter: T;
|
|
11
11
|
private _aggregationTemporalitySelector;
|
|
12
|
+
private _aggregationSelector;
|
|
12
13
|
constructor(exporter: T, config?: OTLPMetricExporterOptions);
|
|
13
14
|
export(metrics: ResourceMetrics, resultCallback: (result: ExportResult) => void): void;
|
|
14
15
|
shutdown(): Promise<void>;
|
|
15
16
|
forceFlush(): Promise<void>;
|
|
17
|
+
selectAggregation(instrumentType: InstrumentType): Aggregation;
|
|
16
18
|
selectAggregationTemporality(instrumentType: InstrumentType): AggregationTemporality;
|
|
17
19
|
}
|
|
18
20
|
//# sourceMappingURL=OTLPMetricExporterBase.d.ts.map
|
|
@@ -50,7 +50,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
52
|
import { getEnv } from '@opentelemetry/core';
|
|
53
|
-
import { AggregationTemporality, InstrumentType, } from '@opentelemetry/sdk-metrics';
|
|
53
|
+
import { AggregationTemporality, InstrumentType, Aggregation, } from '@opentelemetry/sdk-metrics';
|
|
54
54
|
import { AggregationTemporalityPreference, } from './OTLPMetricExporterOptions';
|
|
55
55
|
import { diag } from '@opentelemetry/api';
|
|
56
56
|
export var CumulativeTemporalitySelector = function () { return AggregationTemporality.CUMULATIVE; };
|
|
@@ -106,9 +106,18 @@ function chooseTemporalitySelector(temporalityPreference) {
|
|
|
106
106
|
}
|
|
107
107
|
return chooseTemporalitySelectorFromEnvironment();
|
|
108
108
|
}
|
|
109
|
+
function chooseAggregationSelector(config) {
|
|
110
|
+
if (config === null || config === void 0 ? void 0 : config.aggregationPreference) {
|
|
111
|
+
return config.aggregationPreference;
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
return function (_instrumentType) { return Aggregation.Default(); };
|
|
115
|
+
}
|
|
116
|
+
}
|
|
109
117
|
var OTLPMetricExporterBase = /** @class */ (function () {
|
|
110
118
|
function OTLPMetricExporterBase(exporter, config) {
|
|
111
119
|
this._otlpExporter = exporter;
|
|
120
|
+
this._aggregationSelector = chooseAggregationSelector(config);
|
|
112
121
|
this._aggregationTemporalitySelector = chooseTemporalitySelector(config === null || config === void 0 ? void 0 : config.temporalityPreference);
|
|
113
122
|
}
|
|
114
123
|
OTLPMetricExporterBase.prototype.export = function (metrics, resultCallback) {
|
|
@@ -129,6 +138,9 @@ var OTLPMetricExporterBase = /** @class */ (function () {
|
|
|
129
138
|
OTLPMetricExporterBase.prototype.forceFlush = function () {
|
|
130
139
|
return Promise.resolve();
|
|
131
140
|
};
|
|
141
|
+
OTLPMetricExporterBase.prototype.selectAggregation = function (instrumentType) {
|
|
142
|
+
return this._aggregationSelector(instrumentType);
|
|
143
|
+
};
|
|
132
144
|
OTLPMetricExporterBase.prototype.selectAggregationTemporality = function (instrumentType) {
|
|
133
145
|
return this._aggregationTemporalitySelector(instrumentType);
|
|
134
146
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OTLPMetricExporterBase.js","sourceRoot":"","sources":["../../src/OTLPMetricExporterBase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,OAAO,EAAgB,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EACL,sBAAsB,EAEtB,cAAc,
|
|
1
|
+
{"version":3,"file":"OTLPMetricExporterBase.js","sourceRoot":"","sources":["../../src/OTLPMetricExporterBase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AN,UACE,OAAwB,EACxB,cAA8C;QAE9C,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC,CAAC;IACvD,CAAC;IAEK,yCAAQ,GAAd;;;;4BACE,qBAAM,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,EAAA;;wBAAnC,SAAmC,CAAC;;;;;KACrC;IAED,2CAAU,GAAV;QACE,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,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,AA5CD,IA4CC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ExportResult, 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 { OTLPExporterBase } from '@opentelemetry/otlp-exporter-base';\nimport { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';\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.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.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 T extends OTLPExporterBase<\n OTLPMetricExporterOptions,\n ResourceMetrics,\n IExportMetricsServiceRequest\n >,\n> implements PushMetricExporter\n{\n public _otlpExporter: T;\n private _aggregationTemporalitySelector: AggregationTemporalitySelector;\n private _aggregationSelector: AggregationSelector;\n\n constructor(exporter: T, config?: OTLPMetricExporterOptions) {\n this._otlpExporter = exporter;\n this._aggregationSelector = chooseAggregationSelector(config);\n this._aggregationTemporalitySelector = chooseTemporalitySelector(\n config?.temporalityPreference\n );\n }\n\n export(\n metrics: ResourceMetrics,\n resultCallback: (result: ExportResult) => void\n ): void {\n this._otlpExporter.export([metrics], resultCallback);\n }\n\n async shutdown(): Promise<void> {\n await this._otlpExporter.shutdown();\n }\n\n forceFlush(): Promise<void> {\n return Promise.resolve();\n }\n\n 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,7 +1,8 @@
|
|
|
1
1
|
import { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base';
|
|
2
|
-
import { AggregationTemporality } from '@opentelemetry/sdk-metrics';
|
|
2
|
+
import { AggregationTemporality, AggregationSelector } from '@opentelemetry/sdk-metrics';
|
|
3
3
|
export interface OTLPMetricExporterOptions extends OTLPExporterConfigBase {
|
|
4
4
|
temporalityPreference?: AggregationTemporalityPreference | AggregationTemporality;
|
|
5
|
+
aggregationPreference?: AggregationSelector;
|
|
5
6
|
}
|
|
6
7
|
export declare enum AggregationTemporalityPreference {
|
|
7
8
|
DELTA = 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OTLPMetricExporterOptions.js","sourceRoot":"","sources":["../../src/OTLPMetricExporterOptions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"OTLPMetricExporterOptions.js","sourceRoot":"","sources":["../../src/OTLPMetricExporterOptions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAeH,MAAM,CAAN,IAAY,gCAIX;AAJD,WAAY,gCAAgC;IAC1C,yFAAK,CAAA;IACL,mGAAU,CAAA;IACV,iGAAS,CAAA;AACX,CAAC,EAJW,gCAAgC,KAAhC,gCAAgC,QAI3C","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 { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base';\nimport {\n AggregationTemporality,\n AggregationSelector,\n} from '@opentelemetry/sdk-metrics';\n\nexport interface OTLPMetricExporterOptions extends OTLPExporterConfigBase {\n temporalityPreference?:\n | AggregationTemporalityPreference\n | AggregationTemporality;\n aggregationPreference?: AggregationSelector;\n}\n\nexport enum AggregationTemporalityPreference {\n DELTA,\n CUMULATIVE,\n LOWMEMORY,\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.49.0";
|
|
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,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.
|
|
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.49.0';\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExportResult } from '@opentelemetry/core';
|
|
2
|
-
import { AggregationTemporality, AggregationTemporalitySelector, InstrumentType, PushMetricExporter, ResourceMetrics } from '@opentelemetry/sdk-metrics';
|
|
2
|
+
import { AggregationTemporality, AggregationTemporalitySelector, InstrumentType, PushMetricExporter, ResourceMetrics, Aggregation } from '@opentelemetry/sdk-metrics';
|
|
3
3
|
import { OTLPMetricExporterOptions } from './OTLPMetricExporterOptions';
|
|
4
4
|
import { OTLPExporterBase } from '@opentelemetry/otlp-exporter-base';
|
|
5
5
|
import { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';
|
|
@@ -9,10 +9,12 @@ export declare const LowMemoryTemporalitySelector: AggregationTemporalitySelecto
|
|
|
9
9
|
export declare class OTLPMetricExporterBase<T extends OTLPExporterBase<OTLPMetricExporterOptions, ResourceMetrics, IExportMetricsServiceRequest>> implements PushMetricExporter {
|
|
10
10
|
_otlpExporter: T;
|
|
11
11
|
private _aggregationTemporalitySelector;
|
|
12
|
+
private _aggregationSelector;
|
|
12
13
|
constructor(exporter: T, config?: OTLPMetricExporterOptions);
|
|
13
14
|
export(metrics: ResourceMetrics, resultCallback: (result: ExportResult) => void): void;
|
|
14
15
|
shutdown(): Promise<void>;
|
|
15
16
|
forceFlush(): Promise<void>;
|
|
17
|
+
selectAggregation(instrumentType: InstrumentType): Aggregation;
|
|
16
18
|
selectAggregationTemporality(instrumentType: InstrumentType): AggregationTemporality;
|
|
17
19
|
}
|
|
18
20
|
//# sourceMappingURL=OTLPMetricExporterBase.d.ts.map
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { getEnv } from '@opentelemetry/core';
|
|
17
|
-
import { AggregationTemporality, InstrumentType, } from '@opentelemetry/sdk-metrics';
|
|
17
|
+
import { AggregationTemporality, InstrumentType, Aggregation, } from '@opentelemetry/sdk-metrics';
|
|
18
18
|
import { AggregationTemporalityPreference, } from './OTLPMetricExporterOptions';
|
|
19
19
|
import { diag } from '@opentelemetry/api';
|
|
20
20
|
export const CumulativeTemporalitySelector = () => AggregationTemporality.CUMULATIVE;
|
|
@@ -70,9 +70,18 @@ function chooseTemporalitySelector(temporalityPreference) {
|
|
|
70
70
|
}
|
|
71
71
|
return chooseTemporalitySelectorFromEnvironment();
|
|
72
72
|
}
|
|
73
|
+
function chooseAggregationSelector(config) {
|
|
74
|
+
if (config === null || config === void 0 ? void 0 : config.aggregationPreference) {
|
|
75
|
+
return config.aggregationPreference;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
return (_instrumentType) => Aggregation.Default();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
73
81
|
export class OTLPMetricExporterBase {
|
|
74
82
|
constructor(exporter, config) {
|
|
75
83
|
this._otlpExporter = exporter;
|
|
84
|
+
this._aggregationSelector = chooseAggregationSelector(config);
|
|
76
85
|
this._aggregationTemporalitySelector = chooseTemporalitySelector(config === null || config === void 0 ? void 0 : config.temporalityPreference);
|
|
77
86
|
}
|
|
78
87
|
export(metrics, resultCallback) {
|
|
@@ -84,6 +93,9 @@ export class OTLPMetricExporterBase {
|
|
|
84
93
|
forceFlush() {
|
|
85
94
|
return Promise.resolve();
|
|
86
95
|
}
|
|
96
|
+
selectAggregation(instrumentType) {
|
|
97
|
+
return this._aggregationSelector(instrumentType);
|
|
98
|
+
}
|
|
87
99
|
selectAggregationTemporality(instrumentType) {
|
|
88
100
|
return this._aggregationTemporalitySelector(instrumentType);
|
|
89
101
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OTLPMetricExporterBase.js","sourceRoot":"","sources":["../../src/OTLPMetricExporterBase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAgB,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EACL,sBAAsB,EAEtB,cAAc,
|
|
1
|
+
{"version":3,"file":"OTLPMetricExporterBase.js","sourceRoot":"","sources":["../../src/OTLPMetricExporterBase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;A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,CAAC;IAED,MAAM,CACJ,OAAwB,EACxB,cAA8C;QAE9C,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,MAAM,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC;IACtC,CAAC;IAED,UAAU;QACR,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,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 { ExportResult, 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 { OTLPExporterBase } from '@opentelemetry/otlp-exporter-base';\nimport { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';\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.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.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 T extends OTLPExporterBase<\n OTLPMetricExporterOptions,\n ResourceMetrics,\n IExportMetricsServiceRequest\n >,\n> implements PushMetricExporter\n{\n public _otlpExporter: T;\n private _aggregationTemporalitySelector: AggregationTemporalitySelector;\n private _aggregationSelector: AggregationSelector;\n\n constructor(exporter: T, config?: OTLPMetricExporterOptions) {\n this._otlpExporter = exporter;\n this._aggregationSelector = chooseAggregationSelector(config);\n this._aggregationTemporalitySelector = chooseTemporalitySelector(\n config?.temporalityPreference\n );\n }\n\n export(\n metrics: ResourceMetrics,\n resultCallback: (result: ExportResult) => void\n ): void {\n this._otlpExporter.export([metrics], resultCallback);\n }\n\n async shutdown(): Promise<void> {\n await this._otlpExporter.shutdown();\n }\n\n forceFlush(): Promise<void> {\n return Promise.resolve();\n }\n\n 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,7 +1,8 @@
|
|
|
1
1
|
import { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base';
|
|
2
|
-
import { AggregationTemporality } from '@opentelemetry/sdk-metrics';
|
|
2
|
+
import { AggregationTemporality, AggregationSelector } from '@opentelemetry/sdk-metrics';
|
|
3
3
|
export interface OTLPMetricExporterOptions extends OTLPExporterConfigBase {
|
|
4
4
|
temporalityPreference?: AggregationTemporalityPreference | AggregationTemporality;
|
|
5
|
+
aggregationPreference?: AggregationSelector;
|
|
5
6
|
}
|
|
6
7
|
export declare enum AggregationTemporalityPreference {
|
|
7
8
|
DELTA = 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OTLPMetricExporterOptions.js","sourceRoot":"","sources":["../../src/OTLPMetricExporterOptions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"OTLPMetricExporterOptions.js","sourceRoot":"","sources":["../../src/OTLPMetricExporterOptions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAeH,MAAM,CAAN,IAAY,gCAIX;AAJD,WAAY,gCAAgC;IAC1C,yFAAK,CAAA;IACL,mGAAU,CAAA;IACV,iGAAS,CAAA;AACX,CAAC,EAJW,gCAAgC,KAAhC,gCAAgC,QAI3C","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 { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base';\nimport {\n AggregationTemporality,\n AggregationSelector,\n} from '@opentelemetry/sdk-metrics';\n\nexport interface OTLPMetricExporterOptions extends OTLPExporterConfigBase {\n temporalityPreference?:\n | AggregationTemporalityPreference\n | AggregationTemporality;\n aggregationPreference?: AggregationSelector;\n}\n\nexport enum AggregationTemporalityPreference {\n DELTA,\n CUMULATIVE,\n LOWMEMORY,\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.49.0";
|
|
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,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.
|
|
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.49.0';\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExportResult } from '@opentelemetry/core';
|
|
2
|
-
import { AggregationTemporality, AggregationTemporalitySelector, InstrumentType, PushMetricExporter, ResourceMetrics } from '@opentelemetry/sdk-metrics';
|
|
2
|
+
import { AggregationTemporality, AggregationTemporalitySelector, InstrumentType, PushMetricExporter, ResourceMetrics, Aggregation } from '@opentelemetry/sdk-metrics';
|
|
3
3
|
import { OTLPMetricExporterOptions } from './OTLPMetricExporterOptions';
|
|
4
4
|
import { OTLPExporterBase } from '@opentelemetry/otlp-exporter-base';
|
|
5
5
|
import { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';
|
|
@@ -9,10 +9,12 @@ export declare const LowMemoryTemporalitySelector: AggregationTemporalitySelecto
|
|
|
9
9
|
export declare class OTLPMetricExporterBase<T extends OTLPExporterBase<OTLPMetricExporterOptions, ResourceMetrics, IExportMetricsServiceRequest>> implements PushMetricExporter {
|
|
10
10
|
_otlpExporter: T;
|
|
11
11
|
private _aggregationTemporalitySelector;
|
|
12
|
+
private _aggregationSelector;
|
|
12
13
|
constructor(exporter: T, config?: OTLPMetricExporterOptions);
|
|
13
14
|
export(metrics: ResourceMetrics, resultCallback: (result: ExportResult) => void): void;
|
|
14
15
|
shutdown(): Promise<void>;
|
|
15
16
|
forceFlush(): Promise<void>;
|
|
17
|
+
selectAggregation(instrumentType: InstrumentType): Aggregation;
|
|
16
18
|
selectAggregationTemporality(instrumentType: InstrumentType): AggregationTemporality;
|
|
17
19
|
}
|
|
18
20
|
//# sourceMappingURL=OTLPMetricExporterBase.d.ts.map
|
|
@@ -76,9 +76,18 @@ function chooseTemporalitySelector(temporalityPreference) {
|
|
|
76
76
|
}
|
|
77
77
|
return chooseTemporalitySelectorFromEnvironment();
|
|
78
78
|
}
|
|
79
|
+
function chooseAggregationSelector(config) {
|
|
80
|
+
if (config === null || config === void 0 ? void 0 : config.aggregationPreference) {
|
|
81
|
+
return config.aggregationPreference;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
return (_instrumentType) => sdk_metrics_1.Aggregation.Default();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
79
87
|
class OTLPMetricExporterBase {
|
|
80
88
|
constructor(exporter, config) {
|
|
81
89
|
this._otlpExporter = exporter;
|
|
90
|
+
this._aggregationSelector = chooseAggregationSelector(config);
|
|
82
91
|
this._aggregationTemporalitySelector = chooseTemporalitySelector(config === null || config === void 0 ? void 0 : config.temporalityPreference);
|
|
83
92
|
}
|
|
84
93
|
export(metrics, resultCallback) {
|
|
@@ -90,6 +99,9 @@ class OTLPMetricExporterBase {
|
|
|
90
99
|
forceFlush() {
|
|
91
100
|
return Promise.resolve();
|
|
92
101
|
}
|
|
102
|
+
selectAggregation(instrumentType) {
|
|
103
|
+
return this._aggregationSelector(instrumentType);
|
|
104
|
+
}
|
|
93
105
|
selectAggregationTemporality(instrumentType) {
|
|
94
106
|
return this._aggregationTemporalitySelector(instrumentType);
|
|
95
107
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OTLPMetricExporterBase.js","sourceRoot":"","sources":["../../src/OTLPMetricExporterBase.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,8CAA2D;AAC3D,
|
|
1
|
+
{"version":3,"file":"OTLPMetricExporterBase.js","sourceRoot":"","sources":["../../src/OTLPMetricExporterBase.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,8CAA2D;AAC3D,4DAQoC;AACpC,2EAGqC;AAGrC,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,SAAS,CAAC;QAC9B,KAAK,4BAAc,CAAC,gBAAgB;YAClC,OAAO,oCAAsB,CAAC,KAAK,CAAC;QACtC,KAAK,4BAAc,CAAC,eAAe,CAAC;QACpC,KAAK,4BAAc,CAAC,0BAA0B;YAC5C,OAAO,oCAAsB,CAAC,U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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,sBAAsB;IAYjC,YAAY,QAAW,EAAE,MAAkC;QACzD,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAC;QAC9B,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,MAAM,CACJ,OAAwB,EACxB,cAA8C;QAE9C,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,MAAM,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC;IACtC,CAAC;IAED,UAAU;QACR,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,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;AA5CD,wDA4CC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ExportResult, 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 { OTLPExporterBase } from '@opentelemetry/otlp-exporter-base';\nimport { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';\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.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.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 T extends OTLPExporterBase<\n OTLPMetricExporterOptions,\n ResourceMetrics,\n IExportMetricsServiceRequest\n >,\n> implements PushMetricExporter\n{\n public _otlpExporter: T;\n private _aggregationTemporalitySelector: AggregationTemporalitySelector;\n private _aggregationSelector: AggregationSelector;\n\n constructor(exporter: T, config?: OTLPMetricExporterOptions) {\n this._otlpExporter = exporter;\n this._aggregationSelector = chooseAggregationSelector(config);\n this._aggregationTemporalitySelector = chooseTemporalitySelector(\n config?.temporalityPreference\n );\n }\n\n export(\n metrics: ResourceMetrics,\n resultCallback: (result: ExportResult) => void\n ): void {\n this._otlpExporter.export([metrics], resultCallback);\n }\n\n async shutdown(): Promise<void> {\n await this._otlpExporter.shutdown();\n }\n\n forceFlush(): Promise<void> {\n return Promise.resolve();\n }\n\n 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,7 +1,8 @@
|
|
|
1
1
|
import { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base';
|
|
2
|
-
import { AggregationTemporality } from '@opentelemetry/sdk-metrics';
|
|
2
|
+
import { AggregationTemporality, AggregationSelector } from '@opentelemetry/sdk-metrics';
|
|
3
3
|
export interface OTLPMetricExporterOptions extends OTLPExporterConfigBase {
|
|
4
4
|
temporalityPreference?: AggregationTemporalityPreference | AggregationTemporality;
|
|
5
|
+
aggregationPreference?: AggregationSelector;
|
|
5
6
|
}
|
|
6
7
|
export declare enum AggregationTemporalityPreference {
|
|
7
8
|
DELTA = 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OTLPMetricExporterOptions.js","sourceRoot":"","sources":["../../src/OTLPMetricExporterOptions.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;
|
|
1
|
+
{"version":3,"file":"OTLPMetricExporterOptions.js","sourceRoot":"","sources":["../../src/OTLPMetricExporterOptions.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAeH,IAAY,gCAIX;AAJD,WAAY,gCAAgC;IAC1C,yFAAK,CAAA;IACL,mGAAU,CAAA;IACV,iGAAS,CAAA;AACX,CAAC,EAJW,gCAAgC,GAAhC,wCAAgC,KAAhC,wCAAgC,QAI3C","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 { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base';\nimport {\n AggregationTemporality,\n AggregationSelector,\n} from '@opentelemetry/sdk-metrics';\n\nexport interface OTLPMetricExporterOptions extends OTLPExporterConfigBase {\n temporalityPreference?:\n | AggregationTemporalityPreference\n | AggregationTemporality;\n aggregationPreference?: AggregationSelector;\n}\n\nexport enum AggregationTemporalityPreference {\n DELTA,\n CUMULATIVE,\n LOWMEMORY,\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.49.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/build/src/version.js
CHANGED
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,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.
|
|
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.49.0';\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.49.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",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@babel/core": "7.23.6",
|
|
67
67
|
"@babel/preset-env": "7.22.20",
|
|
68
|
-
"@opentelemetry/api": "1.
|
|
68
|
+
"@opentelemetry/api": "1.8.0",
|
|
69
69
|
"@types/mocha": "10.0.6",
|
|
70
70
|
"@types/node": "18.6.5",
|
|
71
71
|
"@types/sinon": "10.0.20",
|
|
@@ -96,13 +96,13 @@
|
|
|
96
96
|
"@opentelemetry/api": "^1.3.0"
|
|
97
97
|
},
|
|
98
98
|
"dependencies": {
|
|
99
|
-
"@opentelemetry/core": "1.
|
|
100
|
-
"@opentelemetry/otlp-exporter-base": "0.
|
|
101
|
-
"@opentelemetry/otlp-transformer": "0.
|
|
102
|
-
"@opentelemetry/resources": "1.
|
|
103
|
-
"@opentelemetry/sdk-metrics": "1.
|
|
99
|
+
"@opentelemetry/core": "1.22.0",
|
|
100
|
+
"@opentelemetry/otlp-exporter-base": "0.49.0",
|
|
101
|
+
"@opentelemetry/otlp-transformer": "0.49.0",
|
|
102
|
+
"@opentelemetry/resources": "1.22.0",
|
|
103
|
+
"@opentelemetry/sdk-metrics": "1.22.0"
|
|
104
104
|
},
|
|
105
105
|
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-exporter-metrics-otlp-http",
|
|
106
106
|
"sideEffects": false,
|
|
107
|
-
"gitHead": "
|
|
107
|
+
"gitHead": "7be35c7845e206b27b682e8ce1cee850b09cec04"
|
|
108
108
|
}
|