Skip to content

Commit 5a7cec7

Browse files
committed
sampling
1 parent 26a5c24 commit 5a7cec7

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

articles/azure-monitor/app/sampling.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, Telemetr
192192

193193
**If using the above method to configure sampling, make sure to use ```aiOptions.EnableAdaptiveSampling = false;``` settings with AddApplicationInsightsTelemetry().**
194194

195-
## Fixed-rate sampling for ASP.NET, ASP.NET Core, and Java websites
195+
## Fixed-rate sampling for ASP.NET, ASP.NET Core, Java websites and Python applications
196196

197197
Fixed rate sampling reduces the traffic sent from your web server and web browsers. Unlike adaptive sampling, it reduces telemetry at a fixed rate decided by you. It also synchronizes the client and server sampling so that related items are retained - for example, when you look at a page view in Search, you can find its related request.
198198

@@ -331,7 +331,27 @@ The telemetry types that can be included or excluded from sampling are: Dependen
331331

332332
<a name="other-web-pages"></a>
333333

334+
### Configuring fixed-rate sampling in OpenCensus Python ###
334335

336+
1. Instrument your application with the latest [OpenCensus Azure Monitor exporters](../../azure-monitor/app/opencensus-python.md).
337+
338+
> [!NOTE]
339+
> Fixed-rate sampling is only available using the trace exporter. This means incoming and outgoing requests are the only types of telemetry where sampling can be configured.
340+
>
341+
>
342+
343+
2. You may specify a `sampler` as part of your `Tracer` configuration. If no explicit sampler is provided, the ProbabilitySampler will be used by default. The ProbabilitySampler would use a rate of 1/10000 by default, meaning one out of every 10000 requests will be sent to Application Insights. If you want to specify a sampling rate, see below.
344+
345+
3. When specifying a sampler, make sure your `Tracer` specifies a sampler with a sampling rate between 0.0 and 1.0 inclusive. A sampling rate of 1.0 represents 100%, meaning all of your requests will be sent as telemetry to Application Insights.
346+
347+
```python
348+
tracer = Tracer(
349+
exporter=AzureExporter(
350+
instrumentation_key='00000000-0000-0000-0000-000000000000',
351+
),
352+
sampler=ProbabilitySampler(1.0),
353+
)
354+
```
335355

336356
## Ingestion sampling
337357

0 commit comments

Comments
 (0)