Add MDCScopeManager for correlating logs with trace context #718
Conversation
Signed-off-by: avim <avi.maslati@forescout.com>
Signed-off-by: avim <avi.maslati@forescout.com>
Signed-off-by: avim <avi.maslati@forescout.com>
Codecov Report
@@ Coverage Diff @@
## master #718 +/- ##
============================================
- Coverage 89.78% 88.76% -1.03%
- Complexity 590 596 +6
============================================
Files 70 73 +3
Lines 2164 2242 +78
Branches 284 289 +5
============================================
+ Hits 1943 1990 +47
- Misses 132 159 +27
- Partials 89 93 +4
Continue to review full report at Codecov.
|
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.
I thing it's a reasonable addition.
jaeger-core/src/main/java/io/jaegertracing/internal/MDcScope.java
Outdated
Show resolved
Hide resolved
jaeger-core/src/main/java/io/jaegertracing/internal/MDcScope.java
Outdated
Show resolved
Hide resolved
jaeger-core/src/main/java/io/jaegertracing/internal/MDcScope.java
Outdated
Show resolved
Hide resolved
jaeger-core/src/main/java/io/jaegertracing/internal/MDcScope.java
Outdated
Show resolved
Hide resolved
jaeger-core/src/main/java/io/jaegertracing/internal/MDcScopeManager.java
Outdated
Show resolved
Hide resolved
jaeger-core/src/main/java/io/jaegertracing/internal/MDcScopeManager.java
Outdated
Show resolved
Hide resolved
jaeger-core/src/main/java/io/jaegertracing/internal/JaegerTracer.java
Outdated
Show resolved
Hide resolved
Signed-off-by: avim <avi.maslati@forescout.com>
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.
Could you add a test with two spans created? The second span would be a child of the first one. Then after the second span is closed assert that MDC contains context from the parent.
jaeger-core/src/test/java/io/jaegertracing/internal/MDCScopeManagerTest.java
Outdated
Show resolved
Hide resolved
jaeger-core/src/test/java/io/jaegertracing/internal/MDCScopeManagerTest.java
Outdated
Show resolved
Hide resolved
jaeger-core/src/test/java/io/jaegertracing/internal/MDCScopeManagerTest.java
Show resolved
Hide resolved
jaeger-core/src/test/java/io/jaegertracing/internal/MDCScopeManagerTest.java
Outdated
Show resolved
Hide resolved
jaeger-core/src/test/java/io/jaegertracing/internal/MDCScopeManagerTest.java
Outdated
Show resolved
Hide resolved
jaeger-core/src/test/java/io/jaegertracing/internal/MDCScopeManagerTest.java
Outdated
Show resolved
Hide resolved
Signed-off-by: avim <avi.maslati@forescout.com>
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.
small nits, otherwise LGTM
jaeger-core/src/test/java/io/jaegertracing/internal/MDCScopeManagerTest.java
Show resolved
Hide resolved
jaeger-core/src/test/java/io/jaegertracing/internal/MDCScopeManagerTest.java
Outdated
Show resolved
Hide resolved
Signed-off-by: avim <avi.maslati@forescout.com>
Signed-off-by: avim <avi.maslati@forescout.com>
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.
lgtm
jaeger-core/src/main/java/io/jaegertracing/internal/MDCScopeManager.java
Outdated
Show resolved
Hide resolved
jaeger-core/src/test/java/io/jaegertracing/internal/MDCScopeManagerTest.java
Show resolved
Hide resolved
jaeger-core/src/test/java/io/jaegertracing/internal/MDCScopeManagerTest.java
Outdated
Show resolved
Hide resolved
Signed-off-by: avim <avi.maslati@forescout.com>
@pavolloffay do we have a way to disable style check for capital letters?
|
I don't know |
Signed-off-by: avim <avi.maslati@forescout.com>
Signed-off-by: avim <avi.maslati@forescout.com>
@yurishkuro changed the style check config to allow 4 consecutive letters, the build fails in codecov check now |
config/checkstyle/checkstyle.xml
Outdated
@@ -162,7 +162,7 @@ | |||
</module> | |||
<module name="AbbreviationAsWordInName"> | |||
<property name="ignoreFinal" value="false"/> | |||
<property name="allowedAbbreviationLength" value="1"/> | |||
<property name="allowedAbbreviationLength" value="3"/> |
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.
I was thinking of whether we can disable the rule specifically for the two MDC classes, not globally for the project, do you know if it's possible?
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.
@yurishkuro , Yes I added these classes to the suppressions.xml file
the build still fails in codecov I don't know why
escape only MDC classes Signed-off-by: avim <avi.maslati@forescout.com>
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.
Thanks!
I am going to merge this, but could you please create another PR and add a section to the README about the new functionality?
HI
I am new to Jaeger and this is an initial solution to #715 I'd like to know if this approach (warping the scope manager) is an acceptable solution.
Which problem is this PR solving?
Short description of the changes