Skip to content

Use ObservationThreadLocalAccessor.KEY where possible #29439

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

Closed
wants to merge 1 commit into from

Conversation

izeye
Copy link
Contributor

@izeye izeye commented Nov 6, 2022

This PR changes to use ObservationThreadLocalAccessor.KEY where possible.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Nov 6, 2022
@bclozel
Copy link
Member

bclozel commented Nov 6, 2022

@marcingrzejszczak Can we safely use io.micrometer.observation.contextpropagation.ObservationThreadLocalAccessor from "micrometer-observation"? Your comment in this class seems to avoid a dependency on purpose.

Or is the key supposed to be maintained in "context-propagation"?

@bclozel bclozel self-assigned this Nov 6, 2022
@bclozel bclozel added in: web Issues in web modules (web, webmvc, webflux, websocket) type: task A general task theme: observability An issue related to observability and tracing labels Nov 6, 2022
@marcingrzejszczak
Copy link
Contributor

Context Propagation is typically an optional dependency. If we make it a compile time dependency then we can use the ObservationThreadLocalAccessor safely. Otherwise we might reference a class that implements an interface that is not on the classpath

@izeye
Copy link
Contributor Author

izeye commented Nov 7, 2022

I'm not sure if I fully understand the current arrangement as the previous code comment was saying micrometer-core, and @marcingrzejszczak seems to be saying context-propagation, but actually the constant (ObservationThreadLocalAccessor.KEY) is in micrometer-observation: https://github.com/micrometer-metrics/micrometer/blob/main/micrometer-observation/src/main/java/io/micrometer/observation/contextpropagation/ObservationThreadLocalAccessor.java#L37

@marcingrzejszczak
Copy link
Contributor

I made a mistake with the code comment 🤦

@bclozel bclozel added this to the 6.0.0-RC4 milestone Nov 7, 2022
@bclozel bclozel removed the status: waiting-for-triage An issue we've not yet triaged or decided on label Nov 7, 2022
@bclozel bclozel closed this in 710cf1f Nov 7, 2022
@izeye izeye deleted the key branch November 7, 2022 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) theme: observability An issue related to observability and tracing type: task A general task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants