Sunday, August 25, 2019

Application Insights Sampling

Sampling is a feature in Azure Application Insights. It is the recommended way to reduce telemetry traffic and storage, while preserving a statistically correct analysis of application data. The filter selects items that are related, so that you can navigate between items when you are doing diagnostic investigations. When metric counts are presented in the portal, they are renormalized to take into account sampling. Doing so minimizes any effect on the statistics.

  • Sampling reduces traffic and data costs, and helps you avoid throttling.
  • Sampling retains 1 in n records and discards the rest. For example, it might retain one in five events, a sampling rate of 20%.
  • Adaptive Sampling is enabled by default in all the latest version of ASP.NET and ASP.NET Core Software Development Kits (SDKs).
  • You can also set sampling manually. This can be configured in the portal on the Usage and estimated costs page, in the ASP.NET SDK in the ApplicationInsights.config file, in the ASP.NET Core SDK via code or in the Java SDK in the ApplicationInsights.xml file.
  • If you log custom events and need to ensure that a set of events is retained or discarded together, the events must have the same OperationId value.
  • The sampling divisor n is reported in each record in the property itemCount, which in Search appears under the friendly name "request count" or "event count". itemCount==1when sampling is not in operation.
  • If you write Analytics queries, you should take account of sampling. In particular, instead of simply counting records, you should use summarize sum(itemCount).

No comments:

Post a Comment