-
Notifications
You must be signed in to change notification settings - Fork 804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(resources): implements service.instance.id
#4608
feat(resources): implements service.instance.id
#4608
Conversation
ef5ba1f
to
059622b
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #4608 +/- ##
==========================================
- Coverage 92.83% 90.77% -2.06%
==========================================
Files 329 90 -239
Lines 9528 1930 -7598
Branches 2053 417 -1636
==========================================
- Hits 8845 1752 -7093
+ Misses 683 178 -505
|
Thanks for this!
I kinda think it should be on the default Resource ( opentelemetry-js/packages/opentelemetry-resources/src/Resource.ts Lines 52 to 62 in c046867
I think it is a bit odd that one would only get I don't think the extra
It would only be called once per |
ah good to hear it doesn't cause such a perf impact! |
Thanks for slogging through those. |
059622b
to
010970c
Compare
Implementation and PR description updates. I will focus on the tests now 😄 |
010970c
to
e96cfed
Compare
f6b4645
to
fde7eee
Compare
6eb66ea
to
745add0
Compare
service.instance.id
service.instance.id
Short summary of what we discussed in the SIG Meeting today 🙂
Implementing the resource detector and adding the env var behavior in NodeSDK can be done in seperate PRs to speed up the review process. 🚀 Separately from that:
|
148d48f
to
19c7189
Compare
Latest changes (and some questions):
Looking for some help: I added a few tests for a few cases with value coming fro env var VS should get set based on the experimental flag and one of the tests is failing but I don't quite get why. |
605cd62
to
670d528
Compare
while working on the following PR I realize it makes more sense to have all the logic of the env var on the other one, so I remove those from here. This PR focus on the creation of the service instance ID detector. It currently is not called anywhere, but we have a test showcasing that it works as expected if the user initializes their NodeSDK with it. The following PR (#4626) will add the |
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`
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`
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`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good 🙂
We can drop the Detector
and use DetectorSync
only. Other than that, only comments about marking things as @experimental
.
Thanks for sticking with us through the review-process 🙂
packages/opentelemetry-resources/src/platform/node/ServiceInstanceIDDetector.ts
Outdated
Show resolved
Hide resolved
packages/opentelemetry-resources/src/platform/node/ServiceInstanceIDDetectorSync.ts
Outdated
Show resolved
Hide resolved
packages/opentelemetry-resources/src/platform/browser/ServiceInstanceIDDetector.ts
Outdated
Show resolved
Hide resolved
packages/opentelemetry-resources/src/platform/browser/ServiceInstanceIDDetectorSync.ts
Outdated
Show resolved
Hide resolved
670d528
to
72505da
Compare
* feat(node-sdk): implements `service.instance.id` Implements `service.instance.id` Signed-off-by: maryliag <[email protected]> * implement service instance id by default with env var use an experimental environment variable to set the default value of `service.instance.id` as default * Update CHANGELOG.md Co-authored-by: Marc Pichler <[email protected]> * create separate add experimental for browser and node create a function to add experimental default values (currently only service instance id, but others can be added in the future), with the value being set on the node case, but not on the browser case. Signed-off-by: maryliag <[email protected]> * use resource detector for service instance id use a resource detector for service instance id * remove references to env variables * remove Detector and use DetectorSync remove the Detector and use the DetectorSync instead. Also mark things as experimental. Signed-off-by: maryliag <[email protected]> * Update packages/opentelemetry-resources/src/platform/node/ServiceInstanceIDDetectorSync.ts Co-authored-by: Marc Pichler <[email protected]> * rename ServiceInstanceIDDetector to ServiceInstanceIDDetectorSync * change ID to Id * renaming something temp so git will pick up the name change it was not picking up the case change on previous commit * update to final name using Id --------- Signed-off-by: maryliag <[email protected]> Co-authored-by: Marc Pichler <[email protected]>
…try#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]>
Which problem is this PR solving?
Implements service.instance.id
Short description of the changes
From the Semantic Convention on Service, we have the values of
service.name
as required, asservice.instance.id
,service.version
andservice.namespace
as recommended.We are not able to set the value of version and namespace by ourselves, but following the semantic convention for service.instance.id, the value can be generated using a randomUUID (we have a similar implementation of this in other SDKs, such as the Java one).
This commit adds a value for
service.instance.id
by default, which can still be overwritten by the environment variable or cloud provider.This commit also updates some deprecated strings and add missing
sdk.shutdown
to allsdk.start
on the sdk test file.How Has This Been Tested?
sdk.test
Checklist: