azure_application_insights icon indicating copy to clipboard operation
azure_application_insights copied to clipboard

Added the ability to track dependency calls

Open m-gug opened this issue 1 year ago • 2 comments

Remote dependency calls can now be tracked with trackDependency().

Background: With trackRequest I had problems with distributed tracing across multiple application insights instances. AI could not connect the individual entries across the instances. According to the Application Insights documentation, dependencies should be used to track calls to an HTTP endpoint. Requests are more intended to track incoming requests in the backend. (https://learn.microsoft.com/en-us/azure/azure-monitor/app/data-model-complete#dependency)

With this change, distributed tracing also worked without any problems.

m-gug avatar Nov 12 '23 06:11 m-gug

@kentcb any chance to get an approval for this PR or do you need anything?

m-gug avatar Jan 09 '24 08:01 m-gug

@kentcb any chance, you could take a look at this PR? Should be a non breaking extension.

m-gug avatar May 17 '24 06:05 m-gug

@johnnyggalt awesome! I had some troubles with Application Insights not building the Correlation Context correctly and beeing unable to connect events accross multiple systems of Application Insights instances. got the Sdk-Context from looking at the Application Insights JS SDK and the source code so i gave it a try. But to be honest it was more a shot in the dark. Here ist the reference to the Javascript SDK: https://github.com/microsoft/ApplicationInsights-JS/blob/54ea6d7eb46a7f2ba697e25dd082365e655a7bb4/shared/AppInsightsCommon/src/RequestResponseHeaders.ts#L39

It could easily be that this would not be necessary. The v2 JS SDK sent the header by default, I just saw that in the v3 SDK it is no longer included by default. I have been using my fork with these changes in a production app since November 2023 and everything works perfectly.

m-gug avatar Aug 10 '24 05:08 m-gug

@m-gug Got it, thanks. I've removed it for now, since as best I can tell it is an internal thing, and worst case scenario is it might cause issues for folks with strict middleware. Anyway, if it turns out to be necessary, it can always be addressed separately to this PR.

kentcb avatar Aug 17 '24 00:08 kentcb

@all-contributors Please add @m-gug for code

kentcb avatar Aug 17 '24 00:08 kentcb

@kentcb

I've put up a pull request to add @m-gug! :tada:

allcontributors[bot] avatar Aug 17 '24 00:08 allcontributors[bot]

@m-gug Got it, thanks. I've removed it for now, since as best I can tell it is an internal thing, and worst case scenario is it might cause issues for folks with strict middleware. Anyway, if it turns out to be necessary, it can always be addressed separately to this PR.

Thank you, and no problem - i will check if the telemetry correlation is still working as intended on my side.

m-gug avatar Aug 19 '24 06:08 m-gug

@kentcb do you already have a plan when you will release the new version to pub.dev?

m-gug avatar Aug 19 '24 10:08 m-gug

@m-gug I intend following up on the remaining open issue before releasing. Can't promise any dates though.

kentcb avatar Aug 26 '24 22:08 kentcb