Azure Monitor is an extensible Application Performance Management (APM) service for web developers on multiple platforms. Offered by Microsoft Azure, it’s a complete at-scale telemetry and monitoring solution.
Installing the exporter
The Azure Monitor exporter can be installed from pip by
pip install opencensus-ext-azure
Creating the exporter
To create the exporters, you’ll need to:
- Use an active Azure account, sign up for free if you haven’t already.
- Create an Azure Monitor resource and get the instrumentation key, more information can be found here.
- Put the instrumentation key in
- Create the exporters in code.
For demo purpose, the example code is using 100% sample rate. You should specify a reasonable sample rate for production environment.
from opencensus.ext.azure.trace_exporter import AzureExporter from opencensus.trace.samplers import ProbabilitySampler from opencensus.trace.tracer import Tracer tracer = Tracer(exporter=AzureExporter(), sampler=ProbabilitySampler(1.0)) with tracer.span(name='hello'): print('Hello, World!')
For more information, please refer to README.
Viewing your traces
You can view the traces by using Search, Transaction Diagnostics or Application Map.