4

I'd like to switch to using Application Insights for logging etc. I know I'm going to need to use sampling on my telemetry data, to stay within the free plan. However, I want to be able to see all event sequences that led to an exception being thrown, so I can reproduce them.

Does Application Insights come with something like this built in? And if not, is there some way I can write a custom sampler which produces the desired behaviour? E.g.

class CustomSampler : ITelemetrySampler
Andrew Williamson
  • 8,299
  • 3
  • 34
  • 62

1 Answers1

9

There is the ExcludeTypes property in version 2.2.0 of the AdaptiveSamplingTelemetryProcessor.

<Add Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.AdaptiveSamplingTelemetryProcessor, Microsoft.AI.ServerTelemetryChannel">
  <MaxTelemetryItemsPerSecond>499</MaxTelemetryItemsPerSecond>
  <ExcludedTypes>Exception</ExcludedTypes>
</Add>

From the release notes of 2.2.0-beta1

Telemetry types can be excluded from sampling by specifying the ExcludedTypes property (Add ExcludedTypes element under AdaptiveSampling telemetry processor node with ';'-separated list. Possible types are "Dependency", "Event", "Exception", "PageView", "Request", "Trace").

https://github.com/Microsoft/ApplicationInsights-dotnet/blob/v2.2.0/src/TelemetryChannels/ServerTelemetryChannel/Shared/AdaptiveSamplingTelemetryProcessor.cs#L67

James Davis - MSFT
  • 1,736
  • 10
  • 12
  • Thank you, this is pretty much exactly what I was looking for. Just a small follow-up question - say my server is processing packets, and I'd like to know the ID of the packet that caused the exception. If I create a custom exception with a PacketID field, and use it to wrap the inner exception, A: Will the PacketID field be sent to Azure, and B: Can I traverse the inner exceptions in Azure? – Andrew Williamson Jan 11 '17 at 19:48
  • Do you know if customEvents is considered event? thanks – Campinho Sep 18 '18 at 00:03