Skip to content

Commit 0bce989

Browse files
authored
Merge pull request #106205 from lzchen/patch-1
Add standard metrics in OpenCensus Python docs
2 parents bd1ddcc + 657c2d5 commit 0bce989

File tree

1 file changed

+48
-4
lines changed

1 file changed

+48
-4
lines changed

articles/azure-monitor/app/opencensus-python.md

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,20 @@ Here are the exporters that OpenCensus provides mapped to the types of telemetry
129129
main()
130130
```
131131

132-
4. Now when you run the Python script, you should still be prompted to enter values, but only the value is being printed in the shell. The created `SpanData` will be sent to Azure Monitor. You can find the emitted span data under `dependencies`.
132+
4. Now when you run the Python script, you should still be prompted to enter values, but only the value is being printed in the shell. The created `SpanData` will be sent to Azure Monitor. You can find the emitted span data under `dependencies`. For more details on outgoing requests, see OpenCensus Python [dependencies](https://docs.microsoft.com/azure/azure-monitor/app/opencensus-python-dependency).
133+
For more details on incoming requests, see OpenCensus Python [requests](https://docs.microsoft.com/azure/azure-monitor/app/opencensus-python-request).
133134

134-
5. For information on sampling in OpenCensus, take a look at [sampling in OpenCensus](sampling.md#configuring-fixed-rate-sampling-for-opencensus-python-applications).
135+
#### Sampling
135136

136-
6. For details on telemetry correlation in your trace data, take a look at OpenCensus [telemetry correlation](https://docs.microsoft.com/azure/azure-monitor/app/correlation#telemetry-correlation-in-opencensus-python).
137+
For information on sampling in OpenCensus, take a look at [sampling in OpenCensus](sampling.md#configuring-fixed-rate-sampling-for-opencensus-python-applications).
138+
139+
#### Trace correlation
140+
141+
For details on telemetry correlation in your trace data, take a look at OpenCensus Python [telemetry correlation](https://docs.microsoft.com/azure/azure-monitor/app/correlation#telemetry-correlation-in-opencensus-python).
142+
143+
#### Modify telemetry
144+
145+
For details on how to modify tracked telemetry before it is sent to Azure Monitor, see OpenCensus Python [telemetry processors](https://docs.microsoft.com/azure/azure-monitor/app/api-filtering-sampling#opencensus-python-telemetry-processors).
137146

138147
### Metrics
139148

@@ -238,6 +247,32 @@ Here are the exporters that OpenCensus provides mapped to the types of telemetry
238247

239248
4. The exporter will send metric data to Azure Monitor at a fixed interval. The default is every 15 seconds. We're tracking a single metric, so this metric data, with whatever value and time stamp it contains, will be sent every interval. You can find the data under `customMetrics`.
240249

250+
#### Standard metrics
251+
252+
By default, the metrics exporter will send a set of standard metrics to Azure Monitor. You can disable this by setting the `enable_standard_metrics` flag to `False` in the constructor of the metrics exporter.
253+
254+
```python
255+
...
256+
exporter = metrics_exporter.new_metrics_exporter(
257+
enable_standard_metrics=False,
258+
connection_string='InstrumentationKey=<your-instrumentation-key-here>')
259+
...
260+
```
261+
Below is a list of standard metrics that are currently sent:
262+
263+
- Available Memory (bytes)
264+
- CPU Processor Time (percentage)
265+
- Incoming Request Rate (per second)
266+
- Incoming Request Average Execution Time (milliseconds)
267+
- Outgoing Request Rate (per second)
268+
- Process CPU Usage (percentage)
269+
- Process Private Bytes (bytes)
270+
271+
You should be able to see these metrics in `performanceCounters`. Incoming request rate would be under `customMetrics`.
272+
#### Modify telemetry
273+
274+
For details on how to modify tracked telemetry before it is sent to Azure Monitor, see OpenCensus Python [telemetry processors](https://docs.microsoft.com/azure/azure-monitor/app/api-filtering-sampling#opencensus-python-telemetry-processors).
275+
241276
### Logs
242277

243278
1. First, let's generate some local log data.
@@ -357,8 +392,17 @@ Here are the exporters that OpenCensus provides mapped to the types of telemetry
357392
except Exception:
358393
logger.exception('Captured an exception.', extra=properties)
359394
```
395+
#### Sampling
396+
397+
For information on sampling in OpenCensus, take a look at [sampling in OpenCensus](sampling.md#configuring-fixed-rate-sampling-for-opencensus-python-applications).
398+
399+
#### Log correlation
400+
401+
For details on how to enrich your logs with trace context data, see OpenCensus Python [logs integration](https://docs.microsoft.com/azure/azure-monitor/app/correlation#log-correlation).
402+
403+
#### Modify telemetry
360404

361-
7. For details on how to enrich your logs with trace context data, see OpenCensus Python [logs integration](https://docs.microsoft.com/azure/azure-monitor/app/correlation#log-correlation).
405+
For details on how to modify tracked telemetry before it is sent to Azure Monitor, see OpenCensus Python [telemetry processors](https://docs.microsoft.com/azure/azure-monitor/app/api-filtering-sampling#opencensus-python-telemetry-processors).
362406

363407
## View your data with queries
364408

0 commit comments

Comments
 (0)