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.
Copy file name to clipboardExpand all lines: contrib/opencensus-ext-azure/README.rst
+29-20Lines changed: 29 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,8 +24,8 @@ The **Azure Monitor Log Handler** allows you to export Python logs to `Azure Mon
24
24
This example shows how to send a warning level log to Azure Monitor.
25
25
26
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
-
* You can also specify the instrumentation key explicitly in the code, which will take priority over a set environment variable.
27
+
* Place your instrumentation key in a `connection string` and directly into your code.
28
+
* Alternatively, you can specify your `connection string` in an environment variable ``APPLICATIONINSIGHTS_CONNECTION_STRING``.
29
29
30
30
.. code:: python
31
31
@@ -34,15 +34,16 @@ This example shows how to send a warning level log to Azure Monitor.
34
34
from opencensus.ext.azure.log_exporter import AzureLogHandler
* Alternatively, you can specify your `connection string` in an environment variable ``APPLICATIONINSIGHTS_CONNECTION_STRING``.
41
+
40
42
You can enrich the logs with trace IDs and span IDs by using the `logging integration <../opencensus-ext-logging>`_.
41
43
42
44
* 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 `logging integration package <../opencensus-ext-logging>`_ using ``pip install opencensus-ext-logging``.
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.
45
+
* Place your instrumentation key in a `connection string` and directly into your code.
46
+
* Alternatively, you can specify your `connection string` in an environment variable ``APPLICATIONINSIGHTS_CONNECTION_STRING``.
46
47
47
48
.. code:: python
48
49
@@ -58,25 +59,28 @@ You can enrich the logs with trace IDs and span IDs by using the `logging integr
The **Azure Monitor Metrics Exporter** allows you to export metrics to `Azure Monitor`_.
76
80
77
81
* 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.
82
+
* Place your instrumentation key in a `connection string` and directly into your code.
83
+
* Alternatively, you can specify your `connection string` in an environment variable ``APPLICATIONINSIGHTS_CONNECTION_STRING``.
80
84
81
85
.. code:: python
82
86
@@ -105,7 +109,7 @@ The **Azure Monitor Metrics Exporter** allows you to export metrics to `Azure Mo
105
109
defmain():
106
110
# Enable metrics
107
111
# Set the interval in seconds in which you want to send metrics
@@ -167,26 +171,31 @@ The **Azure Monitor Trace Exporter** allows you to export `OpenCensus`_ traces t
167
171
This example shows how to send a span "hello" to Azure Monitor.
168
172
169
173
* 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>`_.
170
-
* Put the instrumentation key in ``APPINSIGHTS_INSTRUMENTATIONKEY`` environment variable.
171
-
* You can also specify the instrumentation key explicitly in the code, which will take priority over a set environment variable.
174
+
* Place your instrumentation key in a `connection string` and directly into your code.
175
+
* Alternatively, you can specify your `connection string` in an environment variable ``APPLICATIONINSIGHTS_CONNECTION_STRING``.
172
176
173
-
.. code:: python
177
+
.. code:: python
174
178
175
179
from opencensus.ext.azure.trace_exporter import AzureExporter
176
180
from opencensus.trace.samplers import ProbabilitySampler
You can also specify the instrumentation key explicitly in the code.
191
+
OpenCensus also supports several [integrations](https://github.com/census-instrumentation/opencensus-python#integration) which allows OpenCensus to integrate with third party libraries.
192
+
193
+
This example shows how to integrate with the [requests](https://2.python-requests.org/en/master/) library.
185
194
186
195
* 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>`_.
187
196
* Install the `requests integration package <../opencensus-ext-requests>`_ using ``pip install opencensus-ext-requests``.
188
-
* Put the instrumentation key in ``APPINSIGHTS_INSTRUMENTATIONKEY`` environment variable.
189
-
* You can also specify the instrumentation key explicitly in the code, which will take priority over a set environment variable.
197
+
* Place your instrumentation key in a `connection string` and directly into your code.
198
+
* Alternatively, you can specify your `connection string` in an environment variable ``APPLICATIONINSIGHTS_CONNECTION_STRING``.
0 commit comments