Stack trace Enhancement
All Submissions:
- [YES/NO] I have added an explanation of what changes in this merge do and why we should include it? Yes
- [YES/NO] I have updated the documentation accordingly.
- [YES/NO/NA] I have added tests to cover my changes. Yes
- [YES/NO/NA] All new and existing tests passed. Yes
- [YES/NO/NA] My code follows the code style of this project. Yes
- [YES/NO/NA] I ran lint checks locally prior to submission. Yes
What is the issue or story related to the change?
**Issue: **Stack trace is split across multiple line and contains unnecessary information. Impact: Issue is resulting in too many logs. Also impacts DRI's troubleshooting. **Target: **Reduce stack trace by having each exception without line breaks and removing unwanted details from stacktrace.
High level design: PBI: Product Backlog Item 12836: Enhance exception stack traces - Boards (azure.com) Extension of Bug: Stack traces split across multiple lines - Boards (azure.com)
- Changes made to log4j2.xml to define the PatternLayout for the exceptions.
- We filter out packages that would not be necessary for troubleshooting. For example: org.apache,org.springframework,sun.reflect,javax.servlet
- We remove new lines from the Exception and replace with | separator to avoid exception splitting across multiple lines.
- Please find below the difference between a segment of generated exception before and after changes: -
Before:
2022-09-02 12:36:52.315 ERROR DESKTOP-JF1LE60 --- [nio-8086-exec-6] o.o.o.f.a.FileLocationApi correlation-id=15bcefbe-e482-47b0-a07e-5284580f09d1 data-partition-id=mstest3221-dp api-method=GET operation-name={GET [/v2/files/uploadURL]} user-id=51d2f791-795b-4c8d-9657-cd23b1f9f2a7 app-id=:blah something bad happened java.lang.RuntimeException: koopa
at org.opengroup.osdu.file.api.FileLocationApi.getLocationFile(FileLocationApi.java:81) [file-core-0.17.0-SNAPSHOT.jar!/:0.17.0-SNAPSHOT]
at org.opengroup.osdu.file.api.FileLocationApi
FastClassBySpringCGLIB
3bf58739.invoke() [file-core-0.17.0-SNAPSHOT.jar!/:0.17.0-SNAPSHOT] at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) [spring-core-5.3.12.jar!/:5.3.12] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:783) [spring-aop-5.3.12.jar!/:5.3.12] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) [spring-aop-5.3.12.jar!/:5.3.12] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753) [spring-aop-5.3.12.jar!/:5.3.12] at org.springframework.validation.beanvalidation.MethodValidationInterceptor.invoke(MethodValidationInterceptor.java:123) [spring-context-5.3.12.jar!/:5.3.12] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) [spring-aop-5.3.12.jar!/:5.3.12] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753) [spring-aop-5.3.12.jar!/:5.3.12] at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:698) [spring-aop-5.3.12.jar!/:5.3.12] at org.opengroup.osdu.file.api.FileLocationApiEnhancerBySpringCGLIB
ac97402f.getLocationFile() [file-core-0.17.0-SNAPSHOT.jar!/:0.17.0-SNAPSHOT]
After:
2022-09-05 13:43:34.633 INFO DESKTOP-JF1LE60 --- [nio-8086-exec-4] o.o.o.a.l.Slf4JLogger correlation-id=e1c58641-6788-4a03-bcf0-fd3778a8f2f9 data-partition-id=mstest3221-dp api-method=GET operation-name={GET [/v2/files/uploadURL]} user-id=51d2f791-795b-4c8d-9657-cd23b1f9f2a7 app-id=:file.app method: GET | latency: 0 | url: /groups | correlation id: e1c58641-6788-4a03-bcf0-fd3778a8f2f9 {correlation-id=e1c58641-6788-4a03-bcf0-fd3778a8f2f9, data-partition-id=mstest3221-dp}
2022-09-05 13:43:34.638 ERROR DESKTOP-JF1LE60 --- [nio-8086-exec-4] o.o.o.a.l.Slf4JLogger correlation-id=e1c58641-6788-4a03-bcf0-fd3778a8f2f9 data-partition-id=mstest3221-dp api-method=GET operation-name={GET [/v2/files/uploadURL]} user-id=51d2f791-795b-4c8d-9657-cd23b1f9f2a7 app-id=:file.app null {correlation-id=e1c58641-6788-4a03-bcf0-fd3778a8f2f9, data-partition-id=mstest3221-dp} org.opengroup.osdu.core.common.model.http.AppException: Internal communication failure| at org.opengroup.osdu.core.common.http.HttpClientHandler.sendRequest(HttpClientHandler.java:107) ~[os-core-common-0.16.0.jar!/:?]**| at **org.opengroup.osdu.core.common.http.UrlFetchServiceImpl.sendRequest(UrlFetchServiceImpl.java:64) ~[os-core-common-0.16.0.jar!/:?]| at org.opengroup.osdu.core.common.http.UrlFetchServiceImpl.sendRequest(UrlFetchServiceImpl.java:44) ~[os-core-common-0.16.0.jar!/:?]| at org.opengroup.osdu.core.common.http.UrlFetchServiceImplFastClassBySpringCGLIB
7ffb74e.invoke() ~[os-core-common-0.16.0.jar!/:?]| ... suppressed 9 lines| at org.opengroup.osdu.core.common.http.UrlFetchServiceImplEnhancerBySpringCGLIB
e035e205.sendRequest() ~[os-core-common-0.16.0.jar!/:?]| at org.opengroup.osdu.azure.httpconfig.HttpClientAzure.decoratedSend(HttpClientAzure.java:63) ~[core-lib-azure-0.17.0-SNAPSHOT.jar!/:?]| at org.opengroup.osdu.azure.httpconfig.HttpClientAzure.send(HttpClientAzure.java:91) ~[core-lib-azure-0.17.0-SNAPSHOT.jar!/:?]| at org.opengroup.osdu.core.common.entitlements.EntitlementsService.getGroups(EntitlementsService.java:77) ~[os-core-common-0.16.0.jar!/:?]| at org.opengroup.osdu.core.common.entitlements.AuthorizationServiceImpl.authorizeAny(AuthorizationServiceImpl.java:52) ~[os-core-common-0.16.0.jar!/:?]| at org.opengroup.osdu.file.middleware.AuthorizationFilter.hasPermission(AuthorizationFilter.java:50) ~[file-core-0.17.0-SNAPSHOT.jar!/:0.17.0-SNAPSHOT]| at org.opengroup.osdu.file.middleware.AuthorizationFilterFastClassBySpringCGLIB
5aded031.invoke() ~[file-core-0.17.0-SNAPSHOT.jar!/:0.17.0-SNAPSHOT]| ... suppressed 9 lines| at org.opengroup.osdu.file.middleware.AuthorizationFilterEnhancerBySpringCGLIB
919911a8.hasPermission() ~[file-core-0.17.0-SNAPSHOT.jar!/:0.17.0-SNAPSHOT]| ... suppressed 3 lines| at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_332]| ... suppressed 18 lines| at org.opengroup.osdu.file.api.FileLocationApiEnhancerBySpringCGLIB
64470961.getLocationFile() ~[file-core-0.17.0-SNAPSHOT.jar!/:0.17.0-SNAPSHOT]| at org.opengroup.osdu.file.api.FileLocationApiFastClassBySpringCGLIB
3bf58739.invoke() ~[file-core-0.17.0-SNAPSHOT.jar!/:0.17.0-SNAPSHOT]| ... suppressed 9 lines
Test coverage:
Tested in IntelliJ Console and Kusto
Does this introduce a breaking change?
- No
Pending items
No
Reviewer request
- Please provide an ETA when you plan to review this MR. Write a comment to decline or provide an ETA.
- Block the MR if you feel there is less testing or no details in the MR
- Please cover the following aspects in the MR -- Coding design: <Reviewer1> -- Backward Compatibility: <Reviewer2> -- Feature Logic: <Logic design> -- <Any other context mention here> OR -- <Component 1>: <Reviewer1> -- <CosmosDB>: <Reviewer2> -- <ServiceBus> <Reviewer3> -- <Mention any other component and owner>