-
Notifications
You must be signed in to change notification settings - Fork 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
Configure a custom JmsProcessObservationConvention or JmsPublishObservationConvention #5492
Comments
Thank you for opening the issue. I agree it would be better to allow passing a custom convention when configuring the instrumentation. In the meantime, perhaps you could use a GlobalObservationConvention to achieve what you want until the instrumentation is updated - see this part of the documentation. Would you be interested in submitting a pull request for this enhancement? |
With a GlobalObservationConvention I was able to get it to work, thanks! PR: I have no idea how to make it configurable in context of micrometer. Any hints? |
The way to use the instrumentation now is via |
Initially, I did not provide a way to customize the observation convention directly on I guess you're instrumenting JMS sessions manually and not through a library or framework? In this case, another static method as suggested by @shakuzen would work well. |
We are using Spring Boot, which uses the Spring Framework, which uses Micrometer. You have to understand all three libs... |
Thanks for your feedback @mihca - this is the main feature behind global observation conventions: you don't need to know where things are instrumented and how, you just need to know which convention to use and override globally. Admittedly, the JMS processing observability section of the Spring Framework reference documentation is a bit light as it doesn't mention the relevant convention, unlike other instrumentations. Back to your use case, I believe a global convention is probably the easiest path. We could allow custom conventions here in Micrometer, but we would also need another API in Spring Framework and even maybe something else in Spring Boot. In the end, you would probably provide your custom convention as a bean, which is exactly the same thing as a global one. Here's my proposal:
Let me know what you think @mihca ! |
The closest we have is the section I linked earlier which has sample code and JavaDoc comments in it describing the precedence of conventions and gives an example of a GlobalObservationConvention. |
I expected that it works like org.springframework.http.server.observation.DefaultServerRequestObservationConvention, which is documented in Spring Framework Observability Support#Using custom observation conventions. Just provide the bean and its insrtumented automatically. But that class is defined in Spring Framework and not Micrometer.
Yes, would be nice that there is a hint in the Spring Framework Documentation#JMS message instrumentation to use a global convention. |
Please describe the feature request.
It should be possible to configure a custom JmsProcessObservationConvention. Currently a DefaultJmsProcessObservationConvention ist hardcoded in the MessageConsumerInvocationHandler.
Rationale
I want to write custom information from the JMS header to the observation (trace info).
Additional context
Its possible to define your own JmsProcessObservationConvention, but I found no possibilty to activate/configure it instead of the DefaultJmsProcessObservationConvention.
The text was updated successfully, but these errors were encountered: