Skip to content

Latest commit

 

History

History
106 lines (75 loc) · 3.37 KB

File metadata and controls

106 lines (75 loc) · 3.37 KB
page_type sample
languages
python
products
azure-opentelemetry-exporter-azuremonitor

Microsoft Azure Monitor Opentelemetry Exporter Python Samples

These code samples show common champion scenario operations with the AzureMonitorTraceExporter.

Installation

$ pip install azure-opentelemetry-exporter-azuremonitor --pre

Run the Applications

Trace

  • Update APPLICATIONINSIGHTS_CONNECTION_STRING environment variable

  • Run the sample

$ # from this directory
$ python sample_trace.py

Client

  • Update APPLICATIONINSIGHTS_CONNECTION_STRING environment variable

  • Run the sample

$ pip install opentelemetry-instrumentation-requests
$ # from this directory
$ python sample_request.py

Server

  • Update APPLICATIONINSIGHTS_CONNECTION_STRING environment variable

  • Run the sample

$ pip install opentelemetry-instrumentation-requests
$ pip install opentelemetry-instrumentation-flask
$ # from this directory
$ python sample_server.py

Azure Service Bus Send

The following sample assumes that you have setup an Azure Service Bus namespace.

  • Update APPLICATIONINSIGHTS_CONNECTION_STRING environment variable

  • Update SERVICE_BUS_CONN_STR environment variable

  • Update SERVICE_BUS_QUEUE_NAME environment variable

  • Run the sample

$ # azure-servicebus library
$ pip install azure-servicebus
$ # azure sdk core tracing library for opentelemetry
$ pip install azure-core-tracing-opentelemetry
$ # from this directory
$ python sample_servicebus_send.py

Azure Service Bus Receive

The following sample assumes that you have setup an Azure Service Bus namespace.

  • Update APPLICATIONINSIGHTS_CONNECTION_STRING environment variable

  • Update SERVICE_BUS_CONN_STR environment variable

  • Update SERVICE_BUS_QUEUE_NAME environment variable

  • Run the sample

$ # azure-servicebus library
$ pip install azure-servicebus
$ # azure sdk core tracing library for opentelemetry
$ pip install azure-core-tracing-opentelemetry
$ # from this directory
$ python sample_servicebus_receive.py

Explore the data

After running the applications, data would be available in Azure