@opentelemetry/exporter-trace-otlp-proto 0.28.0 → 0.29.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 +36 -4
- package/build/src/OTLPTraceExporter.d.ts +3 -3
- package/build/src/OTLPTraceExporter.js +6 -6
- package/build/src/OTLPTraceExporter.js.map +1 -1
- package/build/src/version.d.ts +1 -1
- package/build/src/version.js +1 -1
- package/build/src/version.js.map +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
[![NPM Published Version][npm-img]][npm-url]
|
|
4
4
|
[![Apache License][license-image]][license-image]
|
|
5
5
|
|
|
6
|
-
This module provides exporter for node to be used with [opentelemetry-collector][opentelemetry-collector-url]
|
|
6
|
+
This module provides exporter for node to be used with [opentelemetry-collector][opentelemetry-collector-url].
|
|
7
|
+
Compatible with [opentelemetry-collector][opentelemetry-collector-url] versions `>=0.32 <=0.50`.
|
|
7
8
|
|
|
8
9
|
## Installation
|
|
9
10
|
|
|
@@ -38,6 +39,37 @@ provider.register();
|
|
|
38
39
|
|
|
39
40
|
```
|
|
40
41
|
|
|
42
|
+
## Exporter Timeout Configuration
|
|
43
|
+
|
|
44
|
+
The OTLPTraceExporter has a timeout configuration option which is the maximum time, in milliseconds, the OTLP exporter will wait for each batch export. The default value is 10000ms.
|
|
45
|
+
|
|
46
|
+
To override the default timeout duration, use the following options:
|
|
47
|
+
|
|
48
|
+
+ Set with environment variables:
|
|
49
|
+
|
|
50
|
+
| Environment variable | Description |
|
|
51
|
+
|----------------------|-------------|
|
|
52
|
+
| OTEL_EXPORTER_OTLP_TRACES_TIMEOUT | The maximum waiting time, in milliseconds, allowed to send each OTLP trace batch. Default is 10000. |
|
|
53
|
+
| OTEL_EXPORTER_OTLP_TIMEOUT | The maximum waiting time, in milliseconds, allowed to send each OTLP trace and metric batch. Default is 10000. |
|
|
54
|
+
|
|
55
|
+
> `OTEL_EXPORTER_OTLP_TRACES_TIMEOUT` takes precedence and overrides `OTEL_EXPORTER_OTLP_TIMEOUT`.
|
|
56
|
+
|
|
57
|
+
+ Provide `timeoutMillis` to OTLPTraceExporter with `collectorOptions`:
|
|
58
|
+
|
|
59
|
+
```js
|
|
60
|
+
const collectorOptions = {
|
|
61
|
+
timeoutMillis: 15000,
|
|
62
|
+
url: '<opentelemetry-collector-url>', // url is optional and can be omitted - default is http://localhost:4318/v1/traces
|
|
63
|
+
headers: {
|
|
64
|
+
foo: 'bar'
|
|
65
|
+
}, //an optional object containing custom headers to be sent with each request will only work with http
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const exporter = new OTLPTraceExporter(collectorOptions);
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
> Providing `timeoutMillis` with `collectorOptions` takes precedence and overrides timeout set with environment variables.
|
|
72
|
+
|
|
41
73
|
## Running opentelemetry-collector locally to see the traces
|
|
42
74
|
|
|
43
75
|
1. Go to examples/otlp-exporter-node
|
|
@@ -46,9 +78,9 @@ provider.register();
|
|
|
46
78
|
|
|
47
79
|
## Useful links
|
|
48
80
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
81
|
+
+ For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
|
|
82
|
+
+ For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
|
|
83
|
+
+ For help or feedback on this project, join us in [GitHub Discussions][discussions-url]
|
|
52
84
|
|
|
53
85
|
## License
|
|
54
86
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base';
|
|
2
|
-
import { otlpTypes } from '@opentelemetry/exporter-trace-otlp-http';
|
|
3
2
|
import { OTLPExporterNodeConfigBase } from '@opentelemetry/otlp-exporter-base';
|
|
4
3
|
import { OTLPProtoExporterNodeBase, ServiceClientType } from '@opentelemetry/otlp-proto-exporter-base';
|
|
4
|
+
import { IExportTraceServiceRequest } from '@opentelemetry/otlp-transformer';
|
|
5
5
|
/**
|
|
6
6
|
* Collector Trace Exporter for Node with protobuf
|
|
7
7
|
*/
|
|
8
|
-
export declare class OTLPTraceExporter extends OTLPProtoExporterNodeBase<ReadableSpan,
|
|
8
|
+
export declare class OTLPTraceExporter extends OTLPProtoExporterNodeBase<ReadableSpan, IExportTraceServiceRequest> implements SpanExporter {
|
|
9
9
|
constructor(config?: OTLPExporterNodeConfigBase);
|
|
10
|
-
convert(spans: ReadableSpan[]):
|
|
10
|
+
convert(spans: ReadableSpan[]): IExportTraceServiceRequest;
|
|
11
11
|
getDefaultUrl(config: OTLPExporterNodeConfigBase): string;
|
|
12
12
|
getServiceClientType(): ServiceClientType;
|
|
13
13
|
}
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.OTLPTraceExporter = void 0;
|
|
19
|
-
const exporter_trace_otlp_http_1 = require("@opentelemetry/exporter-trace-otlp-http");
|
|
20
19
|
const core_1 = require("@opentelemetry/core");
|
|
21
20
|
const otlp_exporter_base_1 = require("@opentelemetry/otlp-exporter-base");
|
|
22
21
|
const otlp_proto_exporter_base_1 = require("@opentelemetry/otlp-proto-exporter-base");
|
|
23
|
-
const
|
|
24
|
-
const
|
|
22
|
+
const otlp_transformer_1 = require("@opentelemetry/otlp-transformer");
|
|
23
|
+
const DEFAULT_COLLECTOR_RESOURCE_PATH = 'v1/traces';
|
|
24
|
+
const DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`;
|
|
25
25
|
/**
|
|
26
26
|
* Collector Trace Exporter for Node with protobuf
|
|
27
27
|
*/
|
|
@@ -31,15 +31,15 @@ class OTLPTraceExporter extends otlp_proto_exporter_base_1.OTLPProtoExporterNode
|
|
|
31
31
|
this.headers = Object.assign(this.headers, core_1.baggageUtils.parseKeyPairsIntoRecord((0, core_1.getEnv)().OTEL_EXPORTER_OTLP_TRACES_HEADERS));
|
|
32
32
|
}
|
|
33
33
|
convert(spans) {
|
|
34
|
-
return (0,
|
|
34
|
+
return (0, otlp_transformer_1.createExportTraceServiceRequest)(spans);
|
|
35
35
|
}
|
|
36
36
|
getDefaultUrl(config) {
|
|
37
37
|
return typeof config.url === 'string'
|
|
38
38
|
? config.url
|
|
39
39
|
: (0, core_1.getEnv)().OTEL_EXPORTER_OTLP_TRACES_ENDPOINT.length > 0
|
|
40
|
-
? (0, core_1.getEnv)().OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
|
|
40
|
+
? (0, otlp_exporter_base_1.appendRootPathToUrlIfNeeded)((0, core_1.getEnv)().OTEL_EXPORTER_OTLP_TRACES_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)
|
|
41
41
|
: (0, core_1.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0
|
|
42
|
-
? (0, otlp_exporter_base_1.
|
|
42
|
+
? (0, otlp_exporter_base_1.appendResourcePathToUrl)((0, core_1.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)
|
|
43
43
|
: DEFAULT_COLLECTOR_URL;
|
|
44
44
|
}
|
|
45
45
|
getServiceClientType() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OTLPTraceExporter.js","sourceRoot":"","sources":["../../src/OTLPTraceExporter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAGH,
|
|
1
|
+
{"version":3,"file":"OTLPTraceExporter.js","sourceRoot":"","sources":["../../src/OTLPTraceExporter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAGH,8CAA2D;AAC3D,0EAI2C;AAC3C,sFAAuG;AACvG,sEAA8G;AAE9G,MAAM,+BAA+B,GAAG,WAAW,CAAC;AACpD,MAAM,qBAAqB,GAAG,yBAAyB,+BAA+B,EAAE,CAAC;AAEzF;;GAEG;AACH,MAAa,iBACX,SAAQ,oDAGP;IAED,YAAY,SAAqC,EAAE;QACjD,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,iCAAiC,CAC3C,CACF,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,KAAqB;QAC3B,OAAO,IAAA,kDAA+B,EAAC,KAAK,CAAC,CAAC;IAChD,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,kCAAkC,CAAC,MAAM,GAAG,CAAC;gBACtD,CAAC,CAAC,IAAA,gDAA2B,EAAC,IAAA,aAAM,GAAE,CAAC,kCAAkC,EAAE,+BAA+B,CAAC;gBAC3G,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,oBAAoB;QAClB,OAAO,4CAAiB,CAAC,KAAK,CAAC;IACjC,CAAC;CACF;AAjCD,8CAiCC","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 { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base';\nimport { getEnv, baggageUtils } from '@opentelemetry/core';\nimport {\n OTLPExporterNodeConfigBase,\n appendResourcePathToUrl,\n appendRootPathToUrlIfNeeded\n} from '@opentelemetry/otlp-exporter-base';\nimport { OTLPProtoExporterNodeBase, ServiceClientType } from '@opentelemetry/otlp-proto-exporter-base';\nimport { createExportTraceServiceRequest, IExportTraceServiceRequest } from '@opentelemetry/otlp-transformer';\n\nconst DEFAULT_COLLECTOR_RESOURCE_PATH = 'v1/traces';\nconst DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`;\n\n/**\n * Collector Trace Exporter for Node with protobuf\n */\nexport class OTLPTraceExporter\n extends OTLPProtoExporterNodeBase<\n ReadableSpan,\n IExportTraceServiceRequest\n >\n implements SpanExporter {\n constructor(config: OTLPExporterNodeConfigBase = {}) {\n super(config);\n this.headers = Object.assign(\n this.headers,\n baggageUtils.parseKeyPairsIntoRecord(\n getEnv().OTEL_EXPORTER_OTLP_TRACES_HEADERS\n )\n );\n }\n\n convert(spans: ReadableSpan[]): IExportTraceServiceRequest {\n return createExportTraceServiceRequest(spans);\n }\n\n getDefaultUrl(config: OTLPExporterNodeConfigBase) {\n return typeof config.url === 'string'\n ? config.url\n : getEnv().OTEL_EXPORTER_OTLP_TRACES_ENDPOINT.length > 0\n ? appendRootPathToUrlIfNeeded(getEnv().OTEL_EXPORTER_OTLP_TRACES_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH)\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 getServiceClientType() {\n return ServiceClientType.SPANS;\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.29.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.29.0';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentelemetry/exporter-trace-otlp-proto",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"description": "OpenTelemetry Collector Exporter allows user to send collected traces to the OpenTelemetry Collector using protobuf over HTTP",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"types": "build/src/index.d.ts",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"rimraf": "3.0.2",
|
|
60
60
|
"sinon": "12.0.1",
|
|
61
61
|
"ts-loader": "8.3.0",
|
|
62
|
-
"ts-mocha": "
|
|
62
|
+
"ts-mocha": "9.0.2",
|
|
63
63
|
"typescript": "4.4.4"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
@@ -68,12 +68,12 @@
|
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@grpc/proto-loader": "^0.6.9",
|
|
70
70
|
"@opentelemetry/core": "1.1.1",
|
|
71
|
-
"@opentelemetry/exporter-
|
|
72
|
-
"@opentelemetry/otlp-exporter-base": "0.
|
|
73
|
-
"@opentelemetry/otlp-
|
|
74
|
-
"@opentelemetry/resources": "1.
|
|
75
|
-
"@opentelemetry/sdk-trace-base": "1.
|
|
71
|
+
"@opentelemetry/otlp-exporter-base": "0.29.0",
|
|
72
|
+
"@opentelemetry/otlp-proto-exporter-base": "0.29.0",
|
|
73
|
+
"@opentelemetry/otlp-transformer": "0.29.0",
|
|
74
|
+
"@opentelemetry/resources": "1.3.0",
|
|
75
|
+
"@opentelemetry/sdk-trace-base": "1.3.0",
|
|
76
76
|
"protobufjs": "^6.9.0"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "eda0b092db484855ded8b4837ba7fc19a377c5a7"
|
|
79
79
|
}
|