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/opencensus-python.md
+23-2Lines changed: 23 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -268,7 +268,8 @@ Below is a list of standard metrics that are currently sent:
268
268
- Process CPU Usage (percentage)
269
269
- Process Private Bytes (bytes)
270
270
271
-
You should be able to see these metrics in`performanceCounters`. Incoming request rate would be under `customMetrics`.
271
+
You should be able to see these metrics in`performanceCounters`. Incoming request rate would be under `customMetrics`. For more information, see [performance counters](https://docs.microsoft.com/azure/azure-monitor/app/performance-counters).
272
+
272
273
#### Modify telemetry
273
274
274
275
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).
@@ -385,13 +386,33 @@ For details on how to modify tracked telemetry before it is sent to Azure Monito
385
386
386
387
# Use properties in logging statements
387
388
logger.warning('action', extra=properties)
389
+
```
390
+
391
+
#### Sending exceptions
392
+
393
+
OpenCensus Python does not automatically track and send `exception` telemetry. They are sent through the `AzureLogHandler` by using exceptions through the Python logging library. You can add custom properties just like with normal logging.
394
+
395
+
```python
396
+
import logging
397
+
398
+
from opencensus.ext.azure.log_exporter import AzureLogHandler
399
+
400
+
logger= logging.getLogger(__name__)
401
+
#TODO: replace the all-zero GUID with your instrumentation key.
logger.exception('Captured an exception.', extra=properties)
412
+
logger.exception('Captured an exception.', extra=properties)
394
413
```
414
+
Since you must log exceptions explicitly, it is up to the user in how they want to log unhandled exceptions. OpenCensus does not place restrictions in how a user wants to do this, aslongas they explicitly log an exception telemetry.
415
+
395
416
#### Sampling
396
417
397
418
For information on sampling in OpenCensus, take a look at [sampling in OpenCensus](sampling.md#configuring-fixed-rate-sampling-for-opencensus-python-applications).
0 commit comments