Issue 846 add errorid to mdc#1050
Conversation
|
looks really good already! Given it's titled with |
… *.shaded.slf4j.Logger in error logging instrumentation
2e0ed11 to
76a0997
Compare
Hi, I added integration test MdcActivationListenerIT that verify error.id putting to MDC context. |
...m-log-correlation-plugin/src/test/java/co/elastic/apm/agent/mdc/MdcActivationListenerIT.java
Outdated
Show resolved
Hide resolved
...m-log-correlation-plugin/src/test/java/co/elastic/apm/agent/mdc/MdcActivationListenerIT.java
Outdated
Show resolved
Hide resolved
...m-log-correlation-plugin/src/test/java/co/elastic/apm/agent/mdc/MdcActivationListenerIT.java
Outdated
Show resolved
Hide resolved
...m-log-correlation-plugin/src/test/java/co/elastic/apm/agent/mdc/MdcActivationListenerIT.java
Outdated
Show resolved
Hide resolved
...m-log-correlation-plugin/src/test/java/co/elastic/apm/agent/mdc/MdcActivationListenerIT.java
Outdated
Show resolved
Hide resolved
apm-agent-core/src/main/java/co/elastic/apm/agent/impl/error/ErrorCapture.java
Show resolved
Hide resolved
...apm-log-correlation-plugin/src/main/java/co/elastic/apm/agent/mdc/MdcActivationListener.java
Outdated
Show resolved
Hide resolved
...m-log-correlation-plugin/src/test/java/co/elastic/apm/agent/mdc/MdcActivationListenerIT.java
Show resolved
Hide resolved
apm-agent-core/src/main/java/co/elastic/apm/agent/impl/error/ErrorCapture.java
Outdated
Show resolved
Hide resolved
apm-agent-core/src/main/java/co/elastic/apm/agent/impl/error/ErrorCapture.java
Outdated
Show resolved
Hide resolved
…elastic/apm/agent/mdc/MdcActivationListenerIT.java Co-Authored-By: Felix Barnsteiner <felixbarny@users.noreply.github.com>
…elastic/apm/agent/mdc/MdcActivationListenerIT.java Co-Authored-By: Felix Barnsteiner <felixbarny@users.noreply.github.com>
…elastic/apm/agent/mdc/MdcActivationListenerIT.java Co-Authored-By: Felix Barnsteiner <felixbarny@users.noreply.github.com>
...t/java/co/elastic/apm/agent/es/restclient/v5_6/ElasticsearchRestClientInstrumentationIT.java
Outdated
Show resolved
Hide resolved
...apm-log-correlation-plugin/src/main/java/co/elastic/apm/agent/mdc/MdcActivationListener.java
Outdated
Show resolved
Hide resolved
...apm-log-correlation-plugin/src/main/java/co/elastic/apm/agent/mdc/MdcActivationListener.java
Show resolved
Hide resolved
apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracer.java
Outdated
Show resolved
Hide resolved
...m-log-correlation-plugin/src/test/java/co/elastic/apm/agent/mdc/MdcActivationListenerIT.java
Show resolved
Hide resolved
...m-log-correlation-plugin/src/test/java/co/elastic/apm/agent/mdc/MdcActivationListenerIT.java
Outdated
Show resolved
Hide resolved
...m-log-correlation-plugin/src/test/java/co/elastic/apm/agent/mdc/MdcActivationListenerIT.java
Outdated
Show resolved
Hide resolved
...-plugin/src/main/java/co/elastic/apm/agent/error/logging/AbstractLoggingInstrumentation.java
Outdated
Show resolved
Hide resolved
...-plugin/src/main/java/co/elastic/apm/agent/error/logging/AbstractLoggingInstrumentation.java
Outdated
Show resolved
Hide resolved
|
|
||
| private void assertMdcErrorIdIsEmpty() { | ||
| assertThat(MDC.get("error.id")).isNull(); | ||
| if (org.apache.log4j.MDC.get("test") == Boolean.TRUE) { |
There was a problem hiding this comment.
This if can be removed, as we're using assumptions in the test methods now. The way assumptions work is similar to assertions but instead of failing the test, they just skip the test.
|
|
||
| private Answer<Void> assertMdcErrorIdIsNotEmpty() { | ||
| assertThat(MDC.get("error.id")).isNotBlank(); | ||
| if (org.apache.log4j.MDC.get("test") == Boolean.TRUE) { |
...rofiling-plugin/src/main/java/co/elastic/apm/agent/profiler/ProfilingActivationListener.java
Show resolved
Hide resolved
felixbarny
left a comment
There was a problem hiding this comment.
Almost there 🙂
Do the tests pass now?
eyalkoren
left a comment
There was a problem hiding this comment.
Thanks @kananindzya , looks good!
A few required minor changes and we're done.
apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracer.java
Outdated
Show resolved
Hide resolved
apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracer.java
Outdated
Show resolved
Hide resolved
apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracer.java
Show resolved
Hide resolved
apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/TraceContextHolder.java
Outdated
Show resolved
Hide resolved
|
@felixbarny do we have a UI issue for showing this correlation? |
|
@kananindzya Lastly, looking at the PR checklist - please:
Thanks! |
…ApmTracer.java Co-Authored-By: eyalkoren <41850454+eyalkoren@users.noreply.github.com>
|
I've created one: elastic/kibana#61952 |
added |
|
run elasticsearch-ci/docs |
Fixing docs
|
run elasticsearch-ci/docs |
Codecov Report
@@ Coverage Diff @@
## master #1050 +/- ##
============================================
- Coverage 60.19% 60.02% -0.18%
Complexity 87 87
============================================
Files 327 327
Lines 14844 14799 -45
Branches 2081 2067 -14
============================================
- Hits 8936 8883 -53
- Misses 5313 5315 +2
- Partials 595 601 +6
Continue to review full report at Codecov.
|
eyalkoren
left a comment
There was a problem hiding this comment.
Well done @kananindzya!! 🎉

What does this PR do?
closes #846
Checklist
Author's Checklist
Related issues
Use cases
Screenshots