Skip to main content

OpenCensus Azure Monitor Exporter

Project description

pypi

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


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

opencensus_ext_azure-0.1.0-py2.py3-none-any.whl (8.6 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page