-
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
Customize observation spans #4321
Comments
spring-projects-issues
added
the
status: waiting-for-triage
An issue we've not yet triaged
label
Mar 8, 2023
@gregturn @christophstrobl Hey, are there any updates? Am I missing something here? |
francoiskha
added a commit
to francoiskha/spring-data-mongodb
that referenced
this issue
Jan 10, 2024
francoiskha
added a commit
to francoiskha/spring-data-mongodb
that referenced
this issue
Jan 10, 2024
francoiskha
added a commit
to francoiskha/spring-data-mongodb
that referenced
this issue
Jan 10, 2024
francoiskha
added a commit
to francoiskha/spring-data-mongodb
that referenced
this issue
Jan 10, 2024
Closes spring-projects#4321 add author
4 tasks
christophstrobl
added
type: enhancement
A general enhancement
and removed
status: waiting-for-triage
An issue we've not yet triaged
labels
Feb 8, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Event though the observationConvention already includes some good tags in the spans, I need to add some additional custom tags to it. Unfortunately, I did not find an easy way to customize the observation spans, because the usage of
MongoHandlerObservationConvention
is hardcoded:https://github.com/spring-projects/spring-data-mongodb/blob/main/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/observability/MongoObservationCommandListener.java#L110
So the only way would be to implement my own
MongoHandlerObservationConvention
(as we are not able to override theDefaultMongoHandlerObservationConvention
) and in addition to overrideMongoObservationCommandListener
and rewrite the wholecommandStarted
method to use my custom observationConvention. In addition, we also need to implement our ownSenderContext
as theMongoHandlerContext
is not public. Then I can use it in the bean-definition ofMongoClientSettingsBuilderCustomizer
by settingBut that's actually a lot of effort just to be able to add a custom tag to the spans.
Maybe it would be easier to allow us overriding the
DefaultMongoHandlerObservationConvention
and use a bean-definition ofMongoHandlerObservationConvention
or provide a setter inMongoObservationCommandListener
to set the actual usedMongoHandlerObservationConvention
.The text was updated successfully, but these errors were encountered: