0
votes

I would like to use Azure Application Insights in my console application to track some operations.

We currently track some traces, dependencies and exceptions, but I would like to link them so I could better see the context of these events and how do relate to each other (timeline maybe)..

Reading the topic specific for long running tasks, I wounder if it would be possible to have individual operations for each background task, these tasks run run in parallel?

In my case I have a single instance of TelemetryClient that is injected into these worker threads. The way the code looks like, once you start and operation, everything that goes after is tracked as being part of the same operation.

Any ideas? Would I need multiple instances of TelemetryClient?

1

1 Answers

0
votes

You can and should use individual operations for each background task. i.e every background task code should be wrapped inside tc.startoperation.. tc.stopoperation. All telemetry generated within that task will be correlated together. Have you followed the example fully? If not, please share your snippet.

You dont need multiple instances of telemetryclient. If you used WorkerService package from the below link, then retrieve TelemetryClient instance from DI. https://docs.microsoft.com/en-us/azure/azure-monitor/app/worker-service#net-corenet-framework-console-application