-
Notifications
You must be signed in to change notification settings - Fork 40.6k
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
Ordering of ObservationHandlers #39432
Comments
Can you please describe your use case in some more detail? I'm not sure how a globally configured default service name would be useful as it needs to be service-specific. Much of the observation support already sets such a service name. For example, Spring Data MongoDB's |
What brought me here was Kafka, where the remote service name includes the cluster ID. While I do agree it's a good idea to include it somewhere, I don't think the service name is exactly the best place; I'd rather put into low-cardinality tags. However, I wouldn't focus on renaming too much, as ordering may come in handy in many other case. As for the global service name, my handler filters out types of context that it's not interested in, specifically that aren't instances of |
Modifying these in a handler might not be a good idea (even if you can do it, the intention of the concept of a handler is different). As far as I understand, you should do this from an I think there might be solutions other than using an
I think I would not focus on the |
Many libraries don't conform to the (sometimes experimental) OpenTelemetry conventions, and This is to say that it's not just Kafka where I wish it behaved differently—it just so happens that Kafka is the only one where I can do it myself without involving any third parties. Once I'm done implementing tracing as possible right now, I'll to move on, and there will barely be any changes to my code later on. Ideally, all libraries should "just" follow the conventions. Right now, to catch up with the recommendations, this will require opening lots of issues, pointing out all the inconsistencies, and most likely writing the code and "accompanying" it until it's merged. Given the number of repositories, I alone won't have that much time. 😔 As for your suggestions:
Now I see there is a tool more suitable for what I need, but why not give a way in general to order handlers, if I understand your position right? |
I think many don't use ("just" follow) the OTel semantic conventions because OTel semantic conventions are not stable yet. RestClient/RestTemplate and Feign aren't using it either because their had conventions before OTel and they are backward compatible with those (and because OTel semantic conventions are not stable yet). Btw the Observation API lets you define the convention using
You should be able to modify every detail by using an
I'm not sure I get this,
This is on the Boot team to decide, but I'm not sure we should introduce extra complexity if it is not necessary anywhere. |
This is the Boot team's opinion too. Until there's a compelling use case for ordering handlers that cannot be achieved by some other means, it will be very hard to justify adding support for it. The cost both in terms of initial development and ongoing maintenance would be better spent elsewhere. We can reconsider in the future but I'm going to close this one for now. Thanks anyway for the suggestion. |
I would like to override the default remote service name, for which there isn't a property. As far as I can tell, the least code invasive way of doing this is with handlers. However, in the current code, the remote service name is set when an observation is started, in
PropagatingSenderTracingObservationHandler#createSenderSpan
. So if I want to override it, I have to do it before the tracer picks it up.The main ways out of this situation I see are:
ObservationRegistry
bean of my own.ObservationHandler
butTracingObservationHandler
so that it falls into the category of tracers. The downside is that I will now have to delegate calls to the actualTracingObservationHandler
that I'm taking the place of.PropagatingSenderTracingObservationHandler
and delegate all calls to the necessary handlers first, then do tracing. The default bean has@ConditionalOnMissingBean
, so there shouldn't be problems registering it.Obviously, I want to stick with the default configurer and change as little code as possible. However, I cannot declare my own categories,
ObservationHandler
s don't respectOrdered#getOrder
or an equivalent thereof, and the categorised handlers are registered first.I suggest (1) exporting
ObservationHandlerGrouping
as part of the public API and (2) introducing a proper mechanism for ordering handlers. WDYT?The text was updated successfully, but these errors were encountered: