Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Changelog

## Unreleased

- Added OpenTelemetry Distro and Configurator
([#187](https://github.com/microsoft/ApplicationInsights-Python/pull/187))
- Initial commit
9 changes: 8 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,14 @@ packages=find_namespace:
zip_safe = False
include_package_data = True
install_requires =
azure-monitor-opentelemetry-exporter == 1.0.0b6
azure-monitor-opentelemetry-exporter == 1.0.0b7
opentelemetry-instrumentation == 0.32b0

[options.packages.find]
where = src

[options.entry_points]
opentelemetry_distro =
azure_monitor_opentelemetry_distro = azure.monitor.opentelemetry.distro.distro:AzureMonitorDistro
opentelemetry_configurator =
azure_monitor_opentelemetry_configurator = azure.monitor.opentelemetry.distro.configurator:AzureMonitorConfigurator
11 changes: 11 additions & 0 deletions src/azure/monitor/opentelemetry/distro/configurator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License in the project root for
# license information.
# --------------------------------------------------------------------------

from opentelemetry.sdk._configuration import _OTelSDKConfigurator


class AzureMonitorConfigurator(_OTelSDKConfigurator):
pass
21 changes: 21 additions & 0 deletions src/azure/monitor/opentelemetry/distro/distro.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License in the project root for
# license information.
# --------------------------------------------------------------------------

from os import environ

from opentelemetry.environment_variables import (OTEL_METRICS_EXPORTER,
OTEL_TRACES_EXPORTER)
from opentelemetry.instrumentation.distro import BaseDistro


class AzureMonitorDistro(BaseDistro):
def _configure(self, **kwargs):
# TODO: Uncomment when logging is out of preview
# environ.setdefault(OTEL_LOGS_EXPORTER, "azure_monitor_opentelemetry_exporter")
environ.setdefault(
OTEL_METRICS_EXPORTER, "azure_monitor_opentelemetry_exporter"
)
environ.setdefault(OTEL_TRACES_EXPORTER, "azure_monitor_opentelemetry_exporter")
1 change: 0 additions & 1 deletion test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
pytest
azure-monitor-opentelemetry-exporter
3 changes: 3 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ recreate = True
deps =
-r lint-requirements.txt

commands_pre =
python -m pip install -e {toxinidir}

commands =
black src
isort --recursive src
Expand Down