opentelemetry-go-contrib
opentelemetry-go-contrib copied to clipboard
Add a host resource detector
Fixes #5398
This PR adds a resource detector for physical hosts which sets values according to semantic conventions for host resources:
host.archhost.idhost.namehost.iphost.mac
Codecov Report
Attention: Patch coverage is 93.84615% with 4 lines in your changes are missing coverage. Please review.
Project coverage is 62.5%. Comparing base (
30ed923) to head (f585990).
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
| Files | Coverage Δ | |
|---|---|---|
| detectors/host/host.go | 96.6% <96.6%> (ø) |
|
| detectors/host/host_id_linux.go | 60.0% <60.0%> (ø) |
This seems duplicative of WithHost. Why not update that option?
This seems duplicative of WithHost. Why not update that option?
Indeed it is duplicative.
@MrAlias Do you think it a feasible option to populate host.arch via WithHost, and add additional WithHostIP and WithHostMAC to opt into host.ip and host.mac (all implemented in the SDK)?
Taking a look at the host semantic conventions, it looks like they are all experimental (even host.name :grimacing:).
I think in the long term we want to make the WithHost option include all the recommended/required stable semantic conventions for a host. But in the interim, having a detector here is probably the correct approach.
I think this PR is the correct approach. I'll plan to review.
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
Thanks @MrAlias, this should be ready for another review.
But in the interim, having a detector here is probably the correct approach.
@MrAlias Should we use feature environment variables instead of a new detector module?
But in the interim, having a detector here is probably the correct approach.
@MrAlias Should we use feature environment variables instead of a new detector module?
That's a good idea.
But in the interim, having a detector here is probably the correct approach.
@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?