Skip to content

Commit c901cad

Browse files
authored
Merge pull request #111087 from MS-jgol/sampling-doc
added Java 3.0 info
2 parents 3113578 + 9d66cc4 commit c901cad

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

articles/azure-monitor/app/sampling.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ When metric counts are presented in the portal, they are renormalized to take in
1717

1818
* There are three different types of sampling: adaptive sampling, fixed-rate sampling, and ingestion sampling.
1919
* 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.
2121
* 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.
2222
* 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.
2323
* 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
239239
</TelemetryProcessors>
240240
```
241241

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:
243243

244244
```csharp
245245
using Microsoft.ApplicationInsights.Extensibility;
@@ -301,7 +301,29 @@ In Metrics Explorer, rates such as request and exception counts are multiplied b
301301

302302
### Configuring fixed-rate sampling for Java applications
303303

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.
305+
306+
#### Configuring Java Agent
307+
308+
1. Download [applicationinsights-agent-3.0.0-PREVIEW.2.jar](https://github.com/microsoft/ApplicationInsights-Java/releases/download/3.0.0-PREVIEW.2/applicationinsights-agent-3.0.0-PREVIEW.2.jar)
309+
310+
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
305327

306328
1. Download and configure your web application with the latest [Application Insights Java SDK](../../azure-monitor/app/java-get-started.md).
307329

@@ -530,7 +552,7 @@ The accuracy of the approximation largely depends on the configured sampling per
530552

531553
* 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.
532554
* 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.
534556

535557
*There are certain rare events I always want to see. How can I get them past the sampling module?*
536558

0 commit comments

Comments
 (0)