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

Add support for "comment suppliers" #4581

Open
onmishkin opened this issue Dec 4, 2023 · 0 comments
Open

Add support for "comment suppliers" #4581

onmishkin opened this issue Dec 4, 2023 · 0 comments
Labels
type: enhancement A general enhancement

Comments

@onmishkin
Copy link

Although Spring Data MongoDB has support for MongoDB comments (e.g., Query.comment(String) and @Meta(comment = "...")) I'd like to see that support extended to support a use case I'd like to implement:

My application is a web server that uses "request IDs" that are generated by nginx on all incoming HTTP requests and then carried through all of my server's logic and across threads and in any remote requests it itself makes. Request IDs appear as part of all log messages. Request IDs are stored in thread-local storage (not passed parametrically). I want these request IDs to be passed to MongoDB as "comments" so I can associate any DB issues that MongoDB logs to also contain my request IDs. This will let me figure out what incoming request (and other associated activity) led to the DB issue.

Spring Data MongoDB's support for comments isn't general enough to support the above. One idea I have is to extend MongoTemplate to have some sort of setCommentSupplier(Supplier<String>) method. The supplied supplier would be called whenever Spring Data MongoDB is about to send a request to MongoDB. I'm sure there are other (and maybe better) ways to extend Spring Data MongoDB to support my use case too.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 4, 2023
@christophstrobl christophstrobl added the type: enhancement A general enhancement label Dec 7, 2023
@mp911de mp911de removed the status: waiting-for-triage An issue we've not yet triaged label Jan 22, 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