You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| ASP.NET |[Yes (on by default)](#configuring-adaptive-sampling-for-aspnet-applications)|[Yes](#configuring-fixed-rate-sampling-for-aspnet-applications)| Only if no other sampling is in effect |
32
-
| ASP.NET Core |[Yes (on by default)](#configuring-adaptive-sampling-for-aspnet-core-applications)|[Yes](#configuring-fixed-rate-sampling-for-aspnet-core-applications)| Only if no other sampling is in effect |
33
-
| Azure Functions |[Yes (on by default)](#configuring-adaptive-sampling-for-azure-functions)| No | Only if no other sampling is in effect |
34
-
| Java | No |[Yes](#configuring-sampling-overrides-and-fixed-rate-sampling-for-java-applications)| Only if no other sampling is in effect |
35
-
| JavaScript | No |[Yes](#configuring-fixed-rate-sampling-for-web-pages-with-javascript)| Only if no other sampling is in effect |
36
-
| Node.JS | No | [Yes](./nodejs.md#sampling) | Only if no other sampling is in effect
37
-
| Python | No |[Yes](#configuring-fixed-rate-sampling-for-opencensus-python-applications)| Only if no other sampling is in effect |
38
-
| All others | No | No |[Yes](#ingestion-sampling)|
| ASP.NET |[Yes (on by default)](#configuring-adaptive-sampling-for-aspnet-applications)|[Yes](#configuring-fixed-rate-sampling-for-aspnet-applications)| Only if no other sampling is in effect |
32
+
| ASP.NET Core |[Yes (on by default)](#configuring-adaptive-sampling-for-aspnet-core-applications)|[Yes](#configuring-fixed-rate-sampling-for-aspnet-core-applications)| Only if no other sampling is in effect |
33
+
| Azure Functions |[Yes (on by default)](#configuring-adaptive-sampling-for-azure-functions)| No| Only if no other sampling is in effect |
34
+
| Java | No|[Yes](#configuring-sampling-overrides-and-fixed-rate-sampling-for-java-applications)| Only if no other sampling is in effect |
35
+
| JavaScript | No |[Yes](#configuring-fixed-rate-sampling-for-web-pages-with-javascript)| Only if no other sampling is in effect |
36
+
| Node.JS | No |[Yes](./nodejs.md#sampling)| Only if no other sampling is in effect|
37
+
| Python | No |[Yes](#configuring-fixed-rate-sampling-for-opencensus-python-applications)| Only if no other sampling is in effect |
38
+
| All others | No | No |[Yes](#ingestion-sampling)|
39
39
40
40
> [!NOTE]
41
-
> The information on most of this page applies to the current versions of the Application Insights SDKs. For information on older versions of the SDKs, [see the section below](#older-sdk-versions).
41
+
> - The Java Application Agent 3.4.0 and later uses rate-limited sampling as the default when sending telemetry to Application Insights. For more information, see [Rate-limited sampling](java-standalone-config.md#rate-limited-sampling).
42
+
> - The information on most of this page applies to the current versions of the Application Insights SDKs. For information on older versions of the SDKs, see [older SDK versions](#older-sdk-versions).
42
43
43
44
## When to use sampling
44
45
45
46
In general, for most small and medium size applications you don't need sampling. The most useful diagnostic information and most accurate statistics are obtained by collecting data on all your user activities.
46
47
47
48
The main advantages of sampling are:
48
49
49
-
* Application Insights service drops ("throttles") data points when your app sends a very high rate of telemetry in a short time interval. Sampling reduces the likelihood that your application will see throttling occur.
50
+
* Application Insights service drops ("throttles") data points when your app sends a high rate of telemetry in a short time interval. Sampling reduces the likelihood that your application sees throttling occur.
50
51
* To keep within the [quota](../logs/daily-cap.md) of data points for your pricing tier.
51
52
* To reduce network traffic from the collection of telemetry.
52
53
53
54
## How sampling works
54
55
55
-
The sampling algorithm decides which telemetry items to drop, and which ones to keep. This is true whether sampling is done by the SDK or in the Application Insights service. The sampling decision is based on several rules that aim to preserve all interrelated data points intact, maintaining a diagnostic experience in Application Insights that is actionable and reliable even with a reduced data set. For example, if your app has a failed request included in a sample, the additional telemetry items (such as exception and traces logged for this request) will be retained. Sampling either keeps or drops them all together. As a result, when you look at the request details in Application Insights, you can always see the request along with its associated telemetry items.
56
+
The sampling algorithm decides which telemetry items to drop, and which ones to keep. It is true whether sampling is done by the SDK or in the Application Insights service. The sampling decision is based on several rules that aim to preserve all interrelated data points intact, maintaining a diagnostic experience in Application Insights that is actionable and reliable even with a reduced data set. For example, if your app has a failed request included in a sample, the extra telemetry items (such as exception and traces logged for this request) are retained. Sampling either keeps or drops them all together. As a result, when you look at the request details in Application Insights, you can always see the request along with its associated telemetry items.
56
57
57
-
The sampling decision is based on the operation ID of the request, which means that all telemetry items belonging to a particular operation is either preserved or dropped. For the telemetry items that do not have an operation ID set (such as telemetry items reported from asynchronous threads with no HTTP context) sampling simply captures a percentage of telemetry items of each type.
58
+
The sampling decision is based on the operation ID of the request, which means that all telemetry items belonging to a particular operation is either preserved or dropped. For the telemetry items that don't have an operation ID set (such as telemetry items reported from asynchronous threads with no HTTP context) sampling simply captures a percentage of telemetry items of each type.
58
59
59
-
When presenting telemetry back to you, the Application Insights service adjusts the metrics by the same sampling percentage that was used at the time of collection, to compensate for the missing data points. Hence, when looking at the telemetry in Application Insights, the users are seeing statistically correct approximations that are very close to the real numbers.
60
+
When presenting telemetry back to you, the Application Insights service adjusts the metrics by the same sampling percentage that was used at the time of collection, to compensate for the missing data points. Hence, when looking at the telemetry in Application Insights, the users are seeing statistically correct approximations that are close to the real numbers.
60
61
61
-
The accuracy of the approximation largely depends on the configured sampling percentage. Also, the accuracy increases for applications that handle a large volume of generally similar requests from lots of users. On the other hand, for applications that don't work with a significant load, sampling is not needed as these applications can usually send all their telemetry while staying within the quota, without causing data loss from throttling.
62
+
The accuracy of the approximation largely depends on the configured sampling percentage. Also, the accuracy increases for applications that handle a large volume of similar requests from lots of users. On the other hand, for applications that don't work with a significant load, sampling isn't needed as these applications can usually send all their telemetry while staying within the quota, without causing data loss from throttling.
62
63
63
64
## Types of sampling
64
65
@@ -82,7 +83,7 @@ Adaptive sampling affects the volume of telemetry sent from your web server app
82
83
83
84
The volume is adjusted automatically to keep within a specified maximum rate of traffic, and is controlled via the setting `MaxTelemetryItemsPerSecond`. If the application produces a low amount of telemetry, such as when debugging or due to low usage, items won't be dropped by the sampling processor as long as volume is below `MaxTelemetryItemsPerSecond`. As the volume of telemetry increases, the sampling rate is adjusted so as to achieve the target volume. The adjustment is recalculated at regular intervals, and is based on a moving average of the outgoing transmission rate.
84
85
85
-
To achieve the target volume, some of the generated telemetry is discarded. But like other types of sampling, the algorithm retains related telemetry items. For example, when you're inspecting the telemetry in Search, you'll be able to find the request related to a particular exception.
86
+
To achieve the target volume, some of the generated telemetry is discarded. But like other types of sampling, the algorithm retains related telemetry items. For example, when you're inspecting the telemetry in Search, you are able to find the request related to a particular exception.
86
87
87
88
Metric counts such as request rate and exception rate are adjusted to compensate for the sampling rate, so that they show approximate values in Metric Explorer.
88
89
@@ -131,7 +132,7 @@ In [`ApplicationInsights.config`](./configuration-with-applicationinsights-confi
131
132
132
133
*`<IncludedTypes>type;type</IncludedTypes>`
133
134
134
-
A semi-colon delimited list of types that you do want to subject to sampling. Recognized types are: [`Dependency`](data-model-complete.md#dependency), [`Event`](data-model-complete.md#event), [`Exception`](data-model-complete.md#exception), [`PageView`](data-model-complete.md#pageview), [`Request`](data-model-complete.md#request), [`Trace`](data-model-complete.md#trace). The specified types will be sampled; all telemetry of the other types will always be transmitted.
135
+
A semi-colon delimited list of types that you do want to subject to sampling. Recognized types are: [`Dependency`](data-model-complete.md#dependency), [`Event`](data-model-complete.md#event), [`Exception`](data-model-complete.md#exception), [`PageView`](data-model-complete.md#pageview), [`Request`](data-model-complete.md#request), [`Trace`](data-model-complete.md#trace). The specified types are sampled; all telemetry of the other types will always be transmitted.
135
136
136
137
**To switch off** adaptive sampling, remove the `AdaptiveSamplingTelemetryProcessor` node(s) from `ApplicationInsights.config`.
137
138
@@ -211,7 +212,7 @@ public void ConfigureServices(IServiceCollection services)
211
212
212
213
---
213
214
214
-
The above code will disable adaptive sampling. Follow the steps below to add sampling with more customization options.
215
+
The above code disables adaptive sampling. Follow the steps below to add sampling with more customization options.
215
216
216
217
#### Configure sampling settings
217
218
@@ -509,9 +510,9 @@ Use this type of sampling if your app often goes over its monthly quota and you
509
510
510
511
Set the sampling rate in the Usage and estimated costs page:
511
512
512
-
:::image type="content" source="./media/sampling/data-sampling.png" lightbox="./media/sampling/data-sampling.png" alt-text="From the application's Overview pane, click Settings, Quota, Samples, then select a sampling rate, and click Update.":::
513
+
:::image type="content" source="./media/sampling/data-sampling.png" lightbox="./media/sampling/data-sampling.png" alt-text="From the application's Overview pane, select Settings, Quota, Samples, then select a sampling rate, and select Update.":::
513
514
514
-
Like other types of sampling, the algorithm retains related telemetry items. For example, when you're inspecting the telemetry in Search, you'll be able to find the request related to a particular exception. Metric counts such as request rate and exception rate are correctly retained.
515
+
Like other types of sampling, the algorithm retains related telemetry items. For example, when you're inspecting the telemetry in Search, you are able to find the request related to a particular exception. Metric counts such as request rate and exception rate are correctly retained.
515
516
516
517
Data points that are discarded by sampling aren't available in any Application Insights feature such as [Continuous Export](./export-telemetry.md).
517
518
@@ -531,11 +532,11 @@ Ingestion sampling doesn't operate while adaptive or fixed-rate sampling is in o
531
532
**Use fixed-rate sampling if:**
532
533
533
534
* You want synchronized sampling between client and server so that, when you're investigating events in [Search](./diagnostic-search.md), you can navigate between related events on the client and server, such as page views and HTTP requests.
534
-
* You are confident of the appropriate sampling percentage for your app. It should be high enough to get accurate metrics, but below the rate that exceeds your pricing quota and the throttling limits.
535
+
* You're confident of the appropriate sampling percentage for your app. It should be high enough to get accurate metrics, but below the rate that exceeds your pricing quota and the throttling limits.
535
536
536
537
**Use adaptive sampling:**
537
538
538
-
If the conditions to use the other forms of sampling do not apply, we recommend adaptive sampling. This setting is enabled by default in the ASP.NET/ASP.NET Core SDK. It will not reduce traffic until a certain minimum rate is reached, therefore low-use sites will probably not be sampled at all.
539
+
If the conditions to use the other forms of sampling don't apply, we recommend adaptive sampling. This setting is enabled by default in the ASP.NET/ASP.NET Core SDK. It will not reduce traffic until a certain minimum rate is reached, therefore low-use sites will probably not be sampled at all.
539
540
540
541
## Knowing whether sampling is in operation
541
542
@@ -554,11 +555,11 @@ If you see that `RetainedPercentage` for any type is less than 100, then that ty
554
555
555
556
## Log query accuracy and high sample rates
556
557
557
-
As the application is scaled up, it may be processing dozens, hundreds, or thousands of work items per second. Logging an event for each of them is not resource nor cost effective. Application Insights uses sampling to adapt to growing telemetry volume in a flexible manner and to control resource usage and cost.
558
+
As the application is scaled up, it may be processing dozens, hundreds, or thousands of work items per second. Logging an event for each of them isn't resource nor cost effective. Application Insights uses sampling to adapt to growing telemetry volume in a flexible manner and to control resource usage and cost.
558
559
> [!WARNING]
559
560
> A distributed operation's end-to-end view integrity may be impacted if any application in the distributed operation has turned on sampling. Different sampling decisions are made by each application in a distributed operation, so telemetry for one Operation ID may be saved by one application while other applications may decide to not sample the telemetry for that same Operation ID.
560
561
561
-
As sampling rates increase log based queries accuracy decrease and are usually inflated. This only impacts the accuracy of log-based queries when sampling is enabled and the sample rates are in a higher range (~ 60%). The impact varies based on telemetry types, telemetry counts per operation as well as other factors.
562
+
As sampling rates increase log based queries accuracy decrease and are inflated. This only impacts the accuracy of log-based queries when sampling is enabled and the sample rates are in a higher range (~ 60%). The impact varies based on telemetry types, telemetry counts per operation as well as other factors.
562
563
563
564
To address the problems introduced by sampling pre-aggregated metrics are used in the SDKs. Additional details about these metrics, log-based and pre-aggregated, can be referenced in [Azure Application Insights - Azure Monitor | Microsoft Docs](./pre-aggregated-metrics-log-metrics.md#sdk-supported-pre-aggregated-metrics-table). Relevant properties of the logged data are identified and statistics extracted before sampling occurs. To avoid resource and cost issues, metrics are aggregated. The resulting aggregate data is represented by only a few metric telemetry items per minute, instead of potentially thousands of event telemetry items. These metrics calculate the 25 requests from the example and send a metric to the MDM account reporting “this web app processed 25 requests”, but the sent request telemetry record will have an `itemCount` of 100. These pre-aggregated metrics report the correct numbers and can be relied upon when sampling affects the log-based queries results. They can be viewed on the Metrics pane of the Application Insights portal.
0 commit comments