-
Notifications
You must be signed in to change notification settings - Fork 576
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
Add a host resource detector #5399
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5399 +/- ##
=======================================
+ Coverage 62.3% 62.5% +0.1%
=======================================
Files 189 191 +2
Lines 11575 11640 +65
=======================================
+ Hits 7221 7282 +61
- Misses 4145 4147 +2
- Partials 209 211 +2
|
This seems duplicative of |
Taking a look at the host semantic conventions, it looks like they are all experimental (even I think in the long term we want to make the I think this PR is the correct approach. I'll plan to review. |
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.
- Missing support for BSD: https://github.com/open-telemetry/opentelemetry-go/blob/main/sdk/resource/host_id_bsd.go
- Missing fallback when the host system is not supported for the host ID: https://github.com/open-telemetry/opentelemetry-go/blob/main/sdk/resource/host_id_unsupported.go
detectors/host/host_test.go
Outdated
|
||
assert.True(t, err == nil) | ||
|
||
hostName, _ := os.Hostname() |
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.
This error should not be ignored. The test should be failed.
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.
I adapted the tests so that the host.name
is only added to the list of expected attributes when os.Hostname()
doesn't return an error.
This covers cases where os.Hostname()
returns an error, but a host.id
might still be obtained.
I'm happy to both make the tests and detector logic fail when os.Hostname()
fails, if folks think that's better.
Co-authored-by: Tyler Yahn <[email protected]>
Co-authored-by: Tyler Yahn <[email protected]>
Co-authored-by: Tyler Yahn <[email protected]>
Co-authored-by: Tyler Yahn <[email protected]>
Co-authored-by: Tyler Yahn <[email protected]>
Co-authored-by: Tyler Yahn <[email protected]>
Co-authored-by: Tyler Yahn <[email protected]>
Co-authored-by: Tyler Yahn <[email protected]>
Co-authored-by: Tyler Yahn <[email protected]>
Co-authored-by: Tyler Yahn <[email protected]>
Co-authored-by: Tyler Yahn <[email protected]>
Thanks @MrAlias, this should be ready for another review. |
@MrAlias Should we use feature environment variables instead of a new detector module? |
That's a good idea. |
I've added this to the SIG meeting agenda to discuss. |
@pyohannes can this be closed? We plan to move this into this (behind the experimental envar), right? |
Fixes #5398
This PR adds a resource detector for physical hosts which sets values according to semantic conventions for host resources:
host.arch
host.id
host.name
host.ip
host.mac