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
Copy file name to clipboardExpand all lines: articles/azure-monitor/app/sampling.md
+26-4Lines changed: 26 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ When metric counts are presented in the portal, they are renormalized to take in
17
17
18
18
* There are three different types of sampling: adaptive sampling, fixed-rate sampling, and ingestion sampling.
19
19
* Adaptive sampling is enabled by default in all the latest versions of the Application Insights ASP.NET and ASP.NET Core Software Development Kits (SDKs). It is also used by [Azure Functions](https://docs.microsoft.com/azure/azure-functions/functions-overview).
20
-
* Fixed-rate sampling is available in recent versions of the Application Insights SDKs for ASP.NET, ASP.NET Core, Java, and Python.
20
+
* Fixed-rate sampling is available in recent versions of the Application Insights SDKs for ASP.NET, ASP.NET Core, Java (both the agent and the SDK), and Python.
21
21
* Ingestion sampling works on the Application Insights service endpoint. It only applies when no other sampling is in effect. If the SDK samples your telemetry, ingestion sampling is disabled.
22
22
* For web applications, 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.
23
23
* If you write Analytics queries, you should [take account of sampling](../../azure-monitor/log-query/aggregations.md). In particular, instead of simply counting records, you should use `summarize sum(itemCount)`.
@@ -239,7 +239,7 @@ In Metrics Explorer, rates such as request and exception counts are multiplied b
239
239
</TelemetryProcessors>
240
240
```
241
241
242
-
Alternatively, instead of setting the sampling parameter in the `ApplicationInsights.config` file, you can programmatically set these values:
242
+
Alternatively, instead of setting the sampling parameter in the `ApplicationInsights.config` file, you can programmatically set these values:
243
243
244
244
```csharp
245
245
using Microsoft.ApplicationInsights.Extensibility;
@@ -301,7 +301,29 @@ In Metrics Explorer, rates such as request and exception counts are multiplied b
301
301
302
302
### Configuring fixed-rate sampling for Java applications
303
303
304
-
By default no sampling is enabled in the Java SDK. Currently it only supports fixed rate sampling. Adaptive sampling is not supported in the Java SDK.
304
+
By default no sampling is enabled in the Java agent and SDK. Currently it only supports fixed rate sampling. Adaptive sampling is not supported in Java.
1. To enable sampling add the following to your `ApplicationInsights.json` file:
311
+
312
+
```json
313
+
{
314
+
"instrumentationSettings": {
315
+
"preview": {
316
+
"sampling": {
317
+
"fixedRate": {
318
+
"percentage": 10 //this is just an example that shows you how to enable only only 10% of transaction
319
+
}
320
+
}
321
+
}
322
+
}
323
+
}
324
+
```
325
+
326
+
#### Configuring Java SDK
305
327
306
328
1. Download and configure your web application with the latest [Application Insights Java SDK](../../azure-monitor/app/java-get-started.md).
307
329
@@ -530,7 +552,7 @@ The accuracy of the approximation largely depends on the configured sampling per
530
552
531
553
* Ingestion sampling can occur automatically for any telemetry above a certain volume, if the SDK is not performing sampling. This configuration would work, for example, if you are using an older version of the ASP.NET SDK or Java SDK.
532
554
* If you're using the current ASP.NET or ASP.NET Core SDKs (hosted either in Azure or on your own server), you get adaptive sampling by default, but you can switch to fixed-rate as described above. With fixed-rate sampling, the browser SDK automatically synchronizes to sample related events.
533
-
* If you're using the current Java SDK, you can configure `ApplicationInsights.xml` to turn on fixed-rate sampling. Sampling is turned off by default. With fixed-rate sampling, the browser SDK and the server automatically synchronize to sample related events.
555
+
* If you're using the current Java agent, you can configure `ApplicationInsights.json` (for Java SDK, configure `ApplicationInsights.xml`) to turn on fixed-rate sampling. Sampling is turned off by default. With fixed-rate sampling, the browser SDK and the server automatically synchronize to sample related events.
534
556
535
557
*There are certain rare events I always want to see. How can I get them past the sampling module?*
0 commit comments