@opentelemetry/otlp-exporter-base 0.220.0 → 0.222.0-development.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 +30 -0
- package/build/esm/ExporterMetrics.d.ts +24 -0
- package/build/esm/ExporterMetrics.js +104 -0
- package/build/esm/ExporterMetrics.js.map +1 -0
- package/build/esm/OTLPExporterBase.d.ts +2 -0
- package/build/esm/OTLPExporterBase.js +3 -0
- package/build/esm/OTLPExporterBase.js.map +1 -1
- package/build/esm/configuration/create-legacy-browser-delegate.d.ts +8 -2
- package/build/esm/configuration/create-legacy-browser-delegate.js +36 -2
- package/build/esm/configuration/create-legacy-browser-delegate.js.map +1 -1
- package/build/esm/configuration/legacy-base-configuration.d.ts +26 -8
- package/build/esm/configuration/legacy-base-configuration.js.map +1 -1
- package/build/esm/configuration/legacy-node-configuration.d.ts +18 -4
- package/build/esm/configuration/legacy-node-configuration.js.map +1 -1
- package/build/esm/index-browser-http.d.ts +1 -1
- package/build/esm/index-browser-http.js +1 -1
- package/build/esm/index-browser-http.js.map +1 -1
- package/build/esm/index-node-http.d.ts +1 -1
- package/build/esm/index-node-http.js +1 -1
- package/build/esm/index-node-http.js.map +1 -1
- package/build/esm/index.d.ts +1 -0
- package/build/esm/index.js +1 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/otlp-browser-http-export-delegate.d.ts +3 -2
- package/build/esm/otlp-browser-http-export-delegate.js +8 -4
- package/build/esm/otlp-browser-http-export-delegate.js.map +1 -1
- package/build/esm/otlp-export-delegate.d.ts +3 -0
- package/build/esm/otlp-export-delegate.js +19 -6
- package/build/esm/otlp-export-delegate.js.map +1 -1
- package/build/esm/otlp-http-export-delegate.d.ts +5 -2
- package/build/esm/otlp-http-export-delegate.js +30 -1
- package/build/esm/otlp-http-export-delegate.js.map +1 -1
- package/build/esm/otlp-network-export-delegate.d.ts +2 -1
- package/build/esm/otlp-network-export-delegate.js +2 -1
- package/build/esm/otlp-network-export-delegate.js.map +1 -1
- package/build/esm/semconv.d.ts +91 -0
- package/build/esm/semconv.js +100 -0
- package/build/esm/semconv.js.map +1 -0
- 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/ExporterMetrics.d.ts +24 -0
- package/build/esnext/ExporterMetrics.js +104 -0
- package/build/esnext/ExporterMetrics.js.map +1 -0
- package/build/esnext/OTLPExporterBase.d.ts +2 -0
- package/build/esnext/OTLPExporterBase.js +3 -0
- package/build/esnext/OTLPExporterBase.js.map +1 -1
- package/build/esnext/configuration/create-legacy-browser-delegate.d.ts +8 -2
- package/build/esnext/configuration/create-legacy-browser-delegate.js +36 -2
- package/build/esnext/configuration/create-legacy-browser-delegate.js.map +1 -1
- package/build/esnext/configuration/legacy-base-configuration.d.ts +26 -8
- package/build/esnext/configuration/legacy-base-configuration.js.map +1 -1
- package/build/esnext/configuration/legacy-node-configuration.d.ts +18 -4
- package/build/esnext/configuration/legacy-node-configuration.js.map +1 -1
- package/build/esnext/index-browser-http.d.ts +1 -1
- package/build/esnext/index-browser-http.js +1 -1
- package/build/esnext/index-browser-http.js.map +1 -1
- package/build/esnext/index-node-http.d.ts +1 -1
- package/build/esnext/index-node-http.js +1 -1
- package/build/esnext/index-node-http.js.map +1 -1
- package/build/esnext/index.d.ts +1 -0
- package/build/esnext/index.js +1 -0
- package/build/esnext/index.js.map +1 -1
- package/build/esnext/otlp-browser-http-export-delegate.d.ts +3 -2
- package/build/esnext/otlp-browser-http-export-delegate.js +8 -4
- package/build/esnext/otlp-browser-http-export-delegate.js.map +1 -1
- package/build/esnext/otlp-export-delegate.d.ts +3 -0
- package/build/esnext/otlp-export-delegate.js +19 -6
- package/build/esnext/otlp-export-delegate.js.map +1 -1
- package/build/esnext/otlp-http-export-delegate.d.ts +5 -2
- package/build/esnext/otlp-http-export-delegate.js +30 -1
- package/build/esnext/otlp-http-export-delegate.js.map +1 -1
- package/build/esnext/otlp-network-export-delegate.d.ts +2 -1
- package/build/esnext/otlp-network-export-delegate.js +2 -1
- package/build/esnext/otlp-network-export-delegate.js.map +1 -1
- package/build/esnext/semconv.d.ts +91 -0
- package/build/esnext/semconv.js +100 -0
- package/build/esnext/semconv.js.map +1 -0
- 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/ExporterMetrics.d.ts +24 -0
- package/build/src/ExporterMetrics.js +108 -0
- package/build/src/ExporterMetrics.js.map +1 -0
- package/build/src/OTLPExporterBase.d.ts +2 -0
- package/build/src/OTLPExporterBase.js +3 -0
- package/build/src/OTLPExporterBase.js.map +1 -1
- package/build/src/configuration/create-legacy-browser-delegate.d.ts +8 -2
- package/build/src/configuration/create-legacy-browser-delegate.js +38 -3
- package/build/src/configuration/create-legacy-browser-delegate.js.map +1 -1
- package/build/src/configuration/legacy-base-configuration.d.ts +26 -8
- package/build/src/configuration/legacy-base-configuration.js.map +1 -1
- package/build/src/configuration/legacy-node-configuration.d.ts +18 -4
- package/build/src/configuration/legacy-node-configuration.js +1 -1
- package/build/src/configuration/legacy-node-configuration.js.map +1 -1
- package/build/src/index-browser-http.d.ts +1 -1
- package/build/src/index-browser-http.js +2 -1
- package/build/src/index-browser-http.js.map +1 -1
- package/build/src/index-node-http.d.ts +1 -1
- package/build/src/index-node-http.js +2 -1
- package/build/src/index-node-http.js.map +1 -1
- package/build/src/index.d.ts +1 -0
- package/build/src/index.js +3 -1
- package/build/src/index.js.map +1 -1
- package/build/src/otlp-browser-http-export-delegate.d.ts +3 -2
- package/build/src/otlp-browser-http-export-delegate.js +8 -4
- package/build/src/otlp-browser-http-export-delegate.js.map +1 -1
- package/build/src/otlp-export-delegate.d.ts +3 -0
- package/build/src/otlp-export-delegate.js +19 -6
- package/build/src/otlp-export-delegate.js.map +1 -1
- package/build/src/otlp-http-export-delegate.d.ts +5 -2
- package/build/src/otlp-http-export-delegate.js +32 -2
- package/build/src/otlp-http-export-delegate.js.map +1 -1
- package/build/src/otlp-network-export-delegate.d.ts +2 -1
- package/build/src/otlp-network-export-delegate.js +2 -1
- package/build/src/otlp-network-export-delegate.js.map +1 -1
- package/build/src/semconv.d.ts +91 -0
- package/build/src/semconv.js +103 -0
- package/build/src/semconv.js.map +1 -0
- 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 +9 -9
|
@@ -2,5 +2,6 @@ import type { OtlpSharedConfiguration } from './configuration/shared-configurati
|
|
|
2
2
|
import type { ISerializer } from '@opentelemetry/otlp-transformer';
|
|
3
3
|
import type { IExporterTransport } from './exporter-transport';
|
|
4
4
|
import type { IOtlpExportDelegate } from './otlp-export-delegate';
|
|
5
|
-
|
|
5
|
+
import { type ExporterMetrics } from './ExporterMetrics';
|
|
6
|
+
export declare function createOtlpNetworkExportDelegate<Internal, Response>(options: OtlpSharedConfiguration, serializer: ISerializer<Internal, Response>, metrics: ExporterMetrics<Internal>, transport: IExporterTransport): IOtlpExportDelegate<Internal>;
|
|
6
7
|
//# sourceMappingURL=otlp-network-export-delegate.d.ts.map
|
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { createBoundedQueueExportPromiseHandler } from './bounded-queue-export-promise-handler';
|
|
6
6
|
import { createOtlpExportDelegate } from './otlp-export-delegate';
|
|
7
|
-
export function createOtlpNetworkExportDelegate(options, serializer, transport) {
|
|
7
|
+
export function createOtlpNetworkExportDelegate(options, serializer, metrics, transport) {
|
|
8
8
|
return createOtlpExportDelegate({
|
|
9
9
|
transport: transport,
|
|
10
10
|
serializer,
|
|
11
11
|
promiseHandler: createBoundedQueueExportPromiseHandler(options),
|
|
12
|
+
metrics,
|
|
12
13
|
}, { timeout: options.timeoutMillis });
|
|
13
14
|
}
|
|
14
15
|
//# sourceMappingURL=otlp-network-export-delegate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otlp-network-export-delegate.js","sourceRoot":"","sources":["../../src/otlp-network-export-delegate.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,sCAAsC,EAAE,MAAM,wCAAwC,CAAC;AAKhG,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"otlp-network-export-delegate.js","sourceRoot":"","sources":["../../src/otlp-network-export-delegate.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,sCAAsC,EAAE,MAAM,wCAAwC,CAAC;AAKhG,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAGlE,MAAM,UAAU,+BAA+B,CAC7C,OAAgC,EAChC,UAA2C,EAC3C,OAAkC,EAClC,SAA6B;IAE7B,OAAO,wBAAwB,CAC7B;QACE,SAAS,EAAE,SAAS;QACpB,UAAU;QACV,cAAc,EAAE,sCAAsC,CAAC,OAAO,CAAC;QAC/D,OAAO;KACR,EACD,EAAE,OAAO,EAAE,OAAO,CAAC,aAAa,EAAE,CACnC,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { createBoundedQueueExportPromiseHandler } from './bounded-queue-export-promise-handler';\nimport type { OtlpSharedConfiguration } from './configuration/shared-configuration';\nimport type { ISerializer } from '@opentelemetry/otlp-transformer';\nimport type { IExporterTransport } from './exporter-transport';\nimport type { IOtlpExportDelegate } from './otlp-export-delegate';\nimport { createOtlpExportDelegate } from './otlp-export-delegate';\nimport { type ExporterMetrics } from './ExporterMetrics';\n\nexport function createOtlpNetworkExportDelegate<Internal, Response>(\n options: OtlpSharedConfiguration,\n serializer: ISerializer<Internal, Response>,\n metrics: ExporterMetrics<Internal>,\n transport: IExporterTransport\n): IOtlpExportDelegate<Internal> {\n return createOtlpExportDelegate(\n {\n transport: transport,\n serializer,\n promiseHandler: createBoundedQueueExportPromiseHandler(options),\n metrics,\n },\n { timeout: options.timeoutMillis }\n );\n}\n"]}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).
|
|
3
|
+
*
|
|
4
|
+
* @example 200
|
|
5
|
+
*/
|
|
6
|
+
export declare const ATTR_HTTP_RESPONSE_STATUS_CODE: "http.response.status_code";
|
|
7
|
+
/**
|
|
8
|
+
* A name uniquely identifying the instance of the OpenTelemetry component within its containing SDK instance.
|
|
9
|
+
*
|
|
10
|
+
* @example otlp_grpc_span_exporter/0
|
|
11
|
+
* @example custom-name
|
|
12
|
+
*
|
|
13
|
+
* @note Implementations **SHOULD** ensure a low cardinality for this attribute, even across application or SDK restarts.
|
|
14
|
+
* E.g. implementations **MUST NOT** use UUIDs as values for this attribute.
|
|
15
|
+
*
|
|
16
|
+
* Implementations **MAY** achieve these goals by following a `<otel.component.type>/<instance-counter>` pattern, e.g. `batching_span_processor/0`.
|
|
17
|
+
* Hereby `otel.component.type` refers to the corresponding attribute value of the component.
|
|
18
|
+
*
|
|
19
|
+
* The value of `instance-counter` **MAY** be automatically assigned by the component and uniqueness within the enclosing SDK instance **MUST** be guaranteed.
|
|
20
|
+
* For example, `<instance-counter>` **MAY** be implemented by using a monotonically increasing counter (starting with `0`), which is incremented every time an
|
|
21
|
+
* instance of the given component type is started.
|
|
22
|
+
*
|
|
23
|
+
* With this implementation, for example the first Batching Span Processor would have `batching_span_processor/0`
|
|
24
|
+
* as `otel.component.name`, the second one `batching_span_processor/1` and so on.
|
|
25
|
+
* These values will therefore be reused in the case of an application restart.
|
|
26
|
+
*
|
|
27
|
+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
28
|
+
*/
|
|
29
|
+
export declare const ATTR_OTEL_COMPONENT_NAME: "otel.component.name";
|
|
30
|
+
/**
|
|
31
|
+
* A name identifying the type of the OpenTelemetry component.
|
|
32
|
+
*
|
|
33
|
+
* @example batching_span_processor
|
|
34
|
+
* @example com.example.MySpanExporter
|
|
35
|
+
*
|
|
36
|
+
* @note If none of the standardized values apply, implementations **SHOULD** use the language-defined name of the type.
|
|
37
|
+
* E.g. for Java the fully qualified classname **SHOULD** be used in this case.
|
|
38
|
+
*
|
|
39
|
+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
40
|
+
*/
|
|
41
|
+
export declare const ATTR_OTEL_COMPONENT_TYPE: "otel.component.type";
|
|
42
|
+
/**
|
|
43
|
+
* Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.
|
|
44
|
+
*
|
|
45
|
+
* @example example.com
|
|
46
|
+
* @example 10.1.2.80
|
|
47
|
+
* @example /tmp/my.sock
|
|
48
|
+
*
|
|
49
|
+
* @note When observed from the client side, and when communicating through an intermediary, `server.address` **SHOULD** represent the server address behind any intermediaries, for example proxies, if it's available.
|
|
50
|
+
*/
|
|
51
|
+
export declare const ATTR_SERVER_ADDRESS: "server.address";
|
|
52
|
+
/**
|
|
53
|
+
* Server port number.
|
|
54
|
+
*
|
|
55
|
+
* @example 80
|
|
56
|
+
* @example 8080
|
|
57
|
+
* @example 443
|
|
58
|
+
*
|
|
59
|
+
* @note When observed from the client side, and when communicating through an intermediary, `server.port` **SHOULD** represent the server port behind any intermediaries, for example proxies, if it's available.
|
|
60
|
+
*/
|
|
61
|
+
export declare const ATTR_SERVER_PORT: "server.port";
|
|
62
|
+
/**
|
|
63
|
+
* Describes a class of error the operation ended with.
|
|
64
|
+
*
|
|
65
|
+
* @example timeout
|
|
66
|
+
* @example java.net.UnknownHostException
|
|
67
|
+
* @example server_certificate_invalid
|
|
68
|
+
* @example 500
|
|
69
|
+
*
|
|
70
|
+
* @note The `error.type` **SHOULD** be predictable, and **SHOULD** have low cardinality.
|
|
71
|
+
*
|
|
72
|
+
* When `error.type` is set to a type (e.g., an exception type), its
|
|
73
|
+
* canonical class name identifying the type within the artifact **SHOULD** be used.
|
|
74
|
+
*
|
|
75
|
+
* Instrumentations **SHOULD** document the list of errors they report.
|
|
76
|
+
*
|
|
77
|
+
* The cardinality of `error.type` within one instrumentation library **SHOULD** be low.
|
|
78
|
+
* Telemetry consumers that aggregate data from multiple instrumentation libraries and applications
|
|
79
|
+
* should be prepared for `error.type` to have high cardinality at query time when no
|
|
80
|
+
* additional filters are applied.
|
|
81
|
+
*
|
|
82
|
+
* If the operation has completed successfully, instrumentations **SHOULD NOT** set `error.type`.
|
|
83
|
+
*
|
|
84
|
+
* If a specific domain defines its own set of error identifiers (such as HTTP or RPC status codes),
|
|
85
|
+
* it's **RECOMMENDED** to:
|
|
86
|
+
*
|
|
87
|
+
* - Use a domain-specific attribute
|
|
88
|
+
* - Set `error.type` to capture all errors, regardless of whether they are defined within the domain-specific set or not.
|
|
89
|
+
*/
|
|
90
|
+
export declare const ATTR_ERROR_TYPE: "error.type";
|
|
91
|
+
//# sourceMappingURL=semconv.d.ts.map
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright The OpenTelemetry Authors
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
/*
|
|
6
|
+
* This file contains a copy of unstable semantic convention definitions
|
|
7
|
+
* used by this package.
|
|
8
|
+
* @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).
|
|
12
|
+
*
|
|
13
|
+
* @example 200
|
|
14
|
+
*/
|
|
15
|
+
export const ATTR_HTTP_RESPONSE_STATUS_CODE = 'http.response.status_code';
|
|
16
|
+
/**
|
|
17
|
+
* A name uniquely identifying the instance of the OpenTelemetry component within its containing SDK instance.
|
|
18
|
+
*
|
|
19
|
+
* @example otlp_grpc_span_exporter/0
|
|
20
|
+
* @example custom-name
|
|
21
|
+
*
|
|
22
|
+
* @note Implementations **SHOULD** ensure a low cardinality for this attribute, even across application or SDK restarts.
|
|
23
|
+
* E.g. implementations **MUST NOT** use UUIDs as values for this attribute.
|
|
24
|
+
*
|
|
25
|
+
* Implementations **MAY** achieve these goals by following a `<otel.component.type>/<instance-counter>` pattern, e.g. `batching_span_processor/0`.
|
|
26
|
+
* Hereby `otel.component.type` refers to the corresponding attribute value of the component.
|
|
27
|
+
*
|
|
28
|
+
* The value of `instance-counter` **MAY** be automatically assigned by the component and uniqueness within the enclosing SDK instance **MUST** be guaranteed.
|
|
29
|
+
* For example, `<instance-counter>` **MAY** be implemented by using a monotonically increasing counter (starting with `0`), which is incremented every time an
|
|
30
|
+
* instance of the given component type is started.
|
|
31
|
+
*
|
|
32
|
+
* With this implementation, for example the first Batching Span Processor would have `batching_span_processor/0`
|
|
33
|
+
* as `otel.component.name`, the second one `batching_span_processor/1` and so on.
|
|
34
|
+
* These values will therefore be reused in the case of an application restart.
|
|
35
|
+
*
|
|
36
|
+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
37
|
+
*/
|
|
38
|
+
export const ATTR_OTEL_COMPONENT_NAME = 'otel.component.name';
|
|
39
|
+
/**
|
|
40
|
+
* A name identifying the type of the OpenTelemetry component.
|
|
41
|
+
*
|
|
42
|
+
* @example batching_span_processor
|
|
43
|
+
* @example com.example.MySpanExporter
|
|
44
|
+
*
|
|
45
|
+
* @note If none of the standardized values apply, implementations **SHOULD** use the language-defined name of the type.
|
|
46
|
+
* E.g. for Java the fully qualified classname **SHOULD** be used in this case.
|
|
47
|
+
*
|
|
48
|
+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
49
|
+
*/
|
|
50
|
+
export const ATTR_OTEL_COMPONENT_TYPE = 'otel.component.type';
|
|
51
|
+
/**
|
|
52
|
+
* Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.
|
|
53
|
+
*
|
|
54
|
+
* @example example.com
|
|
55
|
+
* @example 10.1.2.80
|
|
56
|
+
* @example /tmp/my.sock
|
|
57
|
+
*
|
|
58
|
+
* @note When observed from the client side, and when communicating through an intermediary, `server.address` **SHOULD** represent the server address behind any intermediaries, for example proxies, if it's available.
|
|
59
|
+
*/
|
|
60
|
+
export const ATTR_SERVER_ADDRESS = 'server.address';
|
|
61
|
+
/**
|
|
62
|
+
* Server port number.
|
|
63
|
+
*
|
|
64
|
+
* @example 80
|
|
65
|
+
* @example 8080
|
|
66
|
+
* @example 443
|
|
67
|
+
*
|
|
68
|
+
* @note When observed from the client side, and when communicating through an intermediary, `server.port` **SHOULD** represent the server port behind any intermediaries, for example proxies, if it's available.
|
|
69
|
+
*/
|
|
70
|
+
export const ATTR_SERVER_PORT = 'server.port';
|
|
71
|
+
/**
|
|
72
|
+
* Describes a class of error the operation ended with.
|
|
73
|
+
*
|
|
74
|
+
* @example timeout
|
|
75
|
+
* @example java.net.UnknownHostException
|
|
76
|
+
* @example server_certificate_invalid
|
|
77
|
+
* @example 500
|
|
78
|
+
*
|
|
79
|
+
* @note The `error.type` **SHOULD** be predictable, and **SHOULD** have low cardinality.
|
|
80
|
+
*
|
|
81
|
+
* When `error.type` is set to a type (e.g., an exception type), its
|
|
82
|
+
* canonical class name identifying the type within the artifact **SHOULD** be used.
|
|
83
|
+
*
|
|
84
|
+
* Instrumentations **SHOULD** document the list of errors they report.
|
|
85
|
+
*
|
|
86
|
+
* The cardinality of `error.type` within one instrumentation library **SHOULD** be low.
|
|
87
|
+
* Telemetry consumers that aggregate data from multiple instrumentation libraries and applications
|
|
88
|
+
* should be prepared for `error.type` to have high cardinality at query time when no
|
|
89
|
+
* additional filters are applied.
|
|
90
|
+
*
|
|
91
|
+
* If the operation has completed successfully, instrumentations **SHOULD NOT** set `error.type`.
|
|
92
|
+
*
|
|
93
|
+
* If a specific domain defines its own set of error identifiers (such as HTTP or RPC status codes),
|
|
94
|
+
* it's **RECOMMENDED** to:
|
|
95
|
+
*
|
|
96
|
+
* - Use a domain-specific attribute
|
|
97
|
+
* - Set `error.type` to capture all errors, regardless of whether they are defined within the domain-specific set or not.
|
|
98
|
+
*/
|
|
99
|
+
export const ATTR_ERROR_TYPE = 'error.type';
|
|
100
|
+
//# sourceMappingURL=semconv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semconv.js","sourceRoot":"","sources":["../../src/semconv.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,8BAA8B,GACzC,2BAAoC,CAAC;AAEvC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,qBAA8B,CAAC;AAEvE;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,qBAA8B,CAAC;AAEvE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,gBAAyB,CAAC;AAE7D;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAsB,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,YAAqB,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/*\n * This file contains a copy of unstable semantic convention definitions\n * used by this package.\n * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv\n */\n\n/**\n * [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).\n *\n * @example 200\n */\nexport const ATTR_HTTP_RESPONSE_STATUS_CODE =\n 'http.response.status_code' as const;\n\n/**\n * A name uniquely identifying the instance of the OpenTelemetry component within its containing SDK instance.\n *\n * @example otlp_grpc_span_exporter/0\n * @example custom-name\n *\n * @note Implementations **SHOULD** ensure a low cardinality for this attribute, even across application or SDK restarts.\n * E.g. implementations **MUST NOT** use UUIDs as values for this attribute.\n *\n * Implementations **MAY** achieve these goals by following a `<otel.component.type>/<instance-counter>` pattern, e.g. `batching_span_processor/0`.\n * Hereby `otel.component.type` refers to the corresponding attribute value of the component.\n *\n * The value of `instance-counter` **MAY** be automatically assigned by the component and uniqueness within the enclosing SDK instance **MUST** be guaranteed.\n * For example, `<instance-counter>` **MAY** be implemented by using a monotonically increasing counter (starting with `0`), which is incremented every time an\n * instance of the given component type is started.\n *\n * With this implementation, for example the first Batching Span Processor would have `batching_span_processor/0`\n * as `otel.component.name`, the second one `batching_span_processor/1` and so on.\n * These values will therefore be reused in the case of an application restart.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_OTEL_COMPONENT_NAME = 'otel.component.name' as const;\n\n/**\n * A name identifying the type of the OpenTelemetry component.\n *\n * @example batching_span_processor\n * @example com.example.MySpanExporter\n *\n * @note If none of the standardized values apply, implementations **SHOULD** use the language-defined name of the type.\n * E.g. for Java the fully qualified classname **SHOULD** be used in this case.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_OTEL_COMPONENT_TYPE = 'otel.component.type' as const;\n\n/**\n * Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.\n *\n * @example example.com\n * @example 10.1.2.80\n * @example /tmp/my.sock\n *\n * @note When observed from the client side, and when communicating through an intermediary, `server.address` **SHOULD** represent the server address behind any intermediaries, for example proxies, if it's available.\n */\nexport const ATTR_SERVER_ADDRESS = 'server.address' as const;\n\n/**\n * Server port number.\n *\n * @example 80\n * @example 8080\n * @example 443\n *\n * @note When observed from the client side, and when communicating through an intermediary, `server.port` **SHOULD** represent the server port behind any intermediaries, for example proxies, if it's available.\n */\nexport const ATTR_SERVER_PORT = 'server.port' as const;\n\n/**\n * Describes a class of error the operation ended with.\n *\n * @example timeout\n * @example java.net.UnknownHostException\n * @example server_certificate_invalid\n * @example 500\n *\n * @note The `error.type` **SHOULD** be predictable, and **SHOULD** have low cardinality.\n *\n * When `error.type` is set to a type (e.g., an exception type), its\n * canonical class name identifying the type within the artifact **SHOULD** be used.\n *\n * Instrumentations **SHOULD** document the list of errors they report.\n *\n * The cardinality of `error.type` within one instrumentation library **SHOULD** be low.\n * Telemetry consumers that aggregate data from multiple instrumentation libraries and applications\n * should be prepared for `error.type` to have high cardinality at query time when no\n * additional filters are applied.\n *\n * If the operation has completed successfully, instrumentations **SHOULD NOT** set `error.type`.\n *\n * If a specific domain defines its own set of error identifiers (such as HTTP or RPC status codes),\n * it's **RECOMMENDED** to:\n *\n * - Use a domain-specific attribute\n * - Set `error.type` to capture all errors, regardless of whether they are defined within the domain-specific set or not.\n */\nexport const ATTR_ERROR_TYPE = 'error.type' as const;\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.222.0-development.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;;;GAGG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,OAAO,GAAG,uBAAuB,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.222.0-development.0';\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type Attributes, type MeterProvider } from '@opentelemetry/api';
|
|
2
|
+
import { type IExporterMetricsHelper } from '@opentelemetry/otlp-transformer';
|
|
3
|
+
export interface ExporterMetricsOptions<Internal> {
|
|
4
|
+
componentType: string;
|
|
5
|
+
metricsHelper: IExporterMetricsHelper<Internal>;
|
|
6
|
+
url: string | undefined;
|
|
7
|
+
meterProvider: MeterProvider | undefined;
|
|
8
|
+
responseAttributesFromError: (error: Error | string | undefined) => Attributes;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Generates `otel.sdk.exporter.*` metrics.
|
|
12
|
+
* https://opentelemetry.io/docs/specs/semconv/otel/sdk-metrics
|
|
13
|
+
*/
|
|
14
|
+
export declare class ExporterMetrics<Internal> {
|
|
15
|
+
private readonly inflight;
|
|
16
|
+
private readonly exported;
|
|
17
|
+
private readonly duration;
|
|
18
|
+
private readonly standardAttrs;
|
|
19
|
+
private readonly responseAttributesFromError;
|
|
20
|
+
private readonly helper;
|
|
21
|
+
constructor(options: ExporterMetricsOptions<Internal>);
|
|
22
|
+
startExport(request: Internal): (error: Error | string | undefined) => void;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=ExporterMetrics.d.ts.map
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright The OpenTelemetry Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ExporterMetrics = void 0;
|
|
8
|
+
const api_1 = require("@opentelemetry/api");
|
|
9
|
+
const core_1 = require("@opentelemetry/core");
|
|
10
|
+
const semconv_1 = require("./semconv");
|
|
11
|
+
const version_1 = require("./version");
|
|
12
|
+
const componentCounter = new Map();
|
|
13
|
+
/**
|
|
14
|
+
* Generates `otel.sdk.exporter.*` metrics.
|
|
15
|
+
* https://opentelemetry.io/docs/specs/semconv/otel/sdk-metrics
|
|
16
|
+
*/
|
|
17
|
+
class ExporterMetrics {
|
|
18
|
+
inflight;
|
|
19
|
+
exported;
|
|
20
|
+
duration;
|
|
21
|
+
standardAttrs;
|
|
22
|
+
responseAttributesFromError;
|
|
23
|
+
helper;
|
|
24
|
+
constructor(options) {
|
|
25
|
+
const { componentType, metricsHelper, meterProvider, url, responseAttributesFromError, } = options;
|
|
26
|
+
this.responseAttributesFromError = responseAttributesFromError;
|
|
27
|
+
const meter = meterProvider
|
|
28
|
+
? meterProvider.getMeter('@opentelemetry/otlp-exporter', version_1.VERSION)
|
|
29
|
+
: (0, api_1.createNoopMeter)();
|
|
30
|
+
const counter = componentCounter.get(componentType) ?? 0;
|
|
31
|
+
componentCounter.set(componentType, counter + 1);
|
|
32
|
+
this.standardAttrs = {
|
|
33
|
+
[semconv_1.ATTR_OTEL_COMPONENT_TYPE]: componentType,
|
|
34
|
+
[semconv_1.ATTR_OTEL_COMPONENT_NAME]: `${componentType}/${counter}`,
|
|
35
|
+
};
|
|
36
|
+
if (url) {
|
|
37
|
+
// URLs may exclude scheme for gRPC endpoints, but in this case they always
|
|
38
|
+
// have a port number. Because the URL constructor requires a scheme, we
|
|
39
|
+
// can still handle gRPC endpoints by prepending an arbitrary scheme.
|
|
40
|
+
let urlToParse = url;
|
|
41
|
+
if (!url.includes('://')) {
|
|
42
|
+
urlToParse = `http://${url}`;
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
const parsedUrl = new URL(urlToParse);
|
|
46
|
+
this.standardAttrs[semconv_1.ATTR_SERVER_ADDRESS] = parsedUrl.hostname;
|
|
47
|
+
let port = undefined;
|
|
48
|
+
if (parsedUrl.port) {
|
|
49
|
+
port = Number(parsedUrl.port);
|
|
50
|
+
}
|
|
51
|
+
else if (parsedUrl.protocol === 'http:') {
|
|
52
|
+
port = 80;
|
|
53
|
+
}
|
|
54
|
+
else if (parsedUrl.protocol === 'https:') {
|
|
55
|
+
port = 443;
|
|
56
|
+
}
|
|
57
|
+
if (typeof port === 'number') {
|
|
58
|
+
this.standardAttrs[semconv_1.ATTR_SERVER_PORT] = port;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
// In practice, URLs will be valid or something else will break. Better to let that
|
|
63
|
+
// inform the user than an exception in this internal code and proceed best-effort
|
|
64
|
+
// here.
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
this.helper = metricsHelper;
|
|
68
|
+
this.inflight = meter.createUpDownCounter(`otel.sdk.exporter.${this.helper.name}.inflight`, {
|
|
69
|
+
unit: `{${this.helper.name}}`,
|
|
70
|
+
description: `The number of ${this.helper.name}s which were passed to the exporter, but that have not been exported yet (neither successful, nor failed).`,
|
|
71
|
+
});
|
|
72
|
+
this.exported = meter.createCounter(`otel.sdk.exporter.${this.helper.name}.exported`, {
|
|
73
|
+
unit: `{${this.helper.name}}`,
|
|
74
|
+
description: `The number of ${this.helper.name}s for which the export has finished, either successful or failed.`,
|
|
75
|
+
});
|
|
76
|
+
this.duration = meter.createHistogram('otel.sdk.exporter.operation.duration', {
|
|
77
|
+
unit: 's',
|
|
78
|
+
description: 'The duration of exporting a batch of telemetry records.',
|
|
79
|
+
advice: {
|
|
80
|
+
explicitBucketBoundaries: [],
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
startExport(request) {
|
|
85
|
+
const numItems = this.helper.countItems(request);
|
|
86
|
+
const startTime = (0, core_1.hrTime)();
|
|
87
|
+
this.inflight.add(numItems, this.standardAttrs);
|
|
88
|
+
return (error) => {
|
|
89
|
+
const endTime = (0, core_1.hrTime)();
|
|
90
|
+
this.inflight.add(-numItems, this.standardAttrs);
|
|
91
|
+
const exportedAttrs = error
|
|
92
|
+
? {
|
|
93
|
+
...this.standardAttrs,
|
|
94
|
+
[semconv_1.ATTR_ERROR_TYPE]: error instanceof Error ? error.name : 'export_failed',
|
|
95
|
+
}
|
|
96
|
+
: this.standardAttrs;
|
|
97
|
+
this.exported.add(numItems, exportedAttrs);
|
|
98
|
+
const durationAttrs = {
|
|
99
|
+
...exportedAttrs,
|
|
100
|
+
...this.responseAttributesFromError(error),
|
|
101
|
+
};
|
|
102
|
+
const duration = (0, core_1.hrTimeToMilliseconds)((0, core_1.hrTimeDuration)(startTime, endTime)) / 1000;
|
|
103
|
+
this.duration.record(duration, durationAttrs);
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
exports.ExporterMetrics = ExporterMetrics;
|
|
108
|
+
//# sourceMappingURL=ExporterMetrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExporterMetrics.js","sourceRoot":"","sources":["../../src/ExporterMetrics.ts"],"names":[],"mappings":"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","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n type Attributes,\n type Counter,\n type Histogram,\n type MeterProvider,\n type UpDownCounter,\n createNoopMeter,\n} from '@opentelemetry/api';\nimport {\n hrTime,\n hrTimeDuration,\n hrTimeToMilliseconds,\n} from '@opentelemetry/core';\nimport { type IExporterMetricsHelper } from '@opentelemetry/otlp-transformer';\nimport {\n ATTR_ERROR_TYPE,\n ATTR_OTEL_COMPONENT_NAME,\n ATTR_OTEL_COMPONENT_TYPE,\n ATTR_SERVER_ADDRESS,\n ATTR_SERVER_PORT,\n} from './semconv';\nimport { VERSION } from './version';\n\nconst componentCounter = new Map<string, number>();\n\nexport interface ExporterMetricsOptions<Internal> {\n componentType: string;\n metricsHelper: IExporterMetricsHelper<Internal>;\n url: string | undefined;\n meterProvider: MeterProvider | undefined;\n responseAttributesFromError: (\n error: Error | string | undefined\n ) => Attributes;\n}\n\n/**\n * Generates `otel.sdk.exporter.*` metrics.\n * https://opentelemetry.io/docs/specs/semconv/otel/sdk-metrics\n */\nexport class ExporterMetrics<Internal> {\n private readonly inflight: UpDownCounter;\n private readonly exported: Counter;\n private readonly duration: Histogram;\n private readonly standardAttrs: Attributes;\n private readonly responseAttributesFromError: (\n error: Error | string | undefined\n ) => Attributes;\n\n private readonly helper: IExporterMetricsHelper<Internal>;\n\n constructor(options: ExporterMetricsOptions<Internal>) {\n const {\n componentType,\n metricsHelper,\n meterProvider,\n url,\n responseAttributesFromError,\n } = options;\n this.responseAttributesFromError = responseAttributesFromError;\n const meter = meterProvider\n ? meterProvider.getMeter('@opentelemetry/otlp-exporter', VERSION)\n : createNoopMeter();\n\n const counter = componentCounter.get(componentType) ?? 0;\n componentCounter.set(componentType, counter + 1);\n\n this.standardAttrs = {\n [ATTR_OTEL_COMPONENT_TYPE]: componentType,\n [ATTR_OTEL_COMPONENT_NAME]: `${componentType}/${counter}`,\n };\n if (url) {\n // URLs may exclude scheme for gRPC endpoints, but in this case they always\n // have a port number. Because the URL constructor requires a scheme, we\n // can still handle gRPC endpoints by prepending an arbitrary scheme.\n let urlToParse = url;\n if (!url.includes('://')) {\n urlToParse = `http://${url}`;\n }\n try {\n const parsedUrl = new URL(urlToParse);\n this.standardAttrs[ATTR_SERVER_ADDRESS] = parsedUrl.hostname;\n let port: number | undefined = undefined;\n if (parsedUrl.port) {\n port = Number(parsedUrl.port);\n } else if (parsedUrl.protocol === 'http:') {\n port = 80;\n } else if (parsedUrl.protocol === 'https:') {\n port = 443;\n }\n if (typeof port === 'number') {\n this.standardAttrs[ATTR_SERVER_PORT] = port;\n }\n } catch {\n // In practice, URLs will be valid or something else will break. Better to let that\n // inform the user than an exception in this internal code and proceed best-effort\n // here.\n }\n }\n\n this.helper = metricsHelper;\n\n this.inflight = meter.createUpDownCounter(\n `otel.sdk.exporter.${this.helper.name}.inflight`,\n {\n unit: `{${this.helper.name}}`,\n description: `The number of ${this.helper.name}s which were passed to the exporter, but that have not been exported yet (neither successful, nor failed).`,\n }\n );\n this.exported = meter.createCounter(\n `otel.sdk.exporter.${this.helper.name}.exported`,\n {\n unit: `{${this.helper.name}}`,\n description: `The number of ${this.helper.name}s for which the export has finished, either successful or failed.`,\n }\n );\n this.duration = meter.createHistogram(\n 'otel.sdk.exporter.operation.duration',\n {\n unit: 's',\n description: 'The duration of exporting a batch of telemetry records.',\n advice: {\n explicitBucketBoundaries: [],\n },\n }\n );\n }\n\n startExport(request: Internal): (error: Error | string | undefined) => void {\n const numItems = this.helper.countItems(request);\n const startTime = hrTime();\n this.inflight.add(numItems, this.standardAttrs);\n return (error: Error | string | undefined) => {\n const endTime = hrTime();\n this.inflight.add(-numItems, this.standardAttrs);\n const exportedAttrs = error\n ? {\n ...this.standardAttrs,\n [ATTR_ERROR_TYPE]:\n error instanceof Error ? error.name : 'export_failed',\n }\n : this.standardAttrs;\n this.exported.add(numItems, exportedAttrs);\n const durationAttrs = {\n ...exportedAttrs,\n ...this.responseAttributesFromError(error),\n };\n const duration =\n hrTimeToMilliseconds(hrTimeDuration(startTime, endTime)) / 1000;\n this.duration.record(duration, durationAttrs);\n };\n }\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ExportResult } from '@opentelemetry/core';
|
|
2
2
|
import type { IOtlpExportDelegate } from './otlp-export-delegate';
|
|
3
|
+
import { type ExporterMetrics } from './ExporterMetrics';
|
|
3
4
|
export declare class OTLPExporterBase<Internal> {
|
|
4
5
|
private _delegate;
|
|
5
6
|
constructor(delegate: IOtlpExportDelegate<Internal>);
|
|
@@ -11,5 +12,6 @@ export declare class OTLPExporterBase<Internal> {
|
|
|
11
12
|
export(items: Internal, resultCallback: (result: ExportResult) => void): void;
|
|
12
13
|
forceFlush(): Promise<void>;
|
|
13
14
|
shutdown(): Promise<void>;
|
|
15
|
+
protected setMetrics(metrics: ExporterMetrics<Internal>): void;
|
|
14
16
|
}
|
|
15
17
|
//# sourceMappingURL=OTLPExporterBase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OTLPExporterBase.js","sourceRoot":"","sources":["../../src/OTLPExporterBase.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"OTLPExporterBase.js","sourceRoot":"","sources":["../../src/OTLPExporterBase.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAMH,MAAa,gBAAgB;IACnB,SAAS,CAAgC;IACjD,YAAY,QAAuC;QACjD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACH,MAAM,CACJ,KAAe,EACf,cAA8C;QAE9C,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;IAC/C,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;IACnC,CAAC;IAES,UAAU,CAAC,OAAkC;QACrD,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;CACF;AA7BD,4CA6BC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { ExportResult } from '@opentelemetry/core';\nimport type { IOtlpExportDelegate } from './otlp-export-delegate';\nimport { type ExporterMetrics } from './ExporterMetrics';\n\nexport class OTLPExporterBase<Internal> {\n private _delegate: IOtlpExportDelegate<Internal>;\n constructor(delegate: IOtlpExportDelegate<Internal>) {\n this._delegate = delegate;\n }\n\n /**\n * Export items.\n * @param items\n * @param resultCallback\n */\n export(\n items: Internal,\n resultCallback: (result: ExportResult) => void\n ): void {\n this._delegate.export(items, resultCallback);\n }\n\n forceFlush(): Promise<void> {\n return this._delegate.forceFlush();\n }\n\n shutdown(): Promise<void> {\n return this._delegate.shutdown();\n }\n\n protected setMetrics(metrics: ExporterMetrics<Internal>) {\n this._delegate.setMetrics(metrics);\n }\n}\n"]}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MeterProvider } from '@opentelemetry/api';
|
|
2
|
+
import type { IExporterMetricsHelper, ISerializer } from '@opentelemetry/otlp-transformer';
|
|
2
3
|
import type { IOtlpExportDelegate } from '../otlp-export-delegate';
|
|
3
4
|
import type { OTLPExporterConfigBase } from './legacy-base-configuration';
|
|
5
|
+
import { ExporterMetrics } from '../ExporterMetrics';
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated
|
|
8
|
+
*/
|
|
9
|
+
export declare function createLegacyOtlpBrowserExporterMetrics<Internal>(metricsComponentType: string, exporterMetricsHelper: IExporterMetricsHelper<Internal>, url: string | undefined, meterProvider: MeterProvider | undefined): ExporterMetrics<Internal>;
|
|
4
10
|
/**
|
|
5
11
|
* @deprecated
|
|
6
12
|
* @param config
|
|
@@ -8,5 +14,5 @@ import type { OTLPExporterConfigBase } from './legacy-base-configuration';
|
|
|
8
14
|
* @param signalResourcePath
|
|
9
15
|
* @param requiredHeaders
|
|
10
16
|
*/
|
|
11
|
-
export declare function createLegacyOtlpBrowserExportDelegate<Internal, Response>(config: OTLPExporterConfigBase, serializer: ISerializer<Internal, Response>, signalResourcePath: string, requiredHeaders: Record<string, string>): IOtlpExportDelegate<Internal>;
|
|
17
|
+
export declare function createLegacyOtlpBrowserExportDelegate<Internal, Response>(config: OTLPExporterConfigBase, serializer: ISerializer<Internal, Response>, metricsComponentType: string, exporterMetricsHelper: IExporterMetricsHelper<Internal>, meterProvider: MeterProvider | undefined, signalResourcePath: string, requiredHeaders: Record<string, string>): IOtlpExportDelegate<Internal>;
|
|
12
18
|
//# sourceMappingURL=create-legacy-browser-delegate.d.ts.map
|
|
@@ -1,8 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright The OpenTelemetry Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
2
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createLegacyOtlpBrowserExportDelegate = void 0;
|
|
7
|
+
exports.createLegacyOtlpBrowserExportDelegate = exports.createLegacyOtlpBrowserExporterMetrics = void 0;
|
|
4
8
|
const otlp_browser_http_export_delegate_1 = require("../otlp-browser-http-export-delegate");
|
|
5
9
|
const convert_legacy_browser_http_options_1 = require("./convert-legacy-browser-http-options");
|
|
10
|
+
const semconv_1 = require("../semconv");
|
|
11
|
+
const ExporterMetrics_1 = require("../ExporterMetrics");
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated
|
|
14
|
+
*/
|
|
15
|
+
function createLegacyOtlpBrowserExporterMetrics(metricsComponentType, exporterMetricsHelper, url, meterProvider) {
|
|
16
|
+
return new ExporterMetrics_1.ExporterMetrics({
|
|
17
|
+
componentType: metricsComponentType,
|
|
18
|
+
metricsHelper: exporterMetricsHelper,
|
|
19
|
+
url,
|
|
20
|
+
meterProvider,
|
|
21
|
+
responseAttributesFromError: (error) => {
|
|
22
|
+
if (!error) {
|
|
23
|
+
return {
|
|
24
|
+
[semconv_1.ATTR_HTTP_RESPONSE_STATUS_CODE]: 200,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
if (!(error instanceof Error)) {
|
|
28
|
+
return {};
|
|
29
|
+
}
|
|
30
|
+
if (error.message.startsWith('Fetch request failed with non-retryable status ')) {
|
|
31
|
+
const statusStr = error.message.substring('Fetch request failed with non-retryable status '.length);
|
|
32
|
+
return {
|
|
33
|
+
[semconv_1.ATTR_HTTP_RESPONSE_STATUS_CODE]: Number(statusStr),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return {};
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
exports.createLegacyOtlpBrowserExporterMetrics = createLegacyOtlpBrowserExporterMetrics;
|
|
6
41
|
/**
|
|
7
42
|
* @deprecated
|
|
8
43
|
* @param config
|
|
@@ -10,9 +45,9 @@ const convert_legacy_browser_http_options_1 = require("./convert-legacy-browser-
|
|
|
10
45
|
* @param signalResourcePath
|
|
11
46
|
* @param requiredHeaders
|
|
12
47
|
*/
|
|
13
|
-
function createLegacyOtlpBrowserExportDelegate(config, serializer, signalResourcePath, requiredHeaders) {
|
|
48
|
+
function createLegacyOtlpBrowserExportDelegate(config, serializer, metricsComponentType, exporterMetricsHelper, meterProvider, signalResourcePath, requiredHeaders) {
|
|
14
49
|
const options = (0, convert_legacy_browser_http_options_1.convertLegacyBrowserHttpOptions)(config, signalResourcePath, requiredHeaders);
|
|
15
|
-
return (0, otlp_browser_http_export_delegate_1.createOtlpFetchExportDelegate)(options, serializer);
|
|
50
|
+
return (0, otlp_browser_http_export_delegate_1.createOtlpFetchExportDelegate)(options, serializer, createLegacyOtlpBrowserExporterMetrics(metricsComponentType, exporterMetricsHelper, options.url, config.selfObsMeterProvider));
|
|
16
51
|
}
|
|
17
52
|
exports.createLegacyOtlpBrowserExportDelegate = createLegacyOtlpBrowserExportDelegate;
|
|
18
53
|
//# sourceMappingURL=create-legacy-browser-delegate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-legacy-browser-delegate.js","sourceRoot":"","sources":["../../../src/configuration/create-legacy-browser-delegate.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"create-legacy-browser-delegate.js","sourceRoot":"","sources":["../../../src/configuration/create-legacy-browser-delegate.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,4FAAqF;AACrF,+FAAwF;AAGxF,wCAA4D;AAC5D,wDAAqD;AAErD;;GAEG;AACH,SAAgB,sCAAsC,CACpD,oBAA4B,EAC5B,qBAAuD,EACvD,GAAuB,EACvB,aAAwC;IAExC,OAAO,IAAI,iCAAe,CAAC;QACzB,aAAa,EAAE,oBAAoB;QACnC,aAAa,EAAE,qBAAqB;QACpC,GAAG;QACH,aAAa;QACb,2BAA2B,EAAE,CAAC,KAAiC,EAAE,EAAE;YACjE,IAAI,CAAC,KAAK,EAAE;gBACV,OAAO;oBACL,CAAC,wCAA8B,CAAC,EAAE,GAAG;iBACtC,CAAC;aACH;YACD,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC,EAAE;gBAC7B,OAAO,EAAE,CAAC;aACX;YACD,IACE,KAAK,CAAC,OAAO,CAAC,UAAU,CACtB,iDAAiD,CAClD,EACD;gBACA,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CACvC,iDAAiD,CAAC,MAAM,CACzD,CAAC;gBACF,OAAO;oBACL,CAAC,wCAA8B,CAAC,EAAE,MAAM,CAAC,SAAS,CAAC;iBACpD,CAAC;aACH;YACD,OAAO,EAAE,CAAC;QACZ,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAnCD,wFAmCC;AAED;;;;;;GAMG;AACH,SAAgB,qCAAqC,CACnD,MAA8B,EAC9B,UAA2C,EAC3C,oBAA4B,EAC5B,qBAAuD,EACvD,aAAwC,EACxC,kBAA0B,EAC1B,eAAuC;IAEvC,MAAM,OAAO,GAAG,IAAA,qEAA+B,EAC7C,MAAM,EACN,kBAAkB,EAClB,eAAe,CAChB,CAAC;IAEF,OAAO,IAAA,iEAA6B,EAClC,OAAO,EACP,UAAU,EACV,sCAAsC,CACpC,oBAAoB,EACpB,qBAAqB,EACrB,OAAO,CAAC,GAAG,EACX,MAAM,CAAC,oBAAoB,CAC5B,CACF,CAAC;AACJ,CAAC;AAzBD,sFAyBC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { MeterProvider } from '@opentelemetry/api';\nimport type {\n IExporterMetricsHelper,\n ISerializer,\n} from '@opentelemetry/otlp-transformer';\nimport { createOtlpFetchExportDelegate } from '../otlp-browser-http-export-delegate';\nimport { convertLegacyBrowserHttpOptions } from './convert-legacy-browser-http-options';\nimport type { IOtlpExportDelegate } from '../otlp-export-delegate';\nimport type { OTLPExporterConfigBase } from './legacy-base-configuration';\nimport { ATTR_HTTP_RESPONSE_STATUS_CODE } from '../semconv';\nimport { ExporterMetrics } from '../ExporterMetrics';\n\n/**\n * @deprecated\n */\nexport function createLegacyOtlpBrowserExporterMetrics<Internal>(\n metricsComponentType: string,\n exporterMetricsHelper: IExporterMetricsHelper<Internal>,\n url: string | undefined,\n meterProvider: MeterProvider | undefined\n): ExporterMetrics<Internal> {\n return new ExporterMetrics({\n componentType: metricsComponentType,\n metricsHelper: exporterMetricsHelper,\n url,\n meterProvider,\n responseAttributesFromError: (error: Error | string | undefined) => {\n if (!error) {\n return {\n [ATTR_HTTP_RESPONSE_STATUS_CODE]: 200,\n };\n }\n if (!(error instanceof Error)) {\n return {};\n }\n if (\n error.message.startsWith(\n 'Fetch request failed with non-retryable status '\n )\n ) {\n const statusStr = error.message.substring(\n 'Fetch request failed with non-retryable status '.length\n );\n return {\n [ATTR_HTTP_RESPONSE_STATUS_CODE]: Number(statusStr),\n };\n }\n return {};\n },\n });\n}\n\n/**\n * @deprecated\n * @param config\n * @param serializer\n * @param signalResourcePath\n * @param requiredHeaders\n */\nexport function createLegacyOtlpBrowserExportDelegate<Internal, Response>(\n config: OTLPExporterConfigBase,\n serializer: ISerializer<Internal, Response>,\n metricsComponentType: string,\n exporterMetricsHelper: IExporterMetricsHelper<Internal>,\n meterProvider: MeterProvider | undefined,\n signalResourcePath: string,\n requiredHeaders: Record<string, string>\n): IOtlpExportDelegate<Internal> {\n const options = convertLegacyBrowserHttpOptions(\n config,\n signalResourcePath,\n requiredHeaders\n );\n\n return createOtlpFetchExportDelegate(\n options,\n serializer,\n createLegacyOtlpBrowserExporterMetrics(\n metricsComponentType,\n exporterMetricsHelper,\n options.url,\n config.selfObsMeterProvider\n )\n );\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MeterProvider } from '@opentelemetry/api';
|
|
1
2
|
import type { HeadersFactory } from './otlp-http-configuration';
|
|
2
3
|
export interface OTLPExporterConfigBase {
|
|
3
4
|
/**
|
|
@@ -5,11 +6,8 @@ export interface OTLPExporterConfigBase {
|
|
|
5
6
|
*
|
|
6
7
|
* @remarks
|
|
7
8
|
* Prefer using a plain object over a factory function wherever possible.
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* module is not loaded before `@opentelemetry/instrumentation-http` can instrument it.
|
|
11
|
-
*
|
|
12
|
-
* Functions passed to the exporter MUST NOT throw errors.
|
|
9
|
+
* A factory function may be async and MUST NOT throw errors.
|
|
10
|
+
* It should return a string map containing the headers to add to the request.
|
|
13
11
|
*
|
|
14
12
|
* @example <caption> Using headers options directly: </caption>
|
|
15
13
|
* headers: {
|
|
@@ -18,17 +16,37 @@ export interface OTLPExporterConfigBase {
|
|
|
18
16
|
*
|
|
19
17
|
* @example <caption> Using a custom factory function </caption>
|
|
20
18
|
* headers: async () => {
|
|
21
|
-
* // ... do whatever you need to obtain the headers, ensuring you `await import('your-library')` to avoid breaking instrumentations ...
|
|
22
19
|
* return {
|
|
23
20
|
* Authorization: `Bearer ${token}`,
|
|
24
21
|
* };
|
|
25
22
|
* };
|
|
26
23
|
*/
|
|
27
24
|
headers?: Record<string, string> | HeadersFactory;
|
|
25
|
+
/**
|
|
26
|
+
* Collector endpoint URL for the exporter.
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* Defaults to the signal-specific endpoint, such as
|
|
30
|
+
* `http://localhost:4318/v1/traces`, `http://localhost:4318/v1/metrics`,
|
|
31
|
+
* or `http://localhost:4318/v1/logs`.
|
|
32
|
+
*/
|
|
28
33
|
url?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Maximum number of in-flight export requests.
|
|
36
|
+
*
|
|
37
|
+
* @defaultValue 30
|
|
38
|
+
*/
|
|
29
39
|
concurrencyLimit?: number;
|
|
30
|
-
/**
|
|
31
|
-
*
|
|
40
|
+
/**
|
|
41
|
+
* Maximum time, in milliseconds, the OTLP exporter will wait for each batch export.
|
|
42
|
+
*
|
|
43
|
+
* @defaultValue 10000
|
|
44
|
+
*/
|
|
32
45
|
timeoutMillis?: number;
|
|
46
|
+
/**
|
|
47
|
+
* MeterProvider to record metrics for the exporter itself.
|
|
48
|
+
* @experimental This option is experimental and is subject to breaking changes in minor releases.
|
|
49
|
+
*/
|
|
50
|
+
selfObsMeterProvider?: MeterProvider;
|
|
33
51
|
}
|
|
34
52
|
//# sourceMappingURL=legacy-base-configuration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy-base-configuration.js","sourceRoot":"","sources":["../../../src/configuration/legacy-base-configuration.ts"],"names":[],"mappings":"","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { HeadersFactory } from './otlp-http-configuration';\n\nexport interface OTLPExporterConfigBase {\n /**\n * Custom headers that will be attached to the HTTP request that's sent to the endpoint.\n *\n * @remarks\n * Prefer using a plain object over a factory function wherever possible.\n *
|
|
1
|
+
{"version":3,"file":"legacy-base-configuration.js","sourceRoot":"","sources":["../../../src/configuration/legacy-base-configuration.ts"],"names":[],"mappings":"","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { MeterProvider } from '@opentelemetry/api';\nimport type { HeadersFactory } from './otlp-http-configuration';\n\nexport interface OTLPExporterConfigBase {\n /**\n * Custom headers that will be attached to the HTTP request that's sent to the endpoint.\n *\n * @remarks\n * Prefer using a plain object over a factory function wherever possible.\n * A factory function may be async and MUST NOT throw errors.\n * It should return a string map containing the headers to add to the request.\n *\n * @example <caption> Using headers options directly: </caption>\n * headers: {\n * Authorization: \"Api-Token my-secret-token\",\n * }\n *\n * @example <caption> Using a custom factory function </caption>\n * headers: async () => {\n * return {\n * Authorization: `Bearer ${token}`,\n * };\n * };\n */\n headers?: Record<string, string> | HeadersFactory;\n /**\n * Collector endpoint URL for the exporter.\n *\n * @remarks\n * Defaults to the signal-specific endpoint, such as\n * `http://localhost:4318/v1/traces`, `http://localhost:4318/v1/metrics`,\n * or `http://localhost:4318/v1/logs`.\n */\n url?: string;\n /**\n * Maximum number of in-flight export requests.\n *\n * @defaultValue 30\n */\n concurrencyLimit?: number;\n /**\n * Maximum time, in milliseconds, the OTLP exporter will wait for each batch export.\n *\n * @defaultValue 10000\n */\n timeoutMillis?: number;\n\n /**\n * MeterProvider to record metrics for the exporter itself.\n * @experimental This option is experimental and is subject to breaking changes in minor releases.\n */\n selfObsMeterProvider?: MeterProvider;\n}\n"]}
|