W3C Integration#782
Conversation
…d address partial PR comments
…ests, propogate traceflags
lmolkova
left a comment
There was a problem hiding this comment.
we need to report id and parent id in the |traceid.spanid. format. otherwise, there will be no correlation with .NET and python and go
|
Test harness results @reyang https://docs.oracle.com/javase/8/docs/api/java/util/LinkedHashMap.html#LinkedHashMap-int- |
|
@lmolkova could you please approve the changes. I believe I addressed all your concerns. |
|
|
||
| } | ||
|
|
||
| private String formatedID(String id) { |
| return String.format("cid-v1:%s", appId); | ||
| } | ||
|
|
||
| private String formatedID(String id) { |
|
@lmolkova I refactored |
| * | ||
| * @author Dhaval Doshi | ||
| */ | ||
| public class TraceContextCorrelation { |
There was a problem hiding this comment.
I wonder, why it is in web packge? it's needed for outgoing requests as well that have nothing to do with web.
There was a problem hiding this comment.
In general, Java SDK has tried to blur the distinction within core and web sdk and make the life simpler for users. If you look at ApplicationInsights-SpringBoot-Starter, it usually pulls down both core and web jars, and then smartly detect if the app is MVC type than only enable web modules. But classes are generally available on classpath. So this is okay I think. Also correlation has a primary relationship with requests in general and how they propogate in distributed systems.
However, I think Tracecontext classes can be well placed in core and implementation in web. However, I am aware that this classes will eventually go out of sdk and be replaced with a library so I won't worry about this atm.
* W3C : Tracecontext classes (#775) * W3C Tracecontext * adding comments * addressing PR comments * Implement W3C tracestate * address review feedbacks * address review comments * W3C Integration (#782) * Initial integration of W3C protocol for incoming request * refactoring header name * updating the verbosity level when correlation fails * Fix bugs in correlation found via tests, implement more unit tests and address partial PR comments * improve createOutboundTracestate() * create tracestate when header not available * fix test * enable outbout w3c * Refactering code to use Helper methods with TraceContext classes * fix tracestate integration, fix outbound tracestate injection, fix tests, propogate traceflags * add property to turn on W3C in springboot starter, remove debug logs * adopt internal storage of id's to legacy AI format for backport, update tests * address PR comments * Fix an incorrect assert * refactor resolveCorrelation() method to be more readable and debuggable * rename method names, create outbound traceparent for http if there is no incoming request too * fixing a bug in w3c config for agent * fix the dependency type name, fix target to be host+port | target * update changelog and readme * Minor changes, add log trace to check W3C enabled on agent * adding support for backport with AI-Legacy-Correlation-Headers * adding tests for backward compatibility * address PR comments * add few tests, comments * add backport switch turn off test * reset after tests, to fix the build * adding tracing to understand when W3C is turned on for debugging * fix format string * fix a bug in creating correct target for dependencies



Fix #716
This PR is super set of all previous PRs which completes the integration of W3C for both incoming and outbound calls.
Non Goals of this PR: Backward Compatibility with AI proprietary correlation protocol.
Related #776 #775
Enable W3C:
Incoming Side -
J2EE Apps add the following to the
<TelemetryModules>tag inside ApplicationInsights.xmlSpringboot apps add the following property:
azure.application-insights.web.w3c=trueOutgoing Side -
Add the following to AI-Agent.xml
Remember : you need both inbound and outbound settings to be the same for correlation to work properly.