-
Notifications
You must be signed in to change notification settings - Fork 242
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 logging of query IDs via QueryLogIterator class #2451
base: integration
Are you sure you want to change the base?
Conversation
Added the query option tserver.logging.active to enable logging of query IDs to the TServer logs. Created the class QueryLogIterator to handle this. Logs the start and end of each method called. Fixes #2305
* Fix CountQueryTest issues * Remove unecessary changes * Code formatting
Add TserverLogging test to verify that queryLogIterator is created and added to the iterator stack when desired. Additionally, move tserver.logging.active property to QueryParameters, and ensure that if specified, the query parameter will override the configuration settings. Additionally, make it possible to set the tserver active logging flag from a ShardQueryLogic configuration setting in the QueryLogicFactory.xml file.
Added the query option tserver.logging.active to enable logging of query IDs to the TServer logs. Created the class QueryLogIterator to handle this. Logs the start and end of each method called. Fixes #2305
warehouse/query-core/src/main/java/datawave/query/iterator/QueryLogIterator.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How to update thread name and restore old name
Also how to add and remove a value to the MapedDiagnosticContext (MDC)
String oldName = Thread.currentThread().getName();
Thread.currentThread().setName(oldName + " -> " + queryId);
MDC.put("queryId", queryId);
try {
// call corresponding method of the source
} finally {
Thread.currentThread().setName(oldName);
MDC.remove("queryId");
}
Keep the start/stop logging in seek and next, but it's overkill in the others
Add the code to change/restore thread name and add/remove MDC in all methods that are overridden from the base class and which call that method on source
Create QueryLogIterator class that logs a query's ID to the TServer logs
Resolves #2305
Updated the PR to merge code from NSA/log-iterator to NSA/origin instead of from SethSmucker/log-iterator.