Microsoft Azure Monitor Opentelemetry Distro Client Library for Python
Project description
Azure Monitor Opentelemetry Distro
The Azure Monitor Distro of Opentelemetry Python provides multiple installable components available for an Opentelemetry Azure Monitor monitoring solution. It allows you to instrument your Python applications to capture and report telemetry to Azure Monitor via the Azure monitor exporters.
This distro automatically installs the following libraries:
- Azure Monitor OpenTelemetry exporters
- A subset of OpenTelemetry instrumentations that are officially supported as listed below.
Officially supported instrumentations
OpenTelemetry instrumentations allow automatic collection of requests sent from underlying instrumented libraries. The following is a list of OpenTelemetry instrumentations that come bundled in with the Azure monitor distro. If you would like to add support for another OpenTelemetry instrumentation, please submit a feature request. In the meantime, you can use the OpenTelemetry instrumentation manually via it's own APIs (i.e. instrument()
) in your code. See this for an example.
Getting started
Key Concepts
This package bundles a series of OpenTelemetry and Azure Monitor components to enable the collection and sending of telemetry to Azure Monitor. For MANUAL instrumentation, use the configure_azure_monitor
function. AUTOMATIC instrumentation is not yet supported.
The Azure Monitor OpenTelemetry exporters are the main components in accomplishing this. You will be able to use the exporters and their APIs directly through this package. Please go the exporter documentation to understand how OpenTelemetry and Azure Monitor components work in enabling telemetry collection and exporting.
Currently, all instrumentations available in OpenTelemetry are in a beta state, meaning they are not stable and may have breaking changes in the future. Efforts are being made in pushing these to a more stable state.
Prerequisites
To use this package, you must have:
- Azure subscription - Create a free account
- Azure Monitor - How to use application insights
- Opentelemetry SDK - Opentelemetry SDK for Python
- Python 3.7 or later - Install Python
Install the package
Install the Azure Monitor Opentelemetry Distro with pip:
pip install azure-monitor-opentelemetry --pre
Usage
You can use configure_azure_monitor
to set up instrumentation for your app to Azure Monitor. configure_azure_monitor
supports the following optional arguments:
Parameter | Description | Environment Variable |
---|---|---|
connection_string |
The connection string for your Application Insights resource. The connection string will be automatically populated from the APPLICATIONINSIGHTS_CONNECTION_STRING environment variable if not explicitly passed in. |
APPLICATIONINSIGHTS_CONNECTION_STRING |
You can configure further with OpenTelemetry environment variables such as:
Environment Variable | Description |
---|---|
OTEL_SERVICE_NAME, OTEL_RESOURCE_ATTRIBUTES | Specifies the OpenTelemetry resource associated with your application. |
OTEL_LOGS_EXPORTER |
If set to None , disables collection and export of logging telemetry. |
OTEL_METRICS_EXPORTER |
If set to None , disables collection and export of metric telemetry. |
OTEL_TRACES_EXPORTER |
If set to None , disables collection and export of distributed tracing telemetry. |
OTEL_BLRP_SCHEDULE_DELAY |
Specifies the logging export interval in milliseconds. Defaults to 5000. |
OTEL_BSP_SCHEDULE_DELAY |
Specifies the distributed tracing export interval in milliseconds. Defaults to 5000. |
OTEL_TRACES_SAMPLER_ARG |
Specifies the ratio of distributed tracing telemetry to be sampled. Accepted values are in the range [0,1]. Defaults to 1.0, meaning no telemetry is sampled out. |
Azure monitor OpenTelemetry Exporter configurations
You can pass Azure monitor OpenTelemetry exporter configuration parameters directly into configure_azure_monitor
. See additional configuration related to exporting here.
...
configure_azure_monitor(
connection_string="<your-connection-string>",
disable_offline_storage=True,
)
...
Samples
Samples are available here to demonstrate how to utilize the above configuration options.
Additional documentation
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 Distribution
Built Distribution
Hashes for azure-monitor-opentelemetry-1.0.0b12.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60a7918e441ae6c40a7d9fed3eb20559fd1e7ca0932c8c8fcb38f1e3efd38b24 |
|
MD5 | 2a928f63cf3e841223369e8c31eadce8 |
|
BLAKE2b-256 | ea1e17fb8c80335d4ddcea2e4dfdec187d66ba7857f037c3cec0cfc0cfe3b82c |
Hashes for azure_monitor_opentelemetry-1.0.0b12-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e79c7dd3dfce9d9f16095521f173031b55fa47fd4467a122d7b4b7a5af11d72b |
|
MD5 | 28fb6894bf50c5d2858d93de901881bd |
|
BLAKE2b-256 | ba9058da733d3d00efd5dacbcf71345d0701fe5f5dcb08b8ea1b333f7230954d |