-
Notifications
You must be signed in to change notification settings - Fork 200
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
W3C Integration #782
W3C Integration #782
Conversation
…d address partial PR comments
…ests, propogate traceflags
...va/com/microsoft/applicationinsights/agent/internal/config/XmlAgentConfigurationBuilder.java
Outdated
Show resolved
Hide resolved
...m/microsoft/applicationinsights/autoconfigure/ApplicationInsightsWebModuleConfiguration.java
Outdated
Show resolved
Hide resolved
...java/com/microsoft/applicationinsights/web/internal/correlation/TraceContextCorrelation.java
Outdated
Show resolved
Hide resolved
...java/com/microsoft/applicationinsights/web/internal/correlation/TraceContextCorrelation.java
Outdated
Show resolved
Hide resolved
...java/com/microsoft/applicationinsights/web/internal/correlation/TraceContextCorrelation.java
Outdated
Show resolved
Hide resolved
...com/microsoft/applicationinsights/web/internal/correlation/TraceContextCorrelationTests.java
Outdated
Show resolved
Hide resolved
...com/microsoft/applicationinsights/web/internal/correlation/TraceContextCorrelationTests.java
Outdated
Show resolved
Hide resolved
...com/microsoft/applicationinsights/web/internal/correlation/TraceContextCorrelationTests.java
Outdated
Show resolved
Hide resolved
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.
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. |
...java/com/microsoft/applicationinsights/web/internal/correlation/TraceContextCorrelation.java
Outdated
Show resolved
Hide resolved
...java/com/microsoft/applicationinsights/web/internal/correlation/TraceContextCorrelation.java
Outdated
Show resolved
Hide resolved
...java/com/microsoft/applicationinsights/web/internal/correlation/TraceContextCorrelation.java
Outdated
Show resolved
Hide resolved
...java/com/microsoft/applicationinsights/web/internal/correlation/TraceContextCorrelation.java
Outdated
Show resolved
Hide resolved
...java/com/microsoft/applicationinsights/web/internal/correlation/TraceContextCorrelation.java
Outdated
Show resolved
Hide resolved
@@ -286,6 +286,10 @@ public void testCrossComponentCorrelationHeadersAreCapturedWhenW3CTurnedOn() { | |||
|
|||
} | |||
|
|||
private String formatedID(String id) { |
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
@@ -248,4 +248,9 @@ public static String getRequestSourceValue(String appId) { | |||
|
|||
return String.format("cid-v1:%s", appId); | |||
} | |||
|
|||
private String formatedID(String id) { |
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
@lmolkova I refactored |
...ain/java/com/microsoft/applicationinsights/agent/internal/agent/HttpClientMethodVisitor.java
Show resolved
Hide resolved
...java/com/microsoft/applicationinsights/web/internal/correlation/TraceContextCorrelation.java
Outdated
Show resolved
Hide resolved
* | ||
* @author Dhaval Doshi | ||
*/ | ||
public class TraceContextCorrelation { |
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 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
...java/com/microsoft/applicationinsights/web/internal/correlation/TraceContextCorrelation.java
Outdated
Show resolved
Hide resolved
* 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=true
Outgoing 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.