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

Make MongoHandlerContext public to leverage contextual information to customize Observations #4622

Closed
kevinat opened this issue Jan 23, 2024 · 3 comments
Labels
type: enhancement A general enhancement

Comments

@kevinat
Copy link

kevinat commented Jan 23, 2024

Observation tracing remote service name is hardcoded as "mongo". For microservices, we may need remote service name in pattern mongo-dbname.

MongoObservationCommandListener.java

line 108:
--- observationContext.setRemoteServiceName("mongo");
+++ observationContext.setRemoteServiceName("mongo-%s".formatted(databaseName));

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 23, 2024
@mp911de
Copy link
Member

mp911de commented Jan 23, 2024

We could introduce template method hooks to customize the context and the observation so you can customize both, the context and the Observation. Paging @marcingrzejszczak and @jonatan-ivanov for guidance.

@marcingrzejszczak
Copy link
Contributor

One can already do that via the ObservationFilter mechanism

@mp911de
Copy link
Member

mp911de commented Jan 23, 2024

Thanks a lot. I'm going to make our MongoHandlerContext public to provide access to underlying details.

@mp911de mp911de changed the title Observation tracing remote service name is hard coded to "mongo" in MongoObservationCommandListener Make MongoHandlerContext public to leverage contextual information to customize Observations Jan 23, 2024
mp911de added a commit that referenced this issue Jan 23, 2024
mp911de added a commit that referenced this issue Jan 23, 2024
@mp911de mp911de added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Jan 23, 2024
@mp911de mp911de added this to the 4.1.9 (2023.0.9) milestone Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants