Skip to content
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

detect: refactor the default resource detector for detect #4512

Merged
merged 1 commit into from Jan 2, 2024

Conversation

jsternberg
Copy link
Collaborator

@jsternberg jsternberg commented Dec 28, 2023

This refactors the resource detector to ensure the detected resource is
initialized before use. It also removes the duplicate logic for setting
the service name through the environment variable.

This refactors the resource detector to ensure the detected resource is
initialized before use. It also removes the duplicate logic for setting
the service name through the environment variable.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
@@ -29,8 +30,6 @@ type detector struct {
var ServiceName string
var Recorder *TraceRecorder

var Resource *resource.Resource
Copy link
Member

Choose a reason for hiding this comment

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

Looks like this is reverting #4496, which will likely break moby, or is there another approach that moby should be taking after this patch?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The OverrideResource method should be used instead to manually set the resource during initialization.

My hope is that a future refactor will remove the need for this function. I'm working on a separate refactor that removes some of the global state so the tracers and metrics exporters can be initialized with a user-provided resource, but that's not ready yet.

Copy link
Member

Choose a reason for hiding this comment

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

Ah! Gotcha. Missed that one (blame phones and tiny screens) 😅

Copy link
Contributor

@milas milas left a comment

Choose a reason for hiding this comment

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

LGTM 👍🏻

@tonistiigi tonistiigi merged commit 8849789 into moby:master Jan 2, 2024
60 checks passed
@jsternberg jsternberg deleted the detect-resource branch January 2, 2024 23:09
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.

None yet

4 participants