Skip to content

Conversation

@codeboten
Copy link
Contributor

I was looking at implementing resource detection in otelconf and was finding that all the detectors were implemented in a similar way except for the service detector. Added the resource options in this PR for feedback. Will add tests if the go approvers/maintainers support this approach.

I was looking at implementing resource detection in otelconf and was finding that all the detectors were implemented in a similar way except for the service detector. Added the resource options in this PR for feedback. Will add tests if the go approvers/maintainers support this approach.

Signed-off-by: alex boten <223565+codeboten@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Nov 28, 2025

Codecov Report

❌ Patch coverage is 0% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.1%. Comparing base (a72103c) to head (841fd62).

Files with missing lines Patch % Lines
sdk/resource/config.go 0.0% 9 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #7642     +/-   ##
=======================================
- Coverage   86.1%   86.1%   -0.1%     
=======================================
  Files        298     298             
  Lines      21694   21703      +9     
=======================================
  Hits       18692   18692             
- Misses      2626    2635      +9     
  Partials     376     376             
Files with missing lines Coverage Δ
sdk/resource/config.go 87.6% <0.0%> (-12.4%) ⬇️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dmathieu
Copy link
Member

dmathieu commented Dec 1, 2025

This approach looks good to me. Adding tests would be awesome (there are no tests for the rest of the config unfortunately).


// WithServiceID adds an attribute with the uid of the service to the configured Resource.
func WithServiceID() Option {
return WithDetectors(defaultServiceInstanceIDDetector{})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We currently have this behind an experimental feature gate in the SDK:

if x.Resource.Enabled() {
defaultDetectors = append([]Detector{defaultServiceInstanceIDDetector{}}, defaultDetectors...)

It looks like service.instance.id is still marked as being in development, so i'm not sure we can add a public API for the detector yet: https://github.com/open-telemetry/semantic-conventions/blob/main/docs/registry/attributes/service.md#service-attributes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a public API for WithContainerID and that is still in development https://github.com/open-telemetry/semantic-conventions/blob/main/docs/registry/attributes/container.md, should the api be removed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not have added it. I don't think we can remove it now, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants