Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Starting with v.2.0 of .NET AppInsights SDK sampling is enabled by default in ApplicationInsights.config. There are two options available for sampling: SamplingTelemetryProcessor (fixed rate) and AdaptiveSamplingTelemetryProcessor. One limitation of current solution is that customer cannot choose what telemetry types to sample - sampling is applied to all telemetry types except custom metrics. In the upcoming versions of .NET SDK, we will address this problem (there's already an API proposal), however at the meantime here's a what you can do to choose what telemetry types you would like to sample.
<!--
<Add Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.AdaptiveSamplingTelemetryProcessor, Microsoft.AI.ServerTelemetryChannel">
<MaxTelemetryItemsPerSecond>5</MaxTelemetryItemsPerSecond>
</Add>
-->
<Add Type="Microsoft.ApplicationInsights.Samples.ConfigurableAdaptiveSamplingTelemetryProcessor, <YourAssemblyName>">
<MaxTelemetryItemsPerSecond>5</MaxTelemetryItemsPerSecond>
<SampledTelemetry>Request;Dependency</SampledTelemetry>
</Add>
And this is all you need. Possible values for SampledTelemetry are request, dependency, event, exception, pageview, performancecounter, trace, metric. One caveat is that if you specify empty list, no telemetry types will be sampled - but you can change this logic. You can also apply the same approach to customize SamplingTelemetryProcessor (fixed rate).
Looking forward to your feedback - what else would you like to customize in our default sampling functionality?
Please sign in to use this experience.
Sign in