You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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 ofsetCommentSupplier(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.The text was updated successfully, but these errors were encountered: