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.
The **Azure Monitor Trace Exporter** allows you to export `OpenCensus`_ traces to `Azure Monitor`_.
23
-
24
-
This example shows how to send a span "hello" to Azure Monitor.
25
-
26
-
* Create an Azure Monitor resource and get the instrumentation key, more information can be found `here <https://docs.microsoft.com/azure/azure-monitor/app/create-new-resource>`_.
27
-
* Put the instrumentation key in ``APPINSIGHTS_INSTRUMENTATIONKEY`` environment variable.
28
-
29
-
.. code:: python
30
-
31
-
from opencensus.ext.azure.trace_exporter import AzureExporter
32
-
from opencensus.trace.samplers import ProbabilitySampler
You can also specify the instrumentation key explicitly in the code.
41
-
42
-
* Create an Azure Monitor resource and get the instrumentation key, more information can be found `here <https://docs.microsoft.com/azure/azure-monitor/app/create-new-resource>`_.
43
-
* Install the `requests integration package <../opencensus-ext-requests>`_ using ``pip install opencensus-ext-requests``.
44
-
* Put the instrumentation key in the following code.
45
-
46
-
.. code:: python
47
-
48
-
import requests
49
-
50
-
from opencensus.ext.azure.trace_exporter import AzureExporter
51
-
from opencensus.trace import config_integration
52
-
from opencensus.trace.samplers import ProbabilitySampler
@@ -72,6 +25,7 @@ This example shows how to send a warning level log to Azure Monitor.
72
25
73
26
* Create an Azure Monitor resource and get the instrumentation key, more information can be found `here <https://docs.microsoft.com/azure/azure-monitor/app/create-new-resource>`_.
74
27
* Put the instrumentation key in ``APPINSIGHTS_INSTRUMENTATIONKEY`` environment variable.
28
+
* You can also specify the instrumentation key explicitly in the code, which will take priority over a set environment variable.
75
29
76
30
.. code:: python
77
31
@@ -88,6 +42,7 @@ You can enrich the logs with trace IDs and span IDs by using the `logging integr
88
42
* Create an Azure Monitor resource and get the instrumentation key, more information can be found `here <https://docs.microsoft.com/azure/azure-monitor/app/create-new-resource>`_.
89
43
* Install the `logging integration package <../opencensus-ext-logging>`_ using ``pip install opencensus-ext-logging``.
90
44
* Put the instrumentation key in ``APPINSIGHTS_INSTRUMENTATIONKEY`` environment variable.
45
+
* You can also specify the instrumentation key explicitly in the code, which will take priority over a set environment variable.
91
46
92
47
.. code:: python
93
48
@@ -114,6 +69,113 @@ You can enrich the logs with trace IDs and span IDs by using the `logging integr
114
69
logger.warning('In the span')
115
70
logger.warning('After the span')
116
71
72
+
Metrics
73
+
~~~~~~~
74
+
75
+
The **OpenCensus Azure Monitor Metrics Exporter** allows you to export metrics to `Azure Monitor`_.
76
+
77
+
* Create an Azure Monitor resource and get the instrumentation key, more information can be found `here <https://docs.microsoft.com/azure/azure-monitor/app/create-new-resource>`_.
78
+
* Put the instrumentation key in ``APPINSIGHTS_INSTRUMENTATIONKEY`` environment variable.
79
+
* You can also specify the instrumentation key explicitly in the code, which will take priority over a set environment variable.
80
+
81
+
Using the Metrics exporter
82
+
*****************************
83
+
84
+
.. code:: python
85
+
86
+
import time
87
+
88
+
from opencensus.ext.azure import metrics_exporter
89
+
from opencensus.stats import aggregation as aggregation_module
90
+
from opencensus.stats import measure as measure_module
91
+
from opencensus.stats import stats as stats_module
92
+
from opencensus.stats import view as view_module
93
+
from opencensus.tags import tag_map as tag_map_module
The **Azure Monitor Trace Exporter** allows you to export `OpenCensus`_ traces to `Azure Monitor`_.
133
+
134
+
This example shows how to send a span "hello" to Azure Monitor.
135
+
136
+
* Create an Azure Monitor resource and get the instrumentation key, more information can be found `here <https://docs.microsoft.com/azure/azure-monitor/app/create-new-resource>`_.
137
+
* Put the instrumentation key in ``APPINSIGHTS_INSTRUMENTATIONKEY`` environment variable.
138
+
* You can also specify the instrumentation key explicitly in the code, which will take priority over a set environment variable.
139
+
140
+
.. code:: python
141
+
142
+
from opencensus.ext.azure.trace_exporter import AzureExporter
143
+
from opencensus.trace.samplers import ProbabilitySampler
You can also specify the instrumentation key explicitly in the code.
152
+
153
+
* Create an Azure Monitor resource and get the instrumentation key, more information can be found `here <https://docs.microsoft.com/azure/azure-monitor/app/create-new-resource>`_.
154
+
* Install the `requests integration package <../opencensus-ext-requests>`_ using ``pip install opencensus-ext-requests``.
155
+
* Put the instrumentation key in ``APPINSIGHTS_INSTRUMENTATIONKEY`` environment variable.
156
+
* You can also specify the instrumentation key explicitly in the code, which will take priority over a set environment variable.
157
+
158
+
.. code:: python
159
+
160
+
import requests
161
+
162
+
from opencensus.ext.azure.trace_exporter import AzureExporter
163
+
from opencensus.trace import config_integration
164
+
from opencensus.trace.samplers import ProbabilitySampler
0 commit comments