-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 host.id to resource auto-detection #3812
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3812 +/- ##
======================================
Coverage ? 81.5%
======================================
Files ? 170
Lines ? 12765
Branches ? 0
======================================
Hits ? 10415
Misses ? 2131
Partials ? 219
|
4eb70b5
to
a154c62
Compare
@@ -71,6 +71,11 @@ func WithHost() Option { | |||
return WithDetectors(host{}) | |||
} | |||
|
|||
// WithHostID adds host ID information to the configured resource. | |||
func WithHostID() Option { | |||
return WithDetectors(hostIDDetector{}) |
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.
Shouldn't we add hostIDDetector
to WithHost()
? We might consider adding WithHostName
to offer a resource detector that only sets host.name
resource attribute.
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.
Because the rules for detecting HostID are different for containerized vs non-containerized hosts I didn't want to couple the hostIDDetector
to WithHost
, although I had considered it. My thoughts were that someone who wanted to use WithHost
on a cloud provider wouldn't have to worry about detector order when detecting HostID
. However, I could see having WithHost
that detects HostID
and HostName
, and separate options WithHostID
and WithHostName
to collect the attributes individually. Let me know what your preference is.
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.
EDIT: After second thought, I have no strong preference. Maybe we should improve the docs and list all the attributes that given detector (option) should set? This could be addressed in a separate issue as I feel this is a problem not only for this detector/option.
Co-authored-by: Tyler Yahn <[email protected]>
This allows us to run tests for the BSD, Darwin, and Linux readers on all platforms.
Co-authored-by: Tyler Yahn <[email protected]>
I wanted to check in to see if there is anything that anyone would like to see addressed in this PR? |
This PR adds host id detection support for non-containerized hosts. The implementation is based on this spec pr: open-telemetry/opentelemetry-specification#3173.
Fixes #3811
Summary
hostIDReader
interface with platform specific implementations for Darwin, Linux, BSD, Windows and a fallback for unsupported platfoms.host.id
, aka machine id for non-containerized environments. Depending on platform this involves reading files in well known locations, excuting shell commands, or a combination of the two.See also
I realize we will want to see the spec PR merge before getting too serious about this work, but I wanted to get some eyes on the approach and encourage anyone with opinions to provide feedback here and on the spec PR.