You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(sdk-node): add serviceInstanceIdDetector to NodeSDK (open-telemetry#4626)
* feat(sdk-node): add serviceInstanceIDDetector to NodeSDK
Follow up from open-telemetry#4608
Adds the resource detector ServiceInstanceIDDetector on the NodeSDK constructor.
It only gets added by default on any of those conditions:
- the value `serviceinstance` is part of the list `OTEL_NODE_RESOURCE_DETECTORS`
- `OTEL_NODE_EXPERIMENTAL_DEFAULT_SERVICE_INSTANCE_ID` is set to `true`
* remove OTEL_NODE_EXPERIMENTAL_DEFAULT_SERVICE_INSTANCE_ID
Signed-off-by: maryliag <[email protected]>
* update readme on how to use `OTEL_NODE_RESOURCE_DETECTORS`
* feedback from review
* Update experimental/packages/opentelemetry-sdk-node/README.md
Co-authored-by: Marc Pichler <[email protected]>
* feedback from review
---------
Signed-off-by: maryliag <[email protected]>
Co-authored-by: Marc Pichler <[email protected]>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/
13
13
14
14
* feat(sdk-trace-base): log resource attributes in ConsoleSpanExporter [#4605](https://github.com/open-telemetry/opentelemetry-js/pull/4605)@pichlermarc
15
15
* feat(propagator-aws-xray): moved AWS Xray propagator from contrib [4603](https://github.com/open-telemetry/opentelemetry-js/pull/4603)@martinkuba
16
-
* feat(resources): new experimental detector ServiceInstanceIdDetectorSync that sets the value for `service.instance.id` as random UUID.
16
+
* feat(resources): new experimental detector ServiceInstanceIdDetectorSync that sets the value for `service.instance.id` as random UUID.[#4608](https://github.com/open-telemetry/opentelemetry-js/pull/4608)@maryliag
Copy file name to clipboardExpand all lines: experimental/CHANGELOG.md
+5
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,11 @@ All notable changes to experimental packages in this project will be documented
18
18
* refactor(instrumentation-grpc): move to use SEMATTRS [#4633](https://github.com/open-telemetry/opentelemetry-js/pull/4633)
19
19
* feat(otlp-transformer): consolidate scope/resource creation in transformer [#4600](https://github.com/open-telemetry/opentelemetry-js/pull/4600)
20
20
* feat(sdk-logs): print message when attributes are dropped due to attribute count limit [#4614](https://github.com/open-telemetry/opentelemetry-js/pull/4614)@HyunnoH
21
+
* feat(sdk-node): add usage for the detector ServiceInstanceIdDetectorSync. [#4626](https://github.com/open-telemetry/opentelemetry-js/pull/4626)@maryliag
22
+
* The resource detector can be added to default resource detector list by adding the value `serviceinstance` to the list of resource detectors on the environment variable `OTEL_NODE_RESOURCE_DETECTORS`, e.g `OTEL_NODE_RESOURCE_DETECTORS=env,host,os,serviceinstance`
23
+
* The value can be overwritten by
24
+
* merging a resource containing the `service.instance.id` attribute
25
+
* using another resource detector which writes `service.instance.id`
Copy file name to clipboardExpand all lines: experimental/packages/opentelemetry-sdk-node/README.md
+18-1
Original file line number
Diff line number
Diff line change
@@ -115,9 +115,26 @@ Configure a resource. Resources may also be detected by using the `autoDetectRes
115
115
116
116
### resourceDetectors
117
117
118
-
Configure resource detectors. By default, the resource detectors are [envDetector, processDetector].
118
+
Configure resource detectors. By default, the resource detectors are [envDetector, processDetector, hostDetector].
119
119
NOTE: In order to enable the detection, the parameter `autoDetectResources` has to be `true`.
120
120
121
+
If `resourceDetectors` was not set, you can also use the environment variable `OTEL_NODE_RESOURCE_DETECTORS` to enable only certain detectors, or completely disable them:
122
+
123
+
-`env`
124
+
-`host`
125
+
-`os`
126
+
-`process`
127
+
-`serviceinstance` (experimental)
128
+
-`all` - enable all resource detectors above
129
+
-**NOTE:** future versions of `@opentelemetry/sdk-node` may include additional detectors that will be covered by this scope.
130
+
-`none` - disable resource detection
131
+
132
+
For example, to enable only the `env`, `host` detectors:
133
+
134
+
```shell
135
+
export OTEL_NODE_RESOURCE_DETECTORS="env,host"
136
+
```
137
+
121
138
### sampler
122
139
123
140
Configure a custom sampler. By default, all traces will be sampled.
0 commit comments