microsoft / ApplicationInsights-ServiceFabric

ApplicationInsights SDK for ServiceFabric projects
MIT License
63 stars 26 forks source link

Upgrading Application Insights breaks service correlation #115

Open lindgrend opened 3 years ago

lindgrend commented 3 years ago

We are running a service fabric cluster with the following values: Microsoft.ServiceFabric: 6.4.638 Other service fabric nuget: 3.3.638 Microsoft.ApplicationInsights.ServiceFabric.Native 2.2.2 Application insights: 2.9.1 Microsoft.ApplicationInsights.AspNetCore: 2.6.1

This is running as expected 2 9 1

We now need to upgrade our application insights because of needing some later functionality and when we upgrade Application insights and Microsoft.ApplicationInsights.AspNetCore to 2.16.0 as only change the correlation between the services is gone. 2 16 0

This is making us having to choose between having correlation on our Service fabric services or our NServicebus integration and also blocking us for keeping Application insights up to date.

A minimum repo displaying this behavior can be found at: https://github.com/lindgrend/AI.Repro

yantang-msft commented 3 years ago

@lindgrend, most likely it's because the latest AppInsights sdk switched to W3C correlation header, which is not compatible with the correlation protocol in this SDK. And there is currently no plan on supporting the new protocol for this SDK, so unfortunately, you'll have to choose between one of them.

lindgrend commented 3 years ago

Am I understanding it correctly that it could be solved by upgrading Service fabric and would that include going to the next major release then?

yantang-msft commented 3 years ago

It's correct it can be solved by implementing the new correlation protocol. However, this repo is currently in maintenance mode only for bug fixes, there is no plan for next major release. :(

DHoefakker commented 3 years ago

@yantang-msft I hop on this issue based on a issue I encounter (https://stackoverflow.com/questions/66011506/applicationinsights-end-2-end-breaks-on-servicefabric-apigateway) which looks like this issue.

Could you clarify a thing ==> However, this repo is currently in maintenance mode only for bug fixes, there is no plan for next major release. :( <==

Does this mean there are no updates coming for ApplicationInsights for ServiceFabric? Because the documentation states that "The correlation HTTP protocol, also called Request-Id, is being deprecated".

What's the best way forward? Forcing it to the "old" correlation protocol?

Hope my question is clear, maybe I misunderstood it a bit ;-)

yantang-msft commented 3 years ago

@DHoefakker I at one time saw there is a way to force using Request-Id in the doc, but last time I checked the doc again, I don't see it anymore. @cijothomas do you know how to enforce Request-Id protocol for the .net SDK?

cijothomas commented 3 years ago

@yantang-msft I believe ApplicationInsights still does request-id propagation along with traceparent. It would respect the ActivityID format set by the user. So one can set ActivityIDformat to legacy one like below. (somewhere in app startup)

Activity.DefaultIdFormat = ActivityIdFormat.Hierrachical; Activity.ForceDefaultIdFormat = true;

If this doesn't work, please open an issue in the applicaiton insights repo.

DHoefakker commented 3 years ago

@cijothomas @yantang-msft Yes, setting the ActivityIDFormat did the trick :partying_face:

Beside that i am wondering does this mean there are no updates coming for ApplicationInsights for ServiceFabric? Or is it related to .net? Are you now focussing on .net core / .net 5, and maintaining only the .net < 4.x version ?