@opentelemetry/exporter-metrics-otlp-http 0.33.0 → 0.34.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/README.md +18 -30
- package/build/esm/OTLPMetricExporterBase.js +21 -5
- package/build/esm/OTLPMetricExporterBase.js.map +1 -1
- package/build/esm/OTLPMetricExporterOptions.d.ts +0 -4
- package/build/esm/OTLPMetricExporterOptions.js +1 -3
- package/build/esm/OTLPMetricExporterOptions.js.map +1 -1
- package/build/esm/platform/browser/OTLPMetricExporter.js +1 -4
- package/build/esm/platform/browser/OTLPMetricExporter.js.map +1 -1
- package/build/esm/platform/node/OTLPMetricExporter.js +1 -4
- 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.js +22 -5
- package/build/esnext/OTLPMetricExporterBase.js.map +1 -1
- package/build/esnext/OTLPMetricExporterOptions.d.ts +0 -4
- package/build/esnext/OTLPMetricExporterOptions.js +1 -3
- package/build/esnext/OTLPMetricExporterOptions.js.map +1 -1
- package/build/esnext/platform/browser/OTLPMetricExporter.js +3 -4
- package/build/esnext/platform/browser/OTLPMetricExporter.js.map +1 -1
- package/build/esnext/platform/node/OTLPMetricExporter.js +3 -4
- 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.js +22 -5
- package/build/src/OTLPMetricExporterBase.js.map +1 -1
- package/build/src/OTLPMetricExporterOptions.d.ts +0 -4
- package/build/src/OTLPMetricExporterOptions.js +0 -4
- package/build/src/OTLPMetricExporterOptions.js.map +1 -1
- package/build/src/platform/browser/OTLPMetricExporter.js +3 -4
- package/build/src/platform/browser/OTLPMetricExporter.js.map +1 -1
- package/build/src/platform/node/OTLPMetricExporter.js +3 -4
- 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 +11 -11
package/README.md
CHANGED
|
@@ -17,8 +17,10 @@ npm install --save @opentelemetry/exporter-metrics-otlp-http
|
|
|
17
17
|
## Service Name
|
|
18
18
|
|
|
19
19
|
The OpenTelemetry Collector Metrics Exporter does not have a service name configuration.
|
|
20
|
-
In order to set the service name, use the `service.name` resource attribute as prescribed in
|
|
21
|
-
|
|
20
|
+
In order to set the service name, use the `service.name` resource attribute as prescribed in
|
|
21
|
+
the [OpenTelemetry Resource Semantic Conventions][semconv-resource-service-name].
|
|
22
|
+
To see sample code and documentation for the traces exporter, visit
|
|
23
|
+
the [Collector Trace Exporter for web and node][trace-exporter-url].
|
|
22
24
|
|
|
23
25
|
## Metrics in Web
|
|
24
26
|
|
|
@@ -27,12 +29,13 @@ The OTLPMetricExporter in Web expects the endpoint to end in `/v1/metrics`.
|
|
|
27
29
|
```js
|
|
28
30
|
import { MeterProvider, PeriodicExportingMetricReader } from '@opentelemetry/sdk-metrics';
|
|
29
31
|
import { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http';
|
|
32
|
+
|
|
30
33
|
const collectorOptions = {
|
|
31
34
|
url: '<opentelemetry-collector-url>', // url is optional and can be omitted - default is http://localhost:4318/v1/metrics
|
|
32
35
|
headers: {}, // an optional object containing custom headers to be sent with each request
|
|
33
36
|
concurrencyLimit: 1, // an optional limit on pending requests
|
|
34
37
|
};
|
|
35
|
-
const
|
|
38
|
+
const metricExporter = new OTLPMetricExporter(collectorOptions);
|
|
36
39
|
const meterProvider = new MeterProvider({});
|
|
37
40
|
|
|
38
41
|
meterProvider.addMetricReader(new PeriodicExportingMetricReader({
|
|
@@ -50,7 +53,7 @@ counter.add(10, { 'key': 'value' });
|
|
|
50
53
|
|
|
51
54
|
```js
|
|
52
55
|
const { MeterProvider, PeriodicExportingMetricReader } = require('@opentelemetry/sdk-metrics');
|
|
53
|
-
const { OTLPMetricExporter } =
|
|
56
|
+
const { OTLPMetricExporter } = require('@opentelemetry/exporter-metrics-otlp-http');
|
|
54
57
|
const collectorOptions = {
|
|
55
58
|
url: '<opentelemetry-collector-url>', // url is optional and can be omitted - default is http://localhost:4318/v1/metrics
|
|
56
59
|
concurrencyLimit: 1, // an optional limit on pending requests
|
|
@@ -70,35 +73,18 @@ counter.add(10, { 'key': 'value' });
|
|
|
70
73
|
|
|
71
74
|
```
|
|
72
75
|
|
|
73
|
-
##
|
|
74
|
-
|
|
75
|
-
For exporting metrics with GRPC please check [exporter-metrics-otlp-grpc][npm-url-grpc]
|
|
76
|
-
|
|
77
|
-
## PROTOBUF
|
|
78
|
-
|
|
79
|
-
For exporting metrics with PROTOBUF please check [exporter-metrics-otlp-proto][npm-url-proto]
|
|
80
|
-
|
|
81
|
-
## Configuration options as environment variables
|
|
76
|
+
## Environment Variable Configuration
|
|
82
77
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
```sh
|
|
86
|
-
OTEL_EXPORTER_OTLP_ENDPOINT=https://localhost:4318
|
|
87
|
-
# this will automatically append the version and signal path
|
|
88
|
-
# e.g. https://localhost:4318/v1/traces for `OTLPTraceExporter` and https://localhost:4318/v1/metrics for `OTLPMetricExporter`
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
If the trace and metric exporter endpoints have different providers, the env var for per-signal endpoints are available to use
|
|
92
|
-
|
|
93
|
-
```sh
|
|
94
|
-
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://trace-service:4318/v1/traces
|
|
95
|
-
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=https://metric-service:4318/v1/metrics
|
|
96
|
-
# version and signal needs to be explicit
|
|
97
|
-
```
|
|
78
|
+
In addition to settings passed to the constructor, the exporter also supports configuration via environment variables:
|
|
98
79
|
|
|
99
|
-
|
|
80
|
+
| Environment variable | Description |
|
|
81
|
+
|---------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
82
|
+
| OTEL_EXPORTER_OTLP_ENDPOINT | The endpoint to send metrics to. This will also be used for the traces exporter if `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` is not configured. By default `http://localhost:4318` will be used. `/v1/metrics` will be automatically appended to configured values. |
|
|
83
|
+
| OTEL_EXPORTER_OTLP_METRICS_ENDPOINT | The endpoint to send metrics to. By default `https://localhost:4318/v1/metrics` will be used. `v1/metrics` will not be appended automatically and has to be added explicitly. |
|
|
84
|
+
| OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE | The exporters aggregation temporality preference. Valid values are `cumulative`, and `delta`. `cumulative` selects cumulative temporality for all instrument kinds. `delta` selects delta aggregation temporality for Counter, Asynchronous Counter and Histogram instrument kinds, and selects cumulative aggregation for UpDownCounter and Asynchronous UpDownCounter instrument kinds. By default `cumulative` is used. |
|
|
100
85
|
|
|
101
|
-
|
|
86
|
+
> Settings configured programmatically take precedence over environment variables. Per-signal environment variables take
|
|
87
|
+
> precedence over non-per-signal environment variables.
|
|
102
88
|
|
|
103
89
|
## Running opentelemetry-collector locally to see the metrics
|
|
104
90
|
|
|
@@ -110,6 +96,8 @@ For more details, see [OpenTelemetry Specification on Protocol Exporter][opentel
|
|
|
110
96
|
- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
|
|
111
97
|
- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
|
|
112
98
|
- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]
|
|
99
|
+
- For exporting metrics via gRPC please check [exporter-metrics-otlp-grpc][npm-url-grpc]
|
|
100
|
+
- For exporting metrics via protobuf please check [exporter-metrics-otlp-proto][npm-url-proto]
|
|
113
101
|
|
|
114
102
|
## License
|
|
115
103
|
|
|
@@ -49,8 +49,9 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
49
49
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
+
import { getEnv } from '@opentelemetry/core';
|
|
52
53
|
import { AggregationTemporality, InstrumentType } from '@opentelemetry/sdk-metrics';
|
|
53
|
-
import {
|
|
54
|
+
import { diag } from '@opentelemetry/api';
|
|
54
55
|
export var CumulativeTemporalitySelector = function () { return AggregationTemporality.CUMULATIVE; };
|
|
55
56
|
export var DeltaTemporalitySelector = function (instrumentType) {
|
|
56
57
|
switch (instrumentType) {
|
|
@@ -64,17 +65,32 @@ export var DeltaTemporalitySelector = function (instrumentType) {
|
|
|
64
65
|
return AggregationTemporality.CUMULATIVE;
|
|
65
66
|
}
|
|
66
67
|
};
|
|
67
|
-
function
|
|
68
|
-
|
|
68
|
+
function chooseTemporalitySelectorFromEnvironment() {
|
|
69
|
+
var env = getEnv();
|
|
70
|
+
var configuredTemporality = env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE.trim().toLowerCase();
|
|
71
|
+
if (configuredTemporality === 'cumulative') {
|
|
72
|
+
return CumulativeTemporalitySelector;
|
|
73
|
+
}
|
|
74
|
+
if (configuredTemporality === 'delta') {
|
|
69
75
|
return DeltaTemporalitySelector;
|
|
70
76
|
}
|
|
77
|
+
diag.warn("OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '" + env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE + "', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.");
|
|
71
78
|
return CumulativeTemporalitySelector;
|
|
72
79
|
}
|
|
80
|
+
function chooseTemporalitySelector(temporalityPreference) {
|
|
81
|
+
// Directly passed preference has priority.
|
|
82
|
+
if (temporalityPreference != null) {
|
|
83
|
+
if (temporalityPreference === AggregationTemporality.DELTA) {
|
|
84
|
+
return DeltaTemporalitySelector;
|
|
85
|
+
}
|
|
86
|
+
return CumulativeTemporalitySelector;
|
|
87
|
+
}
|
|
88
|
+
return chooseTemporalitySelectorFromEnvironment();
|
|
89
|
+
}
|
|
73
90
|
var OTLPMetricExporterBase = /** @class */ (function () {
|
|
74
91
|
function OTLPMetricExporterBase(exporter, config) {
|
|
75
|
-
if (config === void 0) { config = defaultOptions; }
|
|
76
92
|
this._otlpExporter = exporter;
|
|
77
|
-
this._aggregationTemporalitySelector = chooseTemporalitySelector(config.temporalityPreference);
|
|
93
|
+
this._aggregationTemporalitySelector = chooseTemporalitySelector(config === null || config === void 0 ? void 0 : config.temporalityPreference);
|
|
78
94
|
}
|
|
79
95
|
OTLPMetricExporterBase.prototype.export = function (metrics, resultCallback) {
|
|
80
96
|
this._otlpExporter.export([metrics], resultCallback);
|
|
@@ -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,EAEL,MAAM,EACP,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,sBAAsB,EAEtB,cAAc,EAGf,MAAM,4BAA4B,CAAC;AAMpC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,MAAM,CAAC,IAAM,6BAA6B,GAAmC,cAAM,OAAA,sBAAsB,CAAC,UAAU,EAAjC,CAAiC,CAAC;AAErH,MAAM,CAAC,IAAM,wBAAwB,GAAmC,UAAC,cAA8B;IACrG,QAAQ,cAAc,EAAE;QACtB,KAAK,cAAc,CAAC,OAAO,CAAC;QAC5B,KAAK,cAAc,CAAC,kBAAkB,CAAC;QACvC,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,SAAS,wCAAwC;IAC/C,IAAM,GAAG,GAAG,MAAM,EAAE,CAAC;IACrB,IAAM,qBAAqB,GAAG,GAAG,CAAC,iDAAiD,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAEzG,IAAI,qBAAqB,KAAK,YAAY,EAAE;QAC1C,OAAO,6BAA6B,CAAC;KACtC;IACD,IAAI,qBAAqB,KAAK,OAAO,EAAE;QACrC,OAAO,wBAAwB,CAAC;KACjC;IAED,IAAI,CAAC,IAAI,CAAC,kEAAgE,GAAG,CAAC,iDAAiD,4FAAyF,CAAC,CAAC;IAC1N,OAAO,6BAA6B,CAAC;AACvC,CAAC;AAED,SAAS,yBAAyB,CAAC,qBAA8C;IAC/E,2CAA2C;IAC3C,IAAI,qBAAqB,IAAI,IAAI,EAAE;QACjC,IAAI,qBAAqB,KAAK,sBAAsB,CAAC,KAAK,EAAE;YAC1D,OAAO,wBAAwB,CAAC;SACjC;QACD,OAAO,6BAA6B,CAAC;KACtC;IAED,OAAO,wCAAwC,EAAE,CAAC;AACpD,CAAC;AAED;IAOE,gCAAY,QAAW,EACrB,MAAkC;QAClC,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAC;QAC9B,IAAI,CAAC,+BAA+B,GAAG,yBAAyB,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,qBAAqB,CAAC,CAAC;IAClG,CAAC;IAED,uCAAM,GAAN,UAAO,OAAwB,EAAE,cAA8C;QAC7E,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,6DAA4B,GAA5B,UAA6B,cAA8B;QACzD,OAAO,IAAI,CAAC,+BAA+B,CAAC,cAAc,CAAC,CAAC;IAC9D,CAAC;IACH,6BAAC;AAAD,CAAC,AA5BD,IA4BC","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 {\n ExportResult,\n getEnv\n} from '@opentelemetry/core';\nimport {\n AggregationTemporality,\n AggregationTemporalitySelector,\n InstrumentType,\n PushMetricExporter,\n ResourceMetrics\n} from '@opentelemetry/sdk-metrics';\nimport {\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 = () => AggregationTemporality.CUMULATIVE;\n\nexport const DeltaTemporalitySelector: AggregationTemporalitySelector = (instrumentType: InstrumentType) => {\n switch (instrumentType) {\n case InstrumentType.COUNTER:\n case InstrumentType.OBSERVABLE_COUNTER:\n case InstrumentType.HISTOGRAM:\n case InstrumentType.OBSERVABLE_GAUGE:\n return AggregationTemporality.DELTA;\n case InstrumentType.UP_DOWN_COUNTER:\n case InstrumentType.OBSERVABLE_UP_DOWN_COUNTER:\n return AggregationTemporality.CUMULATIVE;\n }\n};\n\nfunction chooseTemporalitySelectorFromEnvironment() {\n const env = getEnv();\n const configuredTemporality = 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\n diag.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`);\n return CumulativeTemporalitySelector;\n}\n\nfunction chooseTemporalitySelector(temporalityPreference?: AggregationTemporality): AggregationTemporalitySelector {\n // Directly passed preference has priority.\n if (temporalityPreference != null) {\n if (temporalityPreference === AggregationTemporality.DELTA) {\n return DeltaTemporalitySelector;\n }\n return CumulativeTemporalitySelector;\n }\n\n return chooseTemporalitySelectorFromEnvironment();\n}\n\nexport class OTLPMetricExporterBase<T extends OTLPExporterBase<OTLPMetricExporterOptions,\n ResourceMetrics,\n IExportMetricsServiceRequest>>\nimplements PushMetricExporter {\n public _otlpExporter: T;\n protected _aggregationTemporalitySelector: AggregationTemporalitySelector;\n\n constructor(exporter: T,\n config?: OTLPMetricExporterOptions) {\n this._otlpExporter = exporter;\n this._aggregationTemporalitySelector = chooseTemporalitySelector(config?.temporalityPreference);\n }\n\n export(metrics: ResourceMetrics, resultCallback: (result: ExportResult) => void): void {\n this._otlpExporter.export([metrics], resultCallback);\n }\n\n async shutdown(): Promise<void> {\n await this._otlpExporter.shutdown();\n }\n\n forceFlush(): Promise<void> {\n return Promise.resolve();\n }\n\n selectAggregationTemporality(instrumentType: InstrumentType): AggregationTemporality {\n return this._aggregationTemporalitySelector(instrumentType);\n }\n}\n"]}
|
|
@@ -3,8 +3,4 @@ import { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base';
|
|
|
3
3
|
export interface OTLPMetricExporterOptions extends OTLPExporterConfigBase {
|
|
4
4
|
temporalityPreference?: AggregationTemporality;
|
|
5
5
|
}
|
|
6
|
-
export declare const defaultExporterTemporality = AggregationTemporality.CUMULATIVE;
|
|
7
|
-
export declare const defaultOptions: {
|
|
8
|
-
temporalityPreference: AggregationTemporality;
|
|
9
|
-
};
|
|
10
6
|
//# sourceMappingURL=OTLPMetricExporterOptions.d.ts.map
|
|
@@ -13,7 +13,5 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
|
-
export var defaultExporterTemporality = AggregationTemporality.CUMULATIVE;
|
|
18
|
-
export var defaultOptions = { temporalityPreference: defaultExporterTemporality };
|
|
16
|
+
export {};
|
|
19
17
|
//# sourceMappingURL=OTLPMetricExporterOptions.js.map
|
|
@@ -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","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AggregationTemporality } from '@opentelemetry/sdk-metrics';\nimport { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base';\n\nexport interface OTLPMetricExporterOptions extends OTLPExporterConfigBase {\n temporalityPreference?: AggregationTemporality\n}\n"]}
|
|
@@ -29,7 +29,6 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
29
29
|
};
|
|
30
30
|
})();
|
|
31
31
|
import { baggageUtils, getEnv } from '@opentelemetry/core';
|
|
32
|
-
import { defaultOptions } from '../../OTLPMetricExporterOptions';
|
|
33
32
|
import { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';
|
|
34
33
|
import { OTLPExporterBrowserBase, appendResourcePathToUrl, appendRootPathToUrlIfNeeded } from '@opentelemetry/otlp-exporter-base';
|
|
35
34
|
import { createExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';
|
|
@@ -38,7 +37,6 @@ var DEFAULT_COLLECTOR_URL = "http://localhost:4318/" + DEFAULT_COLLECTOR_RESOURC
|
|
|
38
37
|
var OTLPExporterBrowserProxy = /** @class */ (function (_super) {
|
|
39
38
|
__extends(OTLPExporterBrowserProxy, _super);
|
|
40
39
|
function OTLPExporterBrowserProxy(config) {
|
|
41
|
-
if (config === void 0) { config = defaultOptions; }
|
|
42
40
|
var _this = _super.call(this, config) || this;
|
|
43
41
|
_this._headers = Object.assign(_this._headers, baggageUtils.parseKeyPairsIntoRecord(getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS));
|
|
44
42
|
return _this;
|
|
@@ -47,7 +45,7 @@ var OTLPExporterBrowserProxy = /** @class */ (function (_super) {
|
|
|
47
45
|
return typeof config.url === 'string'
|
|
48
46
|
? config.url
|
|
49
47
|
: getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0
|
|
50
|
-
? appendRootPathToUrlIfNeeded(getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT
|
|
48
|
+
? appendRootPathToUrlIfNeeded(getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT)
|
|
51
49
|
: getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0
|
|
52
50
|
? appendResourcePathToUrl(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)
|
|
53
51
|
: DEFAULT_COLLECTOR_URL;
|
|
@@ -63,7 +61,6 @@ var OTLPExporterBrowserProxy = /** @class */ (function (_super) {
|
|
|
63
61
|
var OTLPMetricExporter = /** @class */ (function (_super) {
|
|
64
62
|
__extends(OTLPMetricExporter, _super);
|
|
65
63
|
function OTLPMetricExporter(config) {
|
|
66
|
-
if (config === void 0) { config = defaultOptions; }
|
|
67
64
|
return _super.call(this, new OTLPExporterBrowserProxy(config), config) || this;
|
|
68
65
|
}
|
|
69
66
|
return OTLPMetricExporter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../../../src/platform/browser/OTLPMetricExporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../../../src/platform/browser/OTLPMetricExporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EACL,uBAAuB,EAEvB,uBAAuB,EACvB,2BAA2B,EAC5B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,iCAAiC,EAAgC,MAAM,iCAAiC,CAAC;AAElH,IAAM,+BAA+B,GAAG,YAAY,CAAC;AACrD,IAAM,qBAAqB,GAAG,2BAAyB,+BAAiC,CAAC;AAEzF;IAAuC,4CAAsE;IAE3G,kCAAY,MAA2D;QAAvE,YACE,kBAAM,MAAM,CAAC,SAOd;QANC,KAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAC3B,KAAI,CAAC,QAAQ,EACb,YAAY,CAAC,uBAAuB,CAClC,MAAM,EAAE,CAAC,kCAAkC,CAC5C,CACF,CAAC;;IACJ,CAAC;IAED,gDAAa,GAAb,UAAc,MAA8B;QAC1C,OAAO,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ;YACnC,CAAC,CAAC,MAAM,CAAC,GAAG;YACZ,CAAC,CAAC,MAAM,EAAE,CAAC,mCAAmC,CAAC,MAAM,GAAG,CAAC;gBACvD,CAAC,CAAC,2BAA2B,CAAC,MAAM,EAAE,CAAC,mCAAmC,CAAC;gBAC3E,CAAC,CAAC,MAAM,EAAE,CAAC,2BAA2B,CAAC,MAAM,GAAG,CAAC;oBAC/C,CAAC,CAAC,uBAAuB,CAAC,MAAM,EAAE,CAAC,2BAA2B,EAAE,+BAA+B,CAAC;oBAChG,CAAC,CAAC,qBAAqB,CAAC;IAChC,CAAC;IAED,0CAAO,GAAP,UAAQ,OAA0B;QAChC,OAAO,iCAAiC,CAAC,OAAO,CAAC,CAAC;IACpD,CAAC;IACH,+BAAC;AAAD,CAAC,AAzBD,CAAuC,uBAAuB,GAyB7D;AAED;;GAEG;AACH;IAAwC,sCAAgD;IACtF,4BAAY,MAA2D;eACrE,kBAAM,IAAI,wBAAwB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACrD,CAAC;IACH,yBAAC;AAAD,CAAC,AAJD,CAAwC,sBAAsB,GAI7D","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ResourceMetrics } from '@opentelemetry/sdk-metrics';\nimport { baggageUtils, getEnv } from '@opentelemetry/core';\nimport { OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions';\nimport { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';\nimport {\n OTLPExporterBrowserBase,\n OTLPExporterConfigBase,\n appendResourcePathToUrl,\n appendRootPathToUrlIfNeeded\n} from '@opentelemetry/otlp-exporter-base';\nimport { createExportMetricsServiceRequest, IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';\n\nconst DEFAULT_COLLECTOR_RESOURCE_PATH = 'v1/metrics';\nconst DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`;\n\nclass OTLPExporterBrowserProxy extends OTLPExporterBrowserBase<ResourceMetrics, IExportMetricsServiceRequest> {\n\n constructor(config?: OTLPMetricExporterOptions & OTLPExporterConfigBase) {\n super(config);\n this._headers = Object.assign(\n this._headers,\n baggageUtils.parseKeyPairsIntoRecord(\n getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS\n )\n );\n }\n\n getDefaultUrl(config: OTLPExporterConfigBase): string {\n return typeof config.url === 'string'\n ? config.url\n : getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0\n ? appendRootPathToUrlIfNeeded(getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT)\n : getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0\n ? appendResourcePathToUrl(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)\n : DEFAULT_COLLECTOR_URL;\n }\n\n convert(metrics: ResourceMetrics[]): IExportMetricsServiceRequest {\n return createExportMetricsServiceRequest(metrics);\n }\n}\n\n/**\n * Collector Metric Exporter for Web\n */\nexport class OTLPMetricExporter extends OTLPMetricExporterBase<OTLPExporterBrowserProxy> {\n constructor(config?: OTLPExporterConfigBase & OTLPMetricExporterOptions) {\n super(new OTLPExporterBrowserProxy(config), config);\n }\n}\n"]}
|
|
@@ -29,7 +29,6 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
29
29
|
};
|
|
30
30
|
})();
|
|
31
31
|
import { getEnv, baggageUtils } from '@opentelemetry/core';
|
|
32
|
-
import { defaultOptions } from '../../OTLPMetricExporterOptions';
|
|
33
32
|
import { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';
|
|
34
33
|
import { OTLPExporterNodeBase, appendResourcePathToUrl, appendRootPathToUrlIfNeeded } from '@opentelemetry/otlp-exporter-base';
|
|
35
34
|
import { createExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';
|
|
@@ -38,7 +37,6 @@ var DEFAULT_COLLECTOR_URL = "http://localhost:4318/" + DEFAULT_COLLECTOR_RESOURC
|
|
|
38
37
|
var OTLPExporterNodeProxy = /** @class */ (function (_super) {
|
|
39
38
|
__extends(OTLPExporterNodeProxy, _super);
|
|
40
39
|
function OTLPExporterNodeProxy(config) {
|
|
41
|
-
if (config === void 0) { config = defaultOptions; }
|
|
42
40
|
var _this = _super.call(this, config) || this;
|
|
43
41
|
_this.headers = Object.assign(_this.headers, baggageUtils.parseKeyPairsIntoRecord(getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS));
|
|
44
42
|
return _this;
|
|
@@ -50,7 +48,7 @@ var OTLPExporterNodeProxy = /** @class */ (function (_super) {
|
|
|
50
48
|
return typeof config.url === 'string'
|
|
51
49
|
? config.url
|
|
52
50
|
: getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0
|
|
53
|
-
? appendRootPathToUrlIfNeeded(getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT
|
|
51
|
+
? appendRootPathToUrlIfNeeded(getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT)
|
|
54
52
|
: getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0
|
|
55
53
|
? appendResourcePathToUrl(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)
|
|
56
54
|
: DEFAULT_COLLECTOR_URL;
|
|
@@ -63,7 +61,6 @@ var OTLPExporterNodeProxy = /** @class */ (function (_super) {
|
|
|
63
61
|
var OTLPMetricExporter = /** @class */ (function (_super) {
|
|
64
62
|
__extends(OTLPMetricExporter, _super);
|
|
65
63
|
function OTLPMetricExporter(config) {
|
|
66
|
-
if (config === void 0) { config = defaultOptions; }
|
|
67
64
|
return _super.call(this, new OTLPExporterNodeProxy(config), config) || this;
|
|
68
65
|
}
|
|
69
66
|
return OTLPMetricExporter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../../../src/platform/node/OTLPMetricExporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;AAGH,OAAO,EAAE,MAAM,EAAE,YAAY,EAAC,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../../../src/platform/node/OTLPMetricExporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;AAGH,OAAO,EAAE,MAAM,EAAE,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EACL,oBAAoB,EAEpB,uBAAuB,EACvB,2BAA2B,EAC5B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,iCAAiC,EAAgC,MAAM,iCAAiC,CAAC;AAElH,IAAM,+BAA+B,GAAG,YAAY,CAAC;AACrD,IAAM,qBAAqB,GAAG,2BAAyB,+BAAiC,CAAC;AAEzF;IAAoC,yCAAmE;IAErG,+BAAY,MAA+D;QAA3E,YACE,kBAAM,MAAM,CAAC,SAOd;QANC,KAAI,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAC1B,KAAI,CAAC,OAAO,EACZ,YAAY,CAAC,uBAAuB,CAClC,MAAM,EAAE,CAAC,kCAAkC,CAC5C,CACF,CAAC;;IACJ,CAAC;IAED,uCAAO,GAAP,UAAQ,OAA0B;QAChC,OAAO,iCAAiC,CAAC,OAAO,CAAC,CAAC;IACpD,CAAC;IAED,6CAAa,GAAb,UAAc,MAAkC;QAC9C,OAAO,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ;YACnC,CAAC,CAAC,MAAM,CAAC,GAAG;YACZ,CAAC,CAAC,MAAM,EAAE,CAAC,mCAAmC,CAAC,MAAM,GAAG,CAAC;gBACvD,CAAC,CAAC,2BAA2B,CAAC,MAAM,EAAE,CAAC,mCAAmC,CAAC;gBAC3E,CAAC,CAAC,MAAM,EAAE,CAAC,2BAA2B,CAAC,MAAM,GAAG,CAAC;oBAC/C,CAAC,CAAC,uBAAuB,CAAC,MAAM,EAAE,CAAC,2BAA2B,EAAE,+BAA+B,CAAC;oBAChG,CAAC,CAAC,qBAAqB,CAAC;IAChC,CAAC;IACH,4BAAC;AAAD,CAAC,AAzBD,CAAoC,oBAAoB,GAyBvD;AAED;;GAEG;AACH;IAAwC,sCAA6C;IACnF,4BAAY,MAA+D;eACzE,kBAAM,IAAI,qBAAqB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAClD,CAAC;IACH,yBAAC;AAAD,CAAC,AAJD,CAAwC,sBAAsB,GAI7D","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ResourceMetrics } from '@opentelemetry/sdk-metrics';\nimport { getEnv, baggageUtils} from '@opentelemetry/core';\nimport { OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions';\nimport { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';\nimport {\n OTLPExporterNodeBase,\n OTLPExporterNodeConfigBase,\n appendResourcePathToUrl,\n appendRootPathToUrlIfNeeded\n} from '@opentelemetry/otlp-exporter-base';\nimport { createExportMetricsServiceRequest, IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';\n\nconst DEFAULT_COLLECTOR_RESOURCE_PATH = 'v1/metrics';\nconst DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`;\n\nclass OTLPExporterNodeProxy extends OTLPExporterNodeBase<ResourceMetrics, IExportMetricsServiceRequest> {\n\n constructor(config?: OTLPExporterNodeConfigBase & OTLPMetricExporterOptions) {\n super(config);\n this.headers = Object.assign(\n this.headers,\n baggageUtils.parseKeyPairsIntoRecord(\n getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS\n )\n );\n }\n\n convert(metrics: ResourceMetrics[]): IExportMetricsServiceRequest {\n return createExportMetricsServiceRequest(metrics);\n }\n\n getDefaultUrl(config: OTLPExporterNodeConfigBase): string {\n return typeof config.url === 'string'\n ? config.url\n : getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0\n ? appendRootPathToUrlIfNeeded(getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT)\n : getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0\n ? appendResourcePathToUrl(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)\n : DEFAULT_COLLECTOR_URL;\n }\n}\n\n/**\n * Collector Metric Exporter for Node\n */\nexport class OTLPMetricExporter extends OTLPMetricExporterBase<OTLPExporterNodeProxy> {\n constructor(config?: OTLPExporterNodeConfigBase & OTLPMetricExporterOptions) {\n super(new OTLPExporterNodeProxy(config), config);\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.34.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.34.0';\n"]}
|
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { getEnv } from '@opentelemetry/core';
|
|
16
17
|
import { AggregationTemporality, InstrumentType } from '@opentelemetry/sdk-metrics';
|
|
17
|
-
import {
|
|
18
|
+
import { diag } from '@opentelemetry/api';
|
|
18
19
|
export const CumulativeTemporalitySelector = () => AggregationTemporality.CUMULATIVE;
|
|
19
20
|
export const DeltaTemporalitySelector = (instrumentType) => {
|
|
20
21
|
switch (instrumentType) {
|
|
@@ -28,16 +29,32 @@ export const DeltaTemporalitySelector = (instrumentType) => {
|
|
|
28
29
|
return AggregationTemporality.CUMULATIVE;
|
|
29
30
|
}
|
|
30
31
|
};
|
|
31
|
-
function
|
|
32
|
-
|
|
32
|
+
function chooseTemporalitySelectorFromEnvironment() {
|
|
33
|
+
const env = getEnv();
|
|
34
|
+
const configuredTemporality = env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE.trim().toLowerCase();
|
|
35
|
+
if (configuredTemporality === 'cumulative') {
|
|
36
|
+
return CumulativeTemporalitySelector;
|
|
37
|
+
}
|
|
38
|
+
if (configuredTemporality === 'delta') {
|
|
33
39
|
return DeltaTemporalitySelector;
|
|
34
40
|
}
|
|
41
|
+
diag.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`);
|
|
35
42
|
return CumulativeTemporalitySelector;
|
|
36
43
|
}
|
|
44
|
+
function chooseTemporalitySelector(temporalityPreference) {
|
|
45
|
+
// Directly passed preference has priority.
|
|
46
|
+
if (temporalityPreference != null) {
|
|
47
|
+
if (temporalityPreference === AggregationTemporality.DELTA) {
|
|
48
|
+
return DeltaTemporalitySelector;
|
|
49
|
+
}
|
|
50
|
+
return CumulativeTemporalitySelector;
|
|
51
|
+
}
|
|
52
|
+
return chooseTemporalitySelectorFromEnvironment();
|
|
53
|
+
}
|
|
37
54
|
export class OTLPMetricExporterBase {
|
|
38
|
-
constructor(exporter, config
|
|
55
|
+
constructor(exporter, config) {
|
|
39
56
|
this._otlpExporter = exporter;
|
|
40
|
-
this._aggregationTemporalitySelector = chooseTemporalitySelector(config.temporalityPreference);
|
|
57
|
+
this._aggregationTemporalitySelector = chooseTemporalitySelector(config === null || config === void 0 ? void 0 : config.temporalityPreference);
|
|
41
58
|
}
|
|
42
59
|
export(metrics, resultCallback) {
|
|
43
60
|
this._otlpExporter.export([metrics], resultCallback);
|
|
@@ -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,EAEL,MAAM,EACP,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,sBAAsB,EAEtB,cAAc,EAGf,MAAM,4BAA4B,CAAC;AAMpC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,MAAM,CAAC,MAAM,6BAA6B,GAAmC,GAAG,EAAE,CAAC,sBAAsB,CAAC,UAAU,CAAC;AAErH,MAAM,CAAC,MAAM,wBAAwB,GAAmC,CAAC,cAA8B,EAAE,EAAE;IACzG,QAAQ,cAAc,EAAE;QACtB,KAAK,cAAc,CAAC,OAAO,CAAC;QAC5B,KAAK,cAAc,CAAC,kBAAkB,CAAC;QACvC,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,SAAS,wCAAwC;IAC/C,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;IACrB,MAAM,qBAAqB,GAAG,GAAG,CAAC,iDAAiD,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAEzG,IAAI,qBAAqB,KAAK,YAAY,EAAE;QAC1C,OAAO,6BAA6B,CAAC;KACtC;IACD,IAAI,qBAAqB,KAAK,OAAO,EAAE;QACrC,OAAO,wBAAwB,CAAC;KACjC;IAED,IAAI,CAAC,IAAI,CAAC,gEAAgE,GAAG,CAAC,iDAAiD,yFAAyF,CAAC,CAAC;IAC1N,OAAO,6BAA6B,CAAC;AACvC,CAAC;AAED,SAAS,yBAAyB,CAAC,qBAA8C;IAC/E,2CAA2C;IAC3C,IAAI,qBAAqB,IAAI,IAAI,EAAE;QACjC,IAAI,qBAAqB,KAAK,sBAAsB,CAAC,KAAK,EAAE;YAC1D,OAAO,wBAAwB,CAAC;SACjC;QACD,OAAO,6BAA6B,CAAC;KACtC;IAED,OAAO,wCAAwC,EAAE,CAAC;AACpD,CAAC;AAED,MAAM,OAAO,sBAAsB;IAOjC,YAAY,QAAW,EACrB,MAAkC;QAClC,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAC;QAC9B,IAAI,CAAC,+BAA+B,GAAG,yBAAyB,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,qBAAqB,CAAC,CAAC;IAClG,CAAC;IAED,MAAM,CAAC,OAAwB,EAAE,cAA8C;QAC7E,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,MAAM,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC;IACtC,CAAC;IAED,UAAU;QACR,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,4BAA4B,CAAC,cAA8B;QACzD,OAAO,IAAI,CAAC,+BAA+B,CAAC,cAAc,CAAC,CAAC;IAC9D,CAAC;CACF","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 {\n ExportResult,\n getEnv\n} from '@opentelemetry/core';\nimport {\n AggregationTemporality,\n AggregationTemporalitySelector,\n InstrumentType,\n PushMetricExporter,\n ResourceMetrics\n} from '@opentelemetry/sdk-metrics';\nimport {\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 = () => AggregationTemporality.CUMULATIVE;\n\nexport const DeltaTemporalitySelector: AggregationTemporalitySelector = (instrumentType: InstrumentType) => {\n switch (instrumentType) {\n case InstrumentType.COUNTER:\n case InstrumentType.OBSERVABLE_COUNTER:\n case InstrumentType.HISTOGRAM:\n case InstrumentType.OBSERVABLE_GAUGE:\n return AggregationTemporality.DELTA;\n case InstrumentType.UP_DOWN_COUNTER:\n case InstrumentType.OBSERVABLE_UP_DOWN_COUNTER:\n return AggregationTemporality.CUMULATIVE;\n }\n};\n\nfunction chooseTemporalitySelectorFromEnvironment() {\n const env = getEnv();\n const configuredTemporality = 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\n diag.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`);\n return CumulativeTemporalitySelector;\n}\n\nfunction chooseTemporalitySelector(temporalityPreference?: AggregationTemporality): AggregationTemporalitySelector {\n // Directly passed preference has priority.\n if (temporalityPreference != null) {\n if (temporalityPreference === AggregationTemporality.DELTA) {\n return DeltaTemporalitySelector;\n }\n return CumulativeTemporalitySelector;\n }\n\n return chooseTemporalitySelectorFromEnvironment();\n}\n\nexport class OTLPMetricExporterBase<T extends OTLPExporterBase<OTLPMetricExporterOptions,\n ResourceMetrics,\n IExportMetricsServiceRequest>>\nimplements PushMetricExporter {\n public _otlpExporter: T;\n protected _aggregationTemporalitySelector: AggregationTemporalitySelector;\n\n constructor(exporter: T,\n config?: OTLPMetricExporterOptions) {\n this._otlpExporter = exporter;\n this._aggregationTemporalitySelector = chooseTemporalitySelector(config?.temporalityPreference);\n }\n\n export(metrics: ResourceMetrics, resultCallback: (result: ExportResult) => void): void {\n this._otlpExporter.export([metrics], resultCallback);\n }\n\n async shutdown(): Promise<void> {\n await this._otlpExporter.shutdown();\n }\n\n forceFlush(): Promise<void> {\n return Promise.resolve();\n }\n\n selectAggregationTemporality(instrumentType: InstrumentType): AggregationTemporality {\n return this._aggregationTemporalitySelector(instrumentType);\n }\n}\n"]}
|
|
@@ -3,8 +3,4 @@ import { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base';
|
|
|
3
3
|
export interface OTLPMetricExporterOptions extends OTLPExporterConfigBase {
|
|
4
4
|
temporalityPreference?: AggregationTemporality;
|
|
5
5
|
}
|
|
6
|
-
export declare const defaultExporterTemporality = AggregationTemporality.CUMULATIVE;
|
|
7
|
-
export declare const defaultOptions: {
|
|
8
|
-
temporalityPreference: AggregationTemporality;
|
|
9
|
-
};
|
|
10
6
|
//# sourceMappingURL=OTLPMetricExporterOptions.d.ts.map
|
|
@@ -13,7 +13,5 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
|
-
export const defaultExporterTemporality = AggregationTemporality.CUMULATIVE;
|
|
18
|
-
export const defaultOptions = { temporalityPreference: defaultExporterTemporality };
|
|
16
|
+
export {};
|
|
19
17
|
//# sourceMappingURL=OTLPMetricExporterOptions.js.map
|
|
@@ -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","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AggregationTemporality } from '@opentelemetry/sdk-metrics';\nimport { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base';\n\nexport interface OTLPMetricExporterOptions extends OTLPExporterConfigBase {\n temporalityPreference?: AggregationTemporality\n}\n"]}
|
|
@@ -14,14 +14,13 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { baggageUtils, getEnv } from '@opentelemetry/core';
|
|
17
|
-
import { defaultOptions } from '../../OTLPMetricExporterOptions';
|
|
18
17
|
import { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';
|
|
19
18
|
import { OTLPExporterBrowserBase, appendResourcePathToUrl, appendRootPathToUrlIfNeeded } from '@opentelemetry/otlp-exporter-base';
|
|
20
19
|
import { createExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';
|
|
21
20
|
const DEFAULT_COLLECTOR_RESOURCE_PATH = 'v1/metrics';
|
|
22
21
|
const DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`;
|
|
23
22
|
class OTLPExporterBrowserProxy extends OTLPExporterBrowserBase {
|
|
24
|
-
constructor(config
|
|
23
|
+
constructor(config) {
|
|
25
24
|
super(config);
|
|
26
25
|
this._headers = Object.assign(this._headers, baggageUtils.parseKeyPairsIntoRecord(getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS));
|
|
27
26
|
}
|
|
@@ -29,7 +28,7 @@ class OTLPExporterBrowserProxy extends OTLPExporterBrowserBase {
|
|
|
29
28
|
return typeof config.url === 'string'
|
|
30
29
|
? config.url
|
|
31
30
|
: getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0
|
|
32
|
-
? appendRootPathToUrlIfNeeded(getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT
|
|
31
|
+
? appendRootPathToUrlIfNeeded(getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT)
|
|
33
32
|
: getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0
|
|
34
33
|
? appendResourcePathToUrl(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)
|
|
35
34
|
: DEFAULT_COLLECTOR_URL;
|
|
@@ -42,7 +41,7 @@ class OTLPExporterBrowserProxy extends OTLPExporterBrowserBase {
|
|
|
42
41
|
* Collector Metric Exporter for Web
|
|
43
42
|
*/
|
|
44
43
|
export class OTLPMetricExporter extends OTLPMetricExporterBase {
|
|
45
|
-
constructor(config
|
|
44
|
+
constructor(config) {
|
|
46
45
|
super(new OTLPExporterBrowserProxy(config), config);
|
|
47
46
|
}
|
|
48
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../../../src/platform/browser/OTLPMetricExporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../../../src/platform/browser/OTLPMetricExporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EACL,uBAAuB,EAEvB,uBAAuB,EACvB,2BAA2B,EAC5B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,iCAAiC,EAAgC,MAAM,iCAAiC,CAAC;AAElH,MAAM,+BAA+B,GAAG,YAAY,CAAC;AACrD,MAAM,qBAAqB,GAAG,yBAAyB,+BAA+B,EAAE,CAAC;AAEzF,MAAM,wBAAyB,SAAQ,uBAAsE;IAE3G,YAAY,MAA2D;QACrE,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAC3B,IAAI,CAAC,QAAQ,EACb,YAAY,CAAC,uBAAuB,CAClC,MAAM,EAAE,CAAC,kCAAkC,CAC5C,CACF,CAAC;IACJ,CAAC;IAED,aAAa,CAAC,MAA8B;QAC1C,OAAO,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ;YACnC,CAAC,CAAC,MAAM,CAAC,GAAG;YACZ,CAAC,CAAC,MAAM,EAAE,CAAC,mCAAmC,CAAC,MAAM,GAAG,CAAC;gBACvD,CAAC,CAAC,2BAA2B,CAAC,MAAM,EAAE,CAAC,mCAAmC,CAAC;gBAC3E,CAAC,CAAC,MAAM,EAAE,CAAC,2BAA2B,CAAC,MAAM,GAAG,CAAC;oBAC/C,CAAC,CAAC,uBAAuB,CAAC,MAAM,EAAE,CAAC,2BAA2B,EAAE,+BAA+B,CAAC;oBAChG,CAAC,CAAC,qBAAqB,CAAC;IAChC,CAAC;IAED,OAAO,CAAC,OAA0B;QAChC,OAAO,iCAAiC,CAAC,OAAO,CAAC,CAAC;IACpD,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,sBAAgD;IACtF,YAAY,MAA2D;QACrE,KAAK,CAAC,IAAI,wBAAwB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;IACtD,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ResourceMetrics } from '@opentelemetry/sdk-metrics';\nimport { baggageUtils, getEnv } from '@opentelemetry/core';\nimport { OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions';\nimport { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';\nimport {\n OTLPExporterBrowserBase,\n OTLPExporterConfigBase,\n appendResourcePathToUrl,\n appendRootPathToUrlIfNeeded\n} from '@opentelemetry/otlp-exporter-base';\nimport { createExportMetricsServiceRequest, IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';\n\nconst DEFAULT_COLLECTOR_RESOURCE_PATH = 'v1/metrics';\nconst DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`;\n\nclass OTLPExporterBrowserProxy extends OTLPExporterBrowserBase<ResourceMetrics, IExportMetricsServiceRequest> {\n\n constructor(config?: OTLPMetricExporterOptions & OTLPExporterConfigBase) {\n super(config);\n this._headers = Object.assign(\n this._headers,\n baggageUtils.parseKeyPairsIntoRecord(\n getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS\n )\n );\n }\n\n getDefaultUrl(config: OTLPExporterConfigBase): string {\n return typeof config.url === 'string'\n ? config.url\n : getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0\n ? appendRootPathToUrlIfNeeded(getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT)\n : getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0\n ? appendResourcePathToUrl(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)\n : DEFAULT_COLLECTOR_URL;\n }\n\n convert(metrics: ResourceMetrics[]): IExportMetricsServiceRequest {\n return createExportMetricsServiceRequest(metrics);\n }\n}\n\n/**\n * Collector Metric Exporter for Web\n */\nexport class OTLPMetricExporter extends OTLPMetricExporterBase<OTLPExporterBrowserProxy> {\n constructor(config?: OTLPExporterConfigBase & OTLPMetricExporterOptions) {\n super(new OTLPExporterBrowserProxy(config), config);\n }\n}\n"]}
|
|
@@ -14,14 +14,13 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { getEnv, baggageUtils } from '@opentelemetry/core';
|
|
17
|
-
import { defaultOptions } from '../../OTLPMetricExporterOptions';
|
|
18
17
|
import { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';
|
|
19
18
|
import { OTLPExporterNodeBase, appendResourcePathToUrl, appendRootPathToUrlIfNeeded } from '@opentelemetry/otlp-exporter-base';
|
|
20
19
|
import { createExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';
|
|
21
20
|
const DEFAULT_COLLECTOR_RESOURCE_PATH = 'v1/metrics';
|
|
22
21
|
const DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`;
|
|
23
22
|
class OTLPExporterNodeProxy extends OTLPExporterNodeBase {
|
|
24
|
-
constructor(config
|
|
23
|
+
constructor(config) {
|
|
25
24
|
super(config);
|
|
26
25
|
this.headers = Object.assign(this.headers, baggageUtils.parseKeyPairsIntoRecord(getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS));
|
|
27
26
|
}
|
|
@@ -32,7 +31,7 @@ class OTLPExporterNodeProxy extends OTLPExporterNodeBase {
|
|
|
32
31
|
return typeof config.url === 'string'
|
|
33
32
|
? config.url
|
|
34
33
|
: getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0
|
|
35
|
-
? appendRootPathToUrlIfNeeded(getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT
|
|
34
|
+
? appendRootPathToUrlIfNeeded(getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT)
|
|
36
35
|
: getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0
|
|
37
36
|
? appendResourcePathToUrl(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)
|
|
38
37
|
: DEFAULT_COLLECTOR_URL;
|
|
@@ -42,7 +41,7 @@ class OTLPExporterNodeProxy extends OTLPExporterNodeBase {
|
|
|
42
41
|
* Collector Metric Exporter for Node
|
|
43
42
|
*/
|
|
44
43
|
export class OTLPMetricExporter extends OTLPMetricExporterBase {
|
|
45
|
-
constructor(config
|
|
44
|
+
constructor(config) {
|
|
46
45
|
super(new OTLPExporterNodeProxy(config), config);
|
|
47
46
|
}
|
|
48
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../../../src/platform/node/OTLPMetricExporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,MAAM,EAAE,YAAY,EAAC,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../../../src/platform/node/OTLPMetricExporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,MAAM,EAAE,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EACL,oBAAoB,EAEpB,uBAAuB,EACvB,2BAA2B,EAC5B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,iCAAiC,EAAgC,MAAM,iCAAiC,CAAC;AAElH,MAAM,+BAA+B,GAAG,YAAY,CAAC;AACrD,MAAM,qBAAqB,GAAG,yBAAyB,+BAA+B,EAAE,CAAC;AAEzF,MAAM,qBAAsB,SAAQ,oBAAmE;IAErG,YAAY,MAA+D;QACzE,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAC1B,IAAI,CAAC,OAAO,EACZ,YAAY,CAAC,uBAAuB,CAClC,MAAM,EAAE,CAAC,kCAAkC,CAC5C,CACF,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,OAA0B;QAChC,OAAO,iCAAiC,CAAC,OAAO,CAAC,CAAC;IACpD,CAAC;IAED,aAAa,CAAC,MAAkC;QAC9C,OAAO,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ;YACnC,CAAC,CAAC,MAAM,CAAC,GAAG;YACZ,CAAC,CAAC,MAAM,EAAE,CAAC,mCAAmC,CAAC,MAAM,GAAG,CAAC;gBACvD,CAAC,CAAC,2BAA2B,CAAC,MAAM,EAAE,CAAC,mCAAmC,CAAC;gBAC3E,CAAC,CAAC,MAAM,EAAE,CAAC,2BAA2B,CAAC,MAAM,GAAG,CAAC;oBAC/C,CAAC,CAAC,uBAAuB,CAAC,MAAM,EAAE,CAAC,2BAA2B,EAAE,+BAA+B,CAAC;oBAChG,CAAC,CAAC,qBAAqB,CAAC;IAChC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,sBAA6C;IACnF,YAAY,MAA+D;QACzE,KAAK,CAAC,IAAI,qBAAqB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;IACnD,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ResourceMetrics } from '@opentelemetry/sdk-metrics';\nimport { getEnv, baggageUtils} from '@opentelemetry/core';\nimport { OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions';\nimport { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';\nimport {\n OTLPExporterNodeBase,\n OTLPExporterNodeConfigBase,\n appendResourcePathToUrl,\n appendRootPathToUrlIfNeeded\n} from '@opentelemetry/otlp-exporter-base';\nimport { createExportMetricsServiceRequest, IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';\n\nconst DEFAULT_COLLECTOR_RESOURCE_PATH = 'v1/metrics';\nconst DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`;\n\nclass OTLPExporterNodeProxy extends OTLPExporterNodeBase<ResourceMetrics, IExportMetricsServiceRequest> {\n\n constructor(config?: OTLPExporterNodeConfigBase & OTLPMetricExporterOptions) {\n super(config);\n this.headers = Object.assign(\n this.headers,\n baggageUtils.parseKeyPairsIntoRecord(\n getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS\n )\n );\n }\n\n convert(metrics: ResourceMetrics[]): IExportMetricsServiceRequest {\n return createExportMetricsServiceRequest(metrics);\n }\n\n getDefaultUrl(config: OTLPExporterNodeConfigBase): string {\n return typeof config.url === 'string'\n ? config.url\n : getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0\n ? appendRootPathToUrlIfNeeded(getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT)\n : getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0\n ? appendResourcePathToUrl(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)\n : DEFAULT_COLLECTOR_URL;\n }\n}\n\n/**\n * Collector Metric Exporter for Node\n */\nexport class OTLPMetricExporter extends OTLPMetricExporterBase<OTLPExporterNodeProxy> {\n constructor(config?: OTLPExporterNodeConfigBase & OTLPMetricExporterOptions) {\n super(new OTLPExporterNodeProxy(config), config);\n }\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.34.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.34.0';\n"]}
|
|
@@ -16,8 +16,9 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.OTLPMetricExporterBase = exports.DeltaTemporalitySelector = exports.CumulativeTemporalitySelector = void 0;
|
|
19
|
+
const core_1 = require("@opentelemetry/core");
|
|
19
20
|
const sdk_metrics_1 = require("@opentelemetry/sdk-metrics");
|
|
20
|
-
const
|
|
21
|
+
const api_1 = require("@opentelemetry/api");
|
|
21
22
|
const CumulativeTemporalitySelector = () => sdk_metrics_1.AggregationTemporality.CUMULATIVE;
|
|
22
23
|
exports.CumulativeTemporalitySelector = CumulativeTemporalitySelector;
|
|
23
24
|
const DeltaTemporalitySelector = (instrumentType) => {
|
|
@@ -33,16 +34,32 @@ const DeltaTemporalitySelector = (instrumentType) => {
|
|
|
33
34
|
}
|
|
34
35
|
};
|
|
35
36
|
exports.DeltaTemporalitySelector = DeltaTemporalitySelector;
|
|
36
|
-
function
|
|
37
|
-
|
|
37
|
+
function chooseTemporalitySelectorFromEnvironment() {
|
|
38
|
+
const env = (0, core_1.getEnv)();
|
|
39
|
+
const configuredTemporality = env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE.trim().toLowerCase();
|
|
40
|
+
if (configuredTemporality === 'cumulative') {
|
|
41
|
+
return exports.CumulativeTemporalitySelector;
|
|
42
|
+
}
|
|
43
|
+
if (configuredTemporality === 'delta') {
|
|
38
44
|
return exports.DeltaTemporalitySelector;
|
|
39
45
|
}
|
|
46
|
+
api_1.diag.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`);
|
|
40
47
|
return exports.CumulativeTemporalitySelector;
|
|
41
48
|
}
|
|
49
|
+
function chooseTemporalitySelector(temporalityPreference) {
|
|
50
|
+
// Directly passed preference has priority.
|
|
51
|
+
if (temporalityPreference != null) {
|
|
52
|
+
if (temporalityPreference === sdk_metrics_1.AggregationTemporality.DELTA) {
|
|
53
|
+
return exports.DeltaTemporalitySelector;
|
|
54
|
+
}
|
|
55
|
+
return exports.CumulativeTemporalitySelector;
|
|
56
|
+
}
|
|
57
|
+
return chooseTemporalitySelectorFromEnvironment();
|
|
58
|
+
}
|
|
42
59
|
class OTLPMetricExporterBase {
|
|
43
|
-
constructor(exporter, config
|
|
60
|
+
constructor(exporter, config) {
|
|
44
61
|
this._otlpExporter = exporter;
|
|
45
|
-
this._aggregationTemporalitySelector = chooseTemporalitySelector(config.temporalityPreference);
|
|
62
|
+
this._aggregationTemporalitySelector = chooseTemporalitySelector(config === null || config === void 0 ? void 0 : config.temporalityPreference);
|
|
46
63
|
}
|
|
47
64
|
export(metrics, resultCallback) {
|
|
48
65
|
this._otlpExporter.export([metrics], resultCallback);
|
|
@@ -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,8CAG6B;AAC7B,4DAMoC;AAMpC,4CAA0C;AAEnC,MAAM,6BAA6B,GAAmC,GAAG,EAAE,CAAC,oCAAsB,CAAC,UAAU,CAAC;AAAxG,QAAA,6BAA6B,iCAA2E;AAE9G,MAAM,wBAAwB,GAAmC,CAAC,cAA8B,EAAE,EAAE;IACzG,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,UAAU,CAAC;KAC5C;AACH,CAAC,CAAC;AAXW,QAAA,wBAAwB,4BAWnC;AAEF,SAAS,wCAAwC;IAC/C,MAAM,GAAG,GAAG,IAAA,aAAM,GAAE,CAAC;IACrB,MAAM,qBAAqB,GAAG,GAAG,CAAC,iDAAiD,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAEzG,IAAI,qBAAqB,KAAK,YAAY,EAAE;QAC1C,OAAO,qCAA6B,CAAC;KACtC;IACD,IAAI,qBAAqB,KAAK,OAAO,EAAE;QACrC,OAAO,gCAAwB,CAAC;KACjC;IAED,UAAI,CAAC,IAAI,CAAC,gEAAgE,GAAG,CAAC,iDAAiD,yFAAyF,CAAC,CAAC;IAC1N,OAAO,qCAA6B,CAAC;AACvC,CAAC;AAED,SAAS,yBAAyB,CAAC,qBAA8C;IAC/E,2CAA2C;IAC3C,IAAI,qBAAqB,IAAI,IAAI,EAAE;QACjC,IAAI,qBAAqB,KAAK,oCAAsB,CAAC,KAAK,EAAE;YAC1D,OAAO,gCAAwB,CAAC;SACjC;QACD,OAAO,qCAA6B,CAAC;KACtC;IAED,OAAO,wCAAwC,EAAE,CAAC;AACpD,CAAC;AAED,MAAa,sBAAsB;IAOjC,YAAY,QAAW,EACrB,MAAkC;QAClC,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAC;QAC9B,IAAI,CAAC,+BAA+B,GAAG,yBAAyB,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,qBAAqB,CAAC,CAAC;IAClG,CAAC;IAED,MAAM,CAAC,OAAwB,EAAE,cAA8C;QAC7E,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,MAAM,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC;IACtC,CAAC;IAED,UAAU;QACR,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,4BAA4B,CAAC,cAA8B;QACzD,OAAO,IAAI,CAAC,+BAA+B,CAAC,cAAc,CAAC,CAAC;IAC9D,CAAC;CACF;AA5BD,wDA4BC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ExportResult,\n getEnv\n} from '@opentelemetry/core';\nimport {\n AggregationTemporality,\n AggregationTemporalitySelector,\n InstrumentType,\n PushMetricExporter,\n ResourceMetrics\n} from '@opentelemetry/sdk-metrics';\nimport {\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 = () => AggregationTemporality.CUMULATIVE;\n\nexport const DeltaTemporalitySelector: AggregationTemporalitySelector = (instrumentType: InstrumentType) => {\n switch (instrumentType) {\n case InstrumentType.COUNTER:\n case InstrumentType.OBSERVABLE_COUNTER:\n case InstrumentType.HISTOGRAM:\n case InstrumentType.OBSERVABLE_GAUGE:\n return AggregationTemporality.DELTA;\n case InstrumentType.UP_DOWN_COUNTER:\n case InstrumentType.OBSERVABLE_UP_DOWN_COUNTER:\n return AggregationTemporality.CUMULATIVE;\n }\n};\n\nfunction chooseTemporalitySelectorFromEnvironment() {\n const env = getEnv();\n const configuredTemporality = 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\n diag.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`);\n return CumulativeTemporalitySelector;\n}\n\nfunction chooseTemporalitySelector(temporalityPreference?: AggregationTemporality): AggregationTemporalitySelector {\n // Directly passed preference has priority.\n if (temporalityPreference != null) {\n if (temporalityPreference === AggregationTemporality.DELTA) {\n return DeltaTemporalitySelector;\n }\n return CumulativeTemporalitySelector;\n }\n\n return chooseTemporalitySelectorFromEnvironment();\n}\n\nexport class OTLPMetricExporterBase<T extends OTLPExporterBase<OTLPMetricExporterOptions,\n ResourceMetrics,\n IExportMetricsServiceRequest>>\nimplements PushMetricExporter {\n public _otlpExporter: T;\n protected _aggregationTemporalitySelector: AggregationTemporalitySelector;\n\n constructor(exporter: T,\n config?: OTLPMetricExporterOptions) {\n this._otlpExporter = exporter;\n this._aggregationTemporalitySelector = chooseTemporalitySelector(config?.temporalityPreference);\n }\n\n export(metrics: ResourceMetrics, resultCallback: (result: ExportResult) => void): void {\n this._otlpExporter.export([metrics], resultCallback);\n }\n\n async shutdown(): Promise<void> {\n await this._otlpExporter.shutdown();\n }\n\n forceFlush(): Promise<void> {\n return Promise.resolve();\n }\n\n selectAggregationTemporality(instrumentType: InstrumentType): AggregationTemporality {\n return this._aggregationTemporalitySelector(instrumentType);\n }\n}\n"]}
|
|
@@ -3,8 +3,4 @@ import { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base';
|
|
|
3
3
|
export interface OTLPMetricExporterOptions extends OTLPExporterConfigBase {
|
|
4
4
|
temporalityPreference?: AggregationTemporality;
|
|
5
5
|
}
|
|
6
|
-
export declare const defaultExporterTemporality = AggregationTemporality.CUMULATIVE;
|
|
7
|
-
export declare const defaultOptions: {
|
|
8
|
-
temporalityPreference: AggregationTemporality;
|
|
9
|
-
};
|
|
10
6
|
//# sourceMappingURL=OTLPMetricExporterOptions.d.ts.map
|
|
@@ -15,8 +15,4 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.defaultOptions = exports.defaultExporterTemporality = void 0;
|
|
19
|
-
const sdk_metrics_1 = require("@opentelemetry/sdk-metrics");
|
|
20
|
-
exports.defaultExporterTemporality = sdk_metrics_1.AggregationTemporality.CUMULATIVE;
|
|
21
|
-
exports.defaultOptions = { temporalityPreference: exports.defaultExporterTemporality };
|
|
22
18
|
//# sourceMappingURL=OTLPMetricExporterOptions.js.map
|
|
@@ -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","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AggregationTemporality } from '@opentelemetry/sdk-metrics';\nimport { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base';\n\nexport interface OTLPMetricExporterOptions extends OTLPExporterConfigBase {\n temporalityPreference?: AggregationTemporality\n}\n"]}
|
|
@@ -17,14 +17,13 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.OTLPMetricExporter = void 0;
|
|
19
19
|
const core_1 = require("@opentelemetry/core");
|
|
20
|
-
const OTLPMetricExporterOptions_1 = require("../../OTLPMetricExporterOptions");
|
|
21
20
|
const OTLPMetricExporterBase_1 = require("../../OTLPMetricExporterBase");
|
|
22
21
|
const otlp_exporter_base_1 = require("@opentelemetry/otlp-exporter-base");
|
|
23
22
|
const otlp_transformer_1 = require("@opentelemetry/otlp-transformer");
|
|
24
23
|
const DEFAULT_COLLECTOR_RESOURCE_PATH = 'v1/metrics';
|
|
25
24
|
const DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`;
|
|
26
25
|
class OTLPExporterBrowserProxy extends otlp_exporter_base_1.OTLPExporterBrowserBase {
|
|
27
|
-
constructor(config
|
|
26
|
+
constructor(config) {
|
|
28
27
|
super(config);
|
|
29
28
|
this._headers = Object.assign(this._headers, core_1.baggageUtils.parseKeyPairsIntoRecord((0, core_1.getEnv)().OTEL_EXPORTER_OTLP_METRICS_HEADERS));
|
|
30
29
|
}
|
|
@@ -32,7 +31,7 @@ class OTLPExporterBrowserProxy extends otlp_exporter_base_1.OTLPExporterBrowserB
|
|
|
32
31
|
return typeof config.url === 'string'
|
|
33
32
|
? config.url
|
|
34
33
|
: (0, core_1.getEnv)().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0
|
|
35
|
-
? (0, otlp_exporter_base_1.appendRootPathToUrlIfNeeded)((0, core_1.getEnv)().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT
|
|
34
|
+
? (0, otlp_exporter_base_1.appendRootPathToUrlIfNeeded)((0, core_1.getEnv)().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT)
|
|
36
35
|
: (0, core_1.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0
|
|
37
36
|
? (0, otlp_exporter_base_1.appendResourcePathToUrl)((0, core_1.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)
|
|
38
37
|
: DEFAULT_COLLECTOR_URL;
|
|
@@ -45,7 +44,7 @@ class OTLPExporterBrowserProxy extends otlp_exporter_base_1.OTLPExporterBrowserB
|
|
|
45
44
|
* Collector Metric Exporter for Web
|
|
46
45
|
*/
|
|
47
46
|
class OTLPMetricExporter extends OTLPMetricExporterBase_1.OTLPMetricExporterBase {
|
|
48
|
-
constructor(config
|
|
47
|
+
constructor(config) {
|
|
49
48
|
super(new OTLPExporterBrowserProxy(config), config);
|
|
50
49
|
}
|
|
51
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../../../src/platform/browser/OTLPMetricExporter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAGH,8CAA2D;
|
|
1
|
+
{"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../../../src/platform/browser/OTLPMetricExporter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAGH,8CAA2D;AAE3D,yEAAsE;AACtE,0EAK2C;AAC3C,sEAAkH;AAElH,MAAM,+BAA+B,GAAG,YAAY,CAAC;AACrD,MAAM,qBAAqB,GAAG,yBAAyB,+BAA+B,EAAE,CAAC;AAEzF,MAAM,wBAAyB,SAAQ,4CAAsE;IAE3G,YAAY,MAA2D;QACrE,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAC3B,IAAI,CAAC,QAAQ,EACb,mBAAY,CAAC,uBAAuB,CAClC,IAAA,aAAM,GAAE,CAAC,kCAAkC,CAC5C,CACF,CAAC;IACJ,CAAC;IAED,aAAa,CAAC,MAA8B;QAC1C,OAAO,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ;YACnC,CAAC,CAAC,MAAM,CAAC,GAAG;YACZ,CAAC,CAAC,IAAA,aAAM,GAAE,CAAC,mCAAmC,CAAC,MAAM,GAAG,CAAC;gBACvD,CAAC,CAAC,IAAA,gDAA2B,EAAC,IAAA,aAAM,GAAE,CAAC,mCAAmC,CAAC;gBAC3E,CAAC,CAAC,IAAA,aAAM,GAAE,CAAC,2BAA2B,CAAC,MAAM,GAAG,CAAC;oBAC/C,CAAC,CAAC,IAAA,4CAAuB,EAAC,IAAA,aAAM,GAAE,CAAC,2BAA2B,EAAE,+BAA+B,CAAC;oBAChG,CAAC,CAAC,qBAAqB,CAAC;IAChC,CAAC;IAED,OAAO,CAAC,OAA0B;QAChC,OAAO,IAAA,oDAAiC,EAAC,OAAO,CAAC,CAAC;IACpD,CAAC;CACF;AAED;;GAEG;AACH,MAAa,kBAAmB,SAAQ,+CAAgD;IACtF,YAAY,MAA2D;QACrE,KAAK,CAAC,IAAI,wBAAwB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;IACtD,CAAC;CACF;AAJD,gDAIC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ResourceMetrics } from '@opentelemetry/sdk-metrics';\nimport { baggageUtils, getEnv } from '@opentelemetry/core';\nimport { OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions';\nimport { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';\nimport {\n OTLPExporterBrowserBase,\n OTLPExporterConfigBase,\n appendResourcePathToUrl,\n appendRootPathToUrlIfNeeded\n} from '@opentelemetry/otlp-exporter-base';\nimport { createExportMetricsServiceRequest, IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';\n\nconst DEFAULT_COLLECTOR_RESOURCE_PATH = 'v1/metrics';\nconst DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`;\n\nclass OTLPExporterBrowserProxy extends OTLPExporterBrowserBase<ResourceMetrics, IExportMetricsServiceRequest> {\n\n constructor(config?: OTLPMetricExporterOptions & OTLPExporterConfigBase) {\n super(config);\n this._headers = Object.assign(\n this._headers,\n baggageUtils.parseKeyPairsIntoRecord(\n getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS\n )\n );\n }\n\n getDefaultUrl(config: OTLPExporterConfigBase): string {\n return typeof config.url === 'string'\n ? config.url\n : getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0\n ? appendRootPathToUrlIfNeeded(getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT)\n : getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0\n ? appendResourcePathToUrl(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)\n : DEFAULT_COLLECTOR_URL;\n }\n\n convert(metrics: ResourceMetrics[]): IExportMetricsServiceRequest {\n return createExportMetricsServiceRequest(metrics);\n }\n}\n\n/**\n * Collector Metric Exporter for Web\n */\nexport class OTLPMetricExporter extends OTLPMetricExporterBase<OTLPExporterBrowserProxy> {\n constructor(config?: OTLPExporterConfigBase & OTLPMetricExporterOptions) {\n super(new OTLPExporterBrowserProxy(config), config);\n }\n}\n"]}
|
|
@@ -17,14 +17,13 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.OTLPMetricExporter = void 0;
|
|
19
19
|
const core_1 = require("@opentelemetry/core");
|
|
20
|
-
const OTLPMetricExporterOptions_1 = require("../../OTLPMetricExporterOptions");
|
|
21
20
|
const OTLPMetricExporterBase_1 = require("../../OTLPMetricExporterBase");
|
|
22
21
|
const otlp_exporter_base_1 = require("@opentelemetry/otlp-exporter-base");
|
|
23
22
|
const otlp_transformer_1 = require("@opentelemetry/otlp-transformer");
|
|
24
23
|
const DEFAULT_COLLECTOR_RESOURCE_PATH = 'v1/metrics';
|
|
25
24
|
const DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`;
|
|
26
25
|
class OTLPExporterNodeProxy extends otlp_exporter_base_1.OTLPExporterNodeBase {
|
|
27
|
-
constructor(config
|
|
26
|
+
constructor(config) {
|
|
28
27
|
super(config);
|
|
29
28
|
this.headers = Object.assign(this.headers, core_1.baggageUtils.parseKeyPairsIntoRecord((0, core_1.getEnv)().OTEL_EXPORTER_OTLP_METRICS_HEADERS));
|
|
30
29
|
}
|
|
@@ -35,7 +34,7 @@ class OTLPExporterNodeProxy extends otlp_exporter_base_1.OTLPExporterNodeBase {
|
|
|
35
34
|
return typeof config.url === 'string'
|
|
36
35
|
? config.url
|
|
37
36
|
: (0, core_1.getEnv)().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0
|
|
38
|
-
? (0, otlp_exporter_base_1.appendRootPathToUrlIfNeeded)((0, core_1.getEnv)().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT
|
|
37
|
+
? (0, otlp_exporter_base_1.appendRootPathToUrlIfNeeded)((0, core_1.getEnv)().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT)
|
|
39
38
|
: (0, core_1.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0
|
|
40
39
|
? (0, otlp_exporter_base_1.appendResourcePathToUrl)((0, core_1.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)
|
|
41
40
|
: DEFAULT_COLLECTOR_URL;
|
|
@@ -45,7 +44,7 @@ class OTLPExporterNodeProxy extends otlp_exporter_base_1.OTLPExporterNodeBase {
|
|
|
45
44
|
* Collector Metric Exporter for Node
|
|
46
45
|
*/
|
|
47
46
|
class OTLPMetricExporter extends OTLPMetricExporterBase_1.OTLPMetricExporterBase {
|
|
48
|
-
constructor(config
|
|
47
|
+
constructor(config) {
|
|
49
48
|
super(new OTLPExporterNodeProxy(config), config);
|
|
50
49
|
}
|
|
51
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../../../src/platform/node/OTLPMetricExporter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAGH,8CAA0D;
|
|
1
|
+
{"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../../../src/platform/node/OTLPMetricExporter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAGH,8CAA0D;AAE1D,yEAAsE;AACtE,0EAK2C;AAC3C,sEAAkH;AAElH,MAAM,+BAA+B,GAAG,YAAY,CAAC;AACrD,MAAM,qBAAqB,GAAG,yBAAyB,+BAA+B,EAAE,CAAC;AAEzF,MAAM,qBAAsB,SAAQ,yCAAmE;IAErG,YAAY,MAA+D;QACzE,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAC1B,IAAI,CAAC,OAAO,EACZ,mBAAY,CAAC,uBAAuB,CAClC,IAAA,aAAM,GAAE,CAAC,kCAAkC,CAC5C,CACF,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,OAA0B;QAChC,OAAO,IAAA,oDAAiC,EAAC,OAAO,CAAC,CAAC;IACpD,CAAC;IAED,aAAa,CAAC,MAAkC;QAC9C,OAAO,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ;YACnC,CAAC,CAAC,MAAM,CAAC,GAAG;YACZ,CAAC,CAAC,IAAA,aAAM,GAAE,CAAC,mCAAmC,CAAC,MAAM,GAAG,CAAC;gBACvD,CAAC,CAAC,IAAA,gDAA2B,EAAC,IAAA,aAAM,GAAE,CAAC,mCAAmC,CAAC;gBAC3E,CAAC,CAAC,IAAA,aAAM,GAAE,CAAC,2BAA2B,CAAC,MAAM,GAAG,CAAC;oBAC/C,CAAC,CAAC,IAAA,4CAAuB,EAAC,IAAA,aAAM,GAAE,CAAC,2BAA2B,EAAE,+BAA+B,CAAC;oBAChG,CAAC,CAAC,qBAAqB,CAAC;IAChC,CAAC;CACF;AAED;;GAEG;AACH,MAAa,kBAAmB,SAAQ,+CAA6C;IACnF,YAAY,MAA+D;QACzE,KAAK,CAAC,IAAI,qBAAqB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;IACnD,CAAC;CACF;AAJD,gDAIC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ResourceMetrics } from '@opentelemetry/sdk-metrics';\nimport { getEnv, baggageUtils} from '@opentelemetry/core';\nimport { OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions';\nimport { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';\nimport {\n OTLPExporterNodeBase,\n OTLPExporterNodeConfigBase,\n appendResourcePathToUrl,\n appendRootPathToUrlIfNeeded\n} from '@opentelemetry/otlp-exporter-base';\nimport { createExportMetricsServiceRequest, IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';\n\nconst DEFAULT_COLLECTOR_RESOURCE_PATH = 'v1/metrics';\nconst DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`;\n\nclass OTLPExporterNodeProxy extends OTLPExporterNodeBase<ResourceMetrics, IExportMetricsServiceRequest> {\n\n constructor(config?: OTLPExporterNodeConfigBase & OTLPMetricExporterOptions) {\n super(config);\n this.headers = Object.assign(\n this.headers,\n baggageUtils.parseKeyPairsIntoRecord(\n getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS\n )\n );\n }\n\n convert(metrics: ResourceMetrics[]): IExportMetricsServiceRequest {\n return createExportMetricsServiceRequest(metrics);\n }\n\n getDefaultUrl(config: OTLPExporterNodeConfigBase): string {\n return typeof config.url === 'string'\n ? config.url\n : getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0\n ? appendRootPathToUrlIfNeeded(getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT)\n : getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0\n ? appendResourcePathToUrl(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)\n : DEFAULT_COLLECTOR_URL;\n }\n}\n\n/**\n * Collector Metric Exporter for Node\n */\nexport class OTLPMetricExporter extends OTLPMetricExporterBase<OTLPExporterNodeProxy> {\n constructor(config?: OTLPExporterNodeConfigBase & OTLPMetricExporterOptions) {\n super(new OTLPExporterNodeProxy(config), config);\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.34.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.34.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.34.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",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@babel/core": "7.16.0",
|
|
67
|
-
"@opentelemetry/api": "^1.
|
|
68
|
-
"@types/mocha": "
|
|
67
|
+
"@opentelemetry/api": "^1.3.0",
|
|
68
|
+
"@types/mocha": "10.0.0",
|
|
69
69
|
"@types/node": "18.6.5",
|
|
70
70
|
"@types/sinon": "10.0.13",
|
|
71
71
|
"@types/webpack-env": "1.16.3",
|
|
@@ -91,16 +91,16 @@
|
|
|
91
91
|
"webpack-merge": "5.8.0"
|
|
92
92
|
},
|
|
93
93
|
"peerDependencies": {
|
|
94
|
-
"@opentelemetry/api": "^1.
|
|
94
|
+
"@opentelemetry/api": "^1.3.0"
|
|
95
95
|
},
|
|
96
96
|
"dependencies": {
|
|
97
|
-
"@opentelemetry/
|
|
98
|
-
"@opentelemetry/
|
|
99
|
-
"@opentelemetry/otlp-
|
|
100
|
-
"@opentelemetry/
|
|
101
|
-
"@opentelemetry/
|
|
102
|
-
"@opentelemetry/sdk-metrics": "0.33.0"
|
|
97
|
+
"@opentelemetry/core": "1.8.0",
|
|
98
|
+
"@opentelemetry/otlp-exporter-base": "0.34.0",
|
|
99
|
+
"@opentelemetry/otlp-transformer": "0.34.0",
|
|
100
|
+
"@opentelemetry/resources": "1.8.0",
|
|
101
|
+
"@opentelemetry/sdk-metrics": "1.8.0"
|
|
103
102
|
},
|
|
104
103
|
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-exporter-metrics-otlp-http",
|
|
105
|
-
"
|
|
104
|
+
"sideEffects": false,
|
|
105
|
+
"gitHead": "7972edf6659fb6e0d5928a5cf7a35f26683e168f"
|
|
106
106
|
}
|