-
Notifications
You must be signed in to change notification settings - Fork 41
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
log more info when fvh failed #618
log more info when fvh failed #618
Conversation
@@ -142,7 +142,11 @@ public String[] getHighlights( | |||
DEFAULT_ENCODER); | |||
} catch (RuntimeException runtimeException) { | |||
logger.warn( | |||
"FVH failed creating fragments, and the exception is: ", runtimeException.getMessage()); | |||
String.format( |
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.
No need for String.format since you're only using logger, and you can also log the complete exception. So something like:
logger.warn(
"FVH failed creating fragments for the luceneDocId: {}, highlight query: {}, exception: {}",
leafDocId + hitLeaf.docBase,
settings.getHighlightQuery(),
runtimeException.getMessage(),
runtimeException);
leafDocId + hitLeaf.docBase, | ||
settings.getHighlightQuery(), | ||
runtimeException.getMessage())); | ||
runtimeException.getMessage()); |
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.
Can you please add the exception as well like I had added in my previous comment?
Also can you please test it locally and verify that the log works as expected now? You can add the logged message in the PR description.
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.
It's hard to reproduce the error unless we have a buggy analyzer. I created a dummy exception which will serve the test purpose.
"FVH failed creating fragments for the luceneDocId: {}, highlight query: {}, exception: {}", | ||
leafDocId + hitLeaf.docBase, | ||
settings.getHighlightQuery(), | ||
runtimeException); |
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.
@waziqi89 if you log like this:
logger.warn(
"FVH failed creating fragments for the luceneDocId: {}, highlight query: {}, exception: {}",
leafDocId + hitLeaf.docBase,
settings.getHighlightQuery(),
runtimeException.getMessage(),
runtimeException);
i.e. have the exception at the end without having a placeholder for it in the string message, it will log the entire stacktrace in addition to the message. Can you please do that?
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.
Let me know if you don't want to log the stacktrace.
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.
In the latest commit, the exception
is logged instead of message
. Guess the test result is misleading because the dummy exception has not stacktrace
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.
Since you have exception: {}
it'll just log the exception message and not the stacktrace. Example:
try {
throw new RuntimeException("Test");
} catch (Exception e) {
logger.warn("Error: {}, Exception: {}", "Test error", e);
}
The output is:
[WARN ] 2024-01-22 11:15:33.268 [Test worker] LoggerTest - Error: Test error, Exception: java.lang.RuntimeException: Test
vs
try {
throw new RuntimeException("Test");
} catch (Exception e) {
logger.warn("Error: {}, Exception: {}", "Test error", e.getMessage(), e);
}
Output:
[WARN ] 2024-01-22 11:17:36.810 [Test worker] LoggerTest - Error: Test error, Exception: Test
java.lang.RuntimeException: Test
at com.yelp.nrtsearch.LoggerTest.logExceptionTest(LoggerTest.java:20) ~[test/:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59) ~[junit-4.13.2.jar:4.13.2]
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) ~[junit-4.13.2.jar:4.13.2]
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56) ~[junit-4.13.2.jar:4.13.2]
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) ~[junit-4.13.2.jar:4.13.2]
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) ~[junit-4.13.2.jar:4.13.2]
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100) ~[junit-4.13.2.jar:4.13.2]
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366) ~[junit-4.13.2.jar:4.13.2]
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103) ~[junit-4.13.2.jar:4.13.2]
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63) ~[junit-4.13.2.jar:4.13.2]
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) ~[junit-4.13.2.jar:4.13.2]
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) ~[junit-4.13.2.jar:4.13.2]
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) ~[junit-4.13.2.jar:4.13.2]
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) ~[junit-4.13.2.jar:4.13.2]
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) ~[junit-4.13.2.jar:4.13.2]
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) ~[junit-4.13.2.jar:4.13.2]
at org.junit.runners.ParentRunner.run(ParentRunner.java:413) ~[junit-4.13.2.jar:4.13.2]
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:110) ~[?:?]
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58) ~[?:?]
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:38) ~[?:?]
at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:62) ~[?:?]
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36) ~[?:?]
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) ~[?:?]
at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33) ~[?:?]
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94) ~[?:?]
at jdk.proxy2.$Proxy5.processTestClass(Unknown Source) ~[?:?]
at org.gradle.api.internal.tasks.testing.worker.TestWorker$2.run(TestWorker.java:176) ~[?:?]
at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129) ~[?:?]
at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100) ~[?:?]
at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60) ~[?:?]
at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56) ~[?:?]
at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:133) ~[?:?]
at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:71) ~[?:?]
at worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69) ~[gradle-worker.jar:?]
at worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74) ~[gradle-worker.jar:?]
As you can see there is no stacktrace in the first case.
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.
Can you please also update the description with the new log that includes the stacktrace?
* Fix node resolver for empty/missing files (#587) * Autogenerated JaCoCo coverage badge * Bump to v0.26.1 (#588) * Autogenerated JaCoCo coverage badge * parallel explain for nrtsearch (#589) * parallel explain for nrtsearch * fix nit * add explain for multi segment parallel * refactor isExplain in different contexts * make NRTSearch empty boolean query result constant score 1 (#592) * make NRTSearch empty boolean query result constant score 1 * fix tests * soft exception for fvh failures (#593) * Support unit in SortType (#590) create sort context and support unit in lat_lon distance sort * Autogenerated JaCoCo coverage badge * Upgrade dependencies for snyk check (#596) * Fix example-plugin test (#598) * Add page fault metrics (#599) * Add additional merge metrics (#607) * Add live setting for verbose index metrics (#608) * Add live setting for verbose index metrics * Address review comment * Autogenerated JaCoCo coverage badge * Bump to v0.29.0 (#609) * Add live index settings override from config file (#610) * Autogenerated JaCoCo coverage badge * Add ability to update local index live settings (#611) * Add deadline cancellation for indexing (#612) * Add geo polygon query type (#613) * Add geo polygon query type * Detect closed polygons, update docs * Autogenerated JaCoCo coverage badge * Bump to v0.30.0 (#615) * Testing readthedocs web hooks (#616) * Add a bare minimum readthedocs config file (#617) * log more info when fvh failed (#618) log more info when fvh failed * Avoid calling query.toString() (#619) * add sts for web identity auth (#620) add sts for web identity auth * Add search diagnostics to deadline exceeded exceptions (#621) * Add search diagnostics to deadline exceeded exceptions --------- Co-authored-by: swekannan <shwethu.kannan93@gmail.com> * Fixes and spotless apply * Updated grpc-gateway --------- Co-authored-by: Andrew Prudhomme <asp@yelp.com> Co-authored-by: github_actions <runner@fv-az248-700.3twvhzoricxu3figbgb44chhog.cx.internal.cloudapp.net> Co-authored-by: github_actions <runner@fv-az887-622.kyhrjabtieueri5x0cgfkhfc1a.bx.internal.cloudapp.net> Co-authored-by: Tao Yu <taoyu@yelp.com> Co-authored-by: waziqi89 <89210409+waziqi89@users.noreply.github.com> Co-authored-by: github_actions <runner@fv-az248-372.3twvhzoricxu3figbgb44chhog.cx.internal.cloudapp.net> Co-authored-by: github_actions <runner@fv-az574-753.esnmgxn14wlejbqjnvhsbsbtxa.dx.internal.cloudapp.net> Co-authored-by: github_actions <runner@fv-az1272-720.grsihaubamwerhiryzjrxtypna.phxx.internal.cloudapp.net> Co-authored-by: github_actions <runner@fv-az736-601.alpbqrzxv30uzkvtn2qktnuusd.cx.internal.cloudapp.net> Co-authored-by: Mohammad Mohtasham <mohm@yelp.com> Co-authored-by: swekannan <62616258+swekannan@users.noreply.github.com> Co-authored-by: swekannan <shwethu.kannan93@gmail.com>
The fvh exception is not logged properly. Fix the bug, and add more context on the message.
from
to
Note that the query would be the "LUCENE" query, but still informative for engineers to debug.