OpenCensus Azure Monitor Exporter
Project description
Installation
pip install opencensus-ext-azure
Usage
Trace
The Azure Monitor Trace Exporter allows you to export OpenCensus traces to Azure Monitor.
This example shows how to send a span “hello” to Azure Monitor.
Create an Azure Monitor resource and get the instrumentation key, more information can be found here.
Put the instrumentation key in APPINSIGHTS_INSTRUMENTATIONKEY environment variable.
from opencensus.ext.azure.trace_exporter import AzureExporter
from opencensus.trace import tracer as tracer_module
tracer = tracer_module.Tracer(exporter=AzureExporter())
with tracer.span(name='hello'):
print('Hello, World!')
You can also specify the instrumentation key explicitly in the code.
import requests
from opencensus.ext.azure.common import Options
from opencensus.ext.azure.trace_exporter import AzureExporter
from opencensus.trace import config_integration
from opencensus.trace.tracer import Tracer
if __name__ == '__main__':
config_integration.trace_integrations(['requests'])
tracer = Tracer(exporter=AzureExporter(Options(
# TODO: replace this with your own instrumentation key.
instrumentation_key='00000000-0000-0000-0000-000000000000',
timeout=29.9,
)))
with tracer.span(name='parent'):
response = requests.get(url='https://www.wikipedia.org/wiki/Rabbit')
References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for opencensus_ext_azure-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3cf3cb9fe96c9ec66046d19843eb725f8b926450385cd2be4ae29447ce3f9001 |
|
MD5 | 0cd8c5bf690444f2649203bdc6aff4b5 |
|
BLAKE2b-256 | f959fb2b674d4d55c8c52bd3f236364b1c7b56e21440a40fd4073e048e76da40 |