[JAVA-1322] Log command line friendly queries and milliseconds Created: 30/Jul/14  Updated: 08/Dec/17  Resolved: 08/Dec/17

Status: Closed
Project: Java Driver
Component/s: Monitoring
Affects Version/s: 2.12.2
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Seshu Pasam Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: logging
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates JAVA-2697 Include elapsed time and request id w... Closed
duplicates JAVA-2698 Include more of the command document ... Closed
Backwards Compatibility: Fully Compatible

 Description   

We use com.mongodo.TRACE occasionally to see the queries.

Would like couple of improvements:
a.) Log the output that can be copied directly to mongo command line
b.) Log how long it took to run the query in milliseconds



 Comments   
Comment by Jeffrey Yemin [ 08/Dec/17 ]

I recently opened two very similar issues, so closing this one as a duplicate as I'd like to track this as two separate feature requests.

Comment by Seshu Pasam [ 30/Jul/14 ]

Ross, thanks for your response. Yes, I am aware of and use mongo profiling. This is more for figuring out client side network latency issues etc, which cannot be see in profiling data. Since the driver is already logging the queries, it should be trivial to add this functionality.

Comment by Ross Lawley [ 30/Jul/14 ]

Hi spasam,

Did you know that mongodb has a profiler that will allow you to record this information? http://docs.mongodb.org/manual/tutorial/manage-the-database-profiler/

The profiler will record your queries in the manner required and the time taken for them to run. The profiler is configurable, you can set a time threshold for what queries get recorded - eg only record slow queries taking longer than 100ms. Profiling will have a minor impact on performance but it can be a great tool for helping tune your queries and indexes.

The Java driver allows you to add a comment on a DBCursor that can be used to help trace queries in the profiler back to Java code should you need to.

Does that meet your needs?

Regards,

Ross

Generated at Thu Feb 08 08:54:19 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.