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
{{ message }}
This repository was archived by the owner on Sep 17, 2025. It is now read-only.
You can enrich the logs with trace IDs and span IDs by using the `logging integration <../opencensus-ext-logging>`_.
42
44
@@ -73,6 +75,9 @@ You can enrich the logs with trace IDs and span IDs by using the `logging integr
73
75
logger.warning('In the span')
74
76
logger.warning('After the span')
75
77
78
+
Custom Properties
79
+
#################
80
+
76
81
You can also add custom properties to your log messages in the *extra* keyword argument using the custom_dimensions field.
77
82
78
83
WARNING: For this feature to work, you need to pass a dictionary to the custom_dimensions field. If you pass arguments of any other type, the logger will ignore them.
@@ -89,6 +94,34 @@ WARNING: For this feature to work, you need to pass a dictionary to the custom_d
* You can pass a callback function to the exporter to process telemetry before it is exported.
101
+
* Your callback function can return `False` if you do not want this envelope exported.
102
+
* Your callback function must accept an [envelope](https://github.com/census-instrumentation/opencensus-python/blob/master/contrib/opencensus-ext-azure/opencensus/ext/azure/common/protocol.py#L86) data type as its parameter.
103
+
* You can see the schema for Azure Monitor data types in the envelopes [here](https://github.com/census-instrumentation/opencensus-python/blob/master/contrib/opencensus-ext-azure/opencensus/ext/azure/common/protocol.py).
104
+
* The `AzureLogHandler` handles `ExceptionData` and `MessageData` data types.
105
+
106
+
.. code:: python
107
+
108
+
import logging
109
+
110
+
from opencensus.ext.azure.log_exporter import AzureLogHandler
111
+
112
+
logger = logging.getLogger(__name__)
113
+
114
+
# Callback function to append '_hello' to each log message telemetry
@@ -145,6 +178,9 @@ The **Azure Monitor Metrics Exporter** allows you to export metrics to `Azure Mo
145
178
if__name__=="__main__":
146
179
main()
147
180
181
+
Standard Metrics
182
+
################
183
+
148
184
The exporter also includes a set of standard metrics that are exported to Azure Monitor by default.
149
185
150
186
.. code:: python
@@ -179,6 +215,67 @@ Below is a list of standard metrics that are currently available:
179
215
- Process CPU Usage (percentage)
180
216
- Process Private Bytes (bytes)
181
217
218
+
Modifying Metrics
219
+
#################
220
+
221
+
* You can pass a callback function to the exporter to process telemetry before it is exported.
222
+
* Your callback function can return `False` if you do not want this envelope exported.
223
+
* Your callback function must accept an [envelope](https://github.com/census-instrumentation/opencensus-python/blob/master/contrib/opencensus-ext-azure/opencensus/ext/azure/common/protocol.py#L86) data type as its parameter.
224
+
* You can see the schema for Azure Monitor data types in the envelopes [here](https://github.com/census-instrumentation/opencensus-python/blob/master/contrib/opencensus-ext-azure/opencensus/ext/azure/common/protocol.py).
225
+
* The `MetricsExporter` handles `MetricData` data types.
226
+
227
+
.. code:: python
228
+
229
+
import time
230
+
231
+
from opencensus.ext.azure import metrics_exporter
232
+
from opencensus.stats import aggregation as aggregation_module
233
+
from opencensus.stats import measure as measure_module
234
+
from opencensus.stats import stats as stats_module
235
+
from opencensus.stats import view as view_module
236
+
from opencensus.tags import tag_map as tag_map_module
OpenCensus also supports several `integrations <https://github.com/census-instrumentation/opencensus-python#integration>`_ which allows OpenCensus to integrate with third party libraries.
208
310
209
311
This example shows how to integrate with the `requests <https://2.python-requests.org/en/master/>`_ library.
@@ -225,14 +327,45 @@ This example shows how to integrate with the `requests <https://2.python-request
* You can pass a callback function to the exporter to process telemetry before it is exported.
341
+
* Your callback function can return `False` if you do not want this envelope exported.
342
+
* Your callback function must accept an [envelope](https://github.com/census-instrumentation/opencensus-python/blob/master/contrib/opencensus-ext-azure/opencensus/ext/azure/common/protocol.py#L86) data type as its parameter.
343
+
* You can see the schema for Azure Monitor data types in the envelopes [here](https://github.com/census-instrumentation/opencensus-python/blob/master/contrib/opencensus-ext-azure/opencensus/ext/azure/common/protocol.py).
344
+
* The `AzureExporter` handles `Data` data types.
345
+
346
+
.. code:: python
347
+
348
+
import requests
349
+
350
+
from opencensus.ext.azure.trace_exporter import AzureExporter
351
+
from opencensus.trace import config_integration
352
+
from opencensus.trace.samplers import ProbabilitySampler
0 commit comments