Philip Colmer
Philip Colmer

Reputation: 1684

How to stop collecting telemetry once started in Windows Store app?

I've started looking at adding Azure Application Insights to my app. The documentation and the SDK seems to be a bit sparse ...

I've added a call to Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync and the data is being successfully reported to the Azure Portal.

However, I want to provide a setting in the app so that the user can turn collection on and off. Is there a way of stopping collection or can I only "not start" collection? In other words, if the user changes the setting value, can I react to it straight away or just when the app starts up?

Thanks.

Upvotes: 0

Views: 379

Answers (1)

JuanK
JuanK

Reputation: 2094

I have done this:

To dynamically stop and start the collection and transmission of telemetry:

using  Microsoft.ApplicationInsights.Extensibility;

TelemetryConfiguration.Active.DisableTelemetry = true;

To disable selected standard collectors - for example,

  • performance counters
  • HTTP requests
  • dependencies

Delete or comment out the relevant lines in ApplicationInsights.config. You could do this, for example, if you want to send your own TrackRequest data.

Taken from App Insights Documentation:

Upvotes: 2

Related Questions