diff --git a/CHANGELOG.md b/CHANGELOG.md index cb7ed8ce..3cee4b8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,8 @@ ([#244](https://github.com/microsoft/ApplicationInsights-Python/pull/244)) - Replace service.X configurations with Resource ([#246](https://github.com/microsoft/ApplicationInsights-Python/pull/246)) +- Change namespace to `azure.monitor.opentelemtry` + ([#247](https://github.com/microsoft/ApplicationInsights-Python/pull/247)) ## [1.0.0b8](https://github.com/microsoft/ApplicationInsights-Python/releases/tag/v1.0.0b8) - 2022-09-26 diff --git a/azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/_diagnostics/__init__.py b/azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/_diagnostics/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/azure-monitor-opentelemetry-distro/README.md b/azure-monitor-opentelemetry/README.md similarity index 96% rename from azure-monitor-opentelemetry-distro/README.md rename to azure-monitor-opentelemetry/README.md index 2d3f05c1..231b63aa 100644 --- a/azure-monitor-opentelemetry-distro/README.md +++ b/azure-monitor-opentelemetry/README.md @@ -1,6 +1,6 @@ # Azure Monitor Opentelemetry Distro -Azure Monitor Distro of [Opentelemetry Python][ot_sdk_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. +The Azure Monitor Distro of [Opentelemetry Python][ot_sdk_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: @@ -20,7 +20,7 @@ The [Azure Monitor OpenTelemetry exporters][azure_monitor_opentelemetry_exporter 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: +### Prerequisites To use this package, you must have: diff --git a/azure-monitor-opentelemetry-distro/azure/__init__.py b/azure-monitor-opentelemetry/azure/__init__.py similarity index 100% rename from azure-monitor-opentelemetry-distro/azure/__init__.py rename to azure-monitor-opentelemetry/azure/__init__.py diff --git a/azure-monitor-opentelemetry-distro/azure/monitor/__init__.py b/azure-monitor-opentelemetry/azure/monitor/__init__.py similarity index 100% rename from azure-monitor-opentelemetry-distro/azure/monitor/__init__.py rename to azure-monitor-opentelemetry/azure/monitor/__init__.py diff --git a/azure-monitor-opentelemetry/azure/monitor/opentelemetry/__init__.py b/azure-monitor-opentelemetry/azure/monitor/opentelemetry/__init__.py new file mode 100644 index 00000000..94ea6fed --- /dev/null +++ b/azure-monitor-opentelemetry/azure/monitor/opentelemetry/__init__.py @@ -0,0 +1,14 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License in the project root for +# license information. +# ------------------------------------------------------------------------- + +from azure.monitor.opentelemetry._configure import configure_azure_monitor + +from ._version import VERSION + +__all__ = [ + "configure_azure_monitor", +] +__version__ = VERSION diff --git a/azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/__init__.py b/azure-monitor-opentelemetry/azure/monitor/opentelemetry/_configure.py similarity index 98% rename from azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/__init__.py rename to azure-monitor-opentelemetry/azure/monitor/opentelemetry/_configure.py index 32a8c665..c9893e9a 100644 --- a/azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/__init__.py +++ b/azure-monitor-opentelemetry/azure/monitor/opentelemetry/_configure.py @@ -7,14 +7,14 @@ from logging import NOTSET, getLogger from typing import Dict -from azure.monitor.opentelemetry.distro._types import ConfigurationValue -from azure.monitor.opentelemetry.distro.util import _get_configurations +from azure.monitor.opentelemetry._types import ConfigurationValue from azure.monitor.opentelemetry.exporter import ( ApplicationInsightsSampler, AzureMonitorLogExporter, AzureMonitorMetricExporter, AzureMonitorTraceExporter, ) +from azure.monitor.opentelemetry.util import _get_configurations from opentelemetry._logs import get_logger_provider, set_logger_provider from opentelemetry.metrics import set_meter_provider from opentelemetry.sdk._logs import LoggerProvider, LoggingHandler diff --git a/azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/_constants.py b/azure-monitor-opentelemetry/azure/monitor/opentelemetry/_constants.py similarity index 100% rename from azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/_constants.py rename to azure-monitor-opentelemetry/azure/monitor/opentelemetry/_constants.py diff --git a/azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/_types.py b/azure-monitor-opentelemetry/azure/monitor/opentelemetry/_types.py similarity index 100% rename from azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/_types.py rename to azure-monitor-opentelemetry/azure/monitor/opentelemetry/_types.py diff --git a/azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/_version.py b/azure-monitor-opentelemetry/azure/monitor/opentelemetry/_version.py similarity index 100% rename from azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/_version.py rename to azure-monitor-opentelemetry/azure/monitor/opentelemetry/_version.py diff --git a/azure-monitor-opentelemetry/azure/monitor/opentelemetry/autoinstrumentation/__init__.py b/azure-monitor-opentelemetry/azure/monitor/opentelemetry/autoinstrumentation/__init__.py new file mode 100644 index 00000000..dcc72b25 --- /dev/null +++ b/azure-monitor-opentelemetry/azure/monitor/opentelemetry/autoinstrumentation/__init__.py @@ -0,0 +1,5 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License in the project root for +# license information. +# ------------------------------------------------------------------------- diff --git a/azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/_configurator.py b/azure-monitor-opentelemetry/azure/monitor/opentelemetry/autoinstrumentation/_configurator.py similarity index 92% rename from azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/_configurator.py rename to azure-monitor-opentelemetry/azure/monitor/opentelemetry/autoinstrumentation/_configurator.py index cd83f70f..d7da88d3 100644 --- a/azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/_configurator.py +++ b/azure-monitor-opentelemetry/azure/monitor/opentelemetry/autoinstrumentation/_configurator.py @@ -7,7 +7,7 @@ import logging -from azure.monitor.opentelemetry.distro._diagnostics._diagnostic_logging import ( +from azure.monitor.opentelemetry.diagnostics._diagnostic_logging import ( AzureDiagnosticLogging, ) from opentelemetry.sdk._configuration import _OTelSDKConfigurator diff --git a/azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/_distro.py b/azure-monitor-opentelemetry/azure/monitor/opentelemetry/autoinstrumentation/_distro.py similarity index 94% rename from azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/_distro.py rename to azure-monitor-opentelemetry/azure/monitor/opentelemetry/autoinstrumentation/_distro.py index e084c41f..166b4c22 100644 --- a/azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/_distro.py +++ b/azure-monitor-opentelemetry/azure/monitor/opentelemetry/autoinstrumentation/_distro.py @@ -6,10 +6,10 @@ import logging from os import environ -from azure.monitor.opentelemetry.distro._diagnostics._diagnostic_logging import ( +from azure.monitor.opentelemetry.diagnostics._diagnostic_logging import ( AzureDiagnosticLogging, ) -from azure.monitor.opentelemetry.distro._diagnostics._status_logger import ( +from azure.monitor.opentelemetry.diagnostics._status_logger import ( AzureStatusLogger, ) from opentelemetry.environment_variables import ( diff --git a/azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/__init__.py b/azure-monitor-opentelemetry/azure/monitor/opentelemetry/diagnostics/__init__.py similarity index 100% rename from azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/__init__.py rename to azure-monitor-opentelemetry/azure/monitor/opentelemetry/diagnostics/__init__.py diff --git a/azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/_diagnostics/_diagnostic_logging.py b/azure-monitor-opentelemetry/azure/monitor/opentelemetry/diagnostics/_diagnostic_logging.py similarity index 96% rename from azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/_diagnostics/_diagnostic_logging.py rename to azure-monitor-opentelemetry/azure/monitor/opentelemetry/diagnostics/_diagnostic_logging.py index e28826fe..6803c9c4 100644 --- a/azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/_diagnostics/_diagnostic_logging.py +++ b/azure-monitor-opentelemetry/azure/monitor/opentelemetry/diagnostics/_diagnostic_logging.py @@ -9,14 +9,14 @@ from os import makedirs from os.path import exists, join -from azure.monitor.opentelemetry.distro._constants import ( +from azure.monitor.opentelemetry._constants import ( _CUSTOMER_IKEY, _EXTENSION_VERSION, _IS_DIAGNOSTICS_ENABLED, _env_var_or_default, _get_log_path, ) -from azure.monitor.opentelemetry.distro._version import VERSION +from azure.monitor.opentelemetry._version import VERSION _DIAGNOSTIC_LOGGER_FILE_NAME = "applicationinsights-extension.log" _SITE_NAME = _env_var_or_default("WEBSITE_SITE_NAME") diff --git a/azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/_diagnostics/_status_logger.py b/azure-monitor-opentelemetry/azure/monitor/opentelemetry/diagnostics/_status_logger.py similarity index 93% rename from azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/_diagnostics/_status_logger.py rename to azure-monitor-opentelemetry/azure/monitor/opentelemetry/diagnostics/_status_logger.py index 574ec64f..7cc42d64 100644 --- a/azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/_diagnostics/_status_logger.py +++ b/azure-monitor-opentelemetry/azure/monitor/opentelemetry/diagnostics/_status_logger.py @@ -9,13 +9,13 @@ from os.path import exists, join from platform import node -from azure.monitor.opentelemetry.distro._constants import ( +from azure.monitor.opentelemetry._constants import ( _CUSTOMER_IKEY, _EXTENSION_VERSION, _IS_DIAGNOSTICS_ENABLED, _get_log_path, ) -from azure.monitor.opentelemetry.distro._version import VERSION +from azure.monitor.opentelemetry._version import VERSION _MACHINE_NAME = node() _STATUS_LOG_PATH = _get_log_path(status_log_path=True) diff --git a/azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/util/__init__.py b/azure-monitor-opentelemetry/azure/monitor/opentelemetry/util/__init__.py similarity index 88% rename from azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/util/__init__.py rename to azure-monitor-opentelemetry/azure/monitor/opentelemetry/util/__init__.py index 87090feb..44d2c5d0 100644 --- a/azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/util/__init__.py +++ b/azure-monitor-opentelemetry/azure/monitor/opentelemetry/util/__init__.py @@ -6,7 +6,7 @@ from typing import Dict -from azure.monitor.opentelemetry.distro._types import ConfigurationValue +from azure.monitor.opentelemetry._types import ConfigurationValue def _get_configurations(**kwargs) -> Dict[str, ConfigurationValue]: diff --git a/azure-monitor-opentelemetry-distro/samples/logging/correlated_logs.py b/azure-monitor-opentelemetry/samples/logging/correlated_logs.py similarity index 92% rename from azure-monitor-opentelemetry-distro/samples/logging/correlated_logs.py rename to azure-monitor-opentelemetry/samples/logging/correlated_logs.py index 9a77eb73..e37cbddc 100644 --- a/azure-monitor-opentelemetry-distro/samples/logging/correlated_logs.py +++ b/azure-monitor-opentelemetry/samples/logging/correlated_logs.py @@ -6,7 +6,7 @@ from logging import WARNING, getLogger -from azure.monitor.opentelemetry.distro import configure_azure_monitor +from azure.monitor.opentelemetry import configure_azure_monitor from opentelemetry import trace configure_azure_monitor( @@ -28,3 +28,5 @@ logger.info("Correlated info log") logger.warning("Correlated warning log") logger.error("Correlated error log") + +input() diff --git a/azure-monitor-opentelemetry-distro/samples/logging/custom_properties.py b/azure-monitor-opentelemetry/samples/logging/custom_properties.py similarity index 90% rename from azure-monitor-opentelemetry-distro/samples/logging/custom_properties.py rename to azure-monitor-opentelemetry/samples/logging/custom_properties.py index fbeab14e..76d88a48 100644 --- a/azure-monitor-opentelemetry-distro/samples/logging/custom_properties.py +++ b/azure-monitor-opentelemetry/samples/logging/custom_properties.py @@ -6,7 +6,7 @@ from logging import DEBUG, getLogger -from azure.monitor.opentelemetry.distro import configure_azure_monitor +from azure.monitor.opentelemetry import configure_azure_monitor configure_azure_monitor( connection_string="", @@ -21,3 +21,5 @@ # Pass custom properties in a dictionary with the extra argument logger.debug("DEBUG: Debug with properties", extra={"debug": "true"}) + +input() diff --git a/azure-monitor-opentelemetry-distro/samples/logging/exception_logs.py b/azure-monitor-opentelemetry/samples/logging/exception_logs.py similarity index 92% rename from azure-monitor-opentelemetry-distro/samples/logging/exception_logs.py rename to azure-monitor-opentelemetry/samples/logging/exception_logs.py index a46ea979..d53cff6a 100644 --- a/azure-monitor-opentelemetry-distro/samples/logging/exception_logs.py +++ b/azure-monitor-opentelemetry/samples/logging/exception_logs.py @@ -6,7 +6,7 @@ from logging import WARNING, getLogger -from azure.monitor.opentelemetry.distro import configure_azure_monitor +from azure.monitor.opentelemetry import configure_azure_monitor configure_azure_monitor( connection_string="", @@ -31,3 +31,5 @@ print(val) except ZeroDivisionError: logger.error("Error: Division by zero", stack_info=True, exc_info=True) + +input() diff --git a/azure-monitor-opentelemetry-distro/samples/logging/logs_with_traces.py b/azure-monitor-opentelemetry/samples/logging/logs_with_traces.py similarity index 94% rename from azure-monitor-opentelemetry-distro/samples/logging/logs_with_traces.py rename to azure-monitor-opentelemetry/samples/logging/logs_with_traces.py index f332a5a9..be029ec6 100644 --- a/azure-monitor-opentelemetry-distro/samples/logging/logs_with_traces.py +++ b/azure-monitor-opentelemetry/samples/logging/logs_with_traces.py @@ -7,7 +7,7 @@ from logging import WARNING, getLogger import flask -from azure.monitor.opentelemetry.distro import configure_azure_monitor +from azure.monitor.opentelemetry import configure_azure_monitor configure_azure_monitor( connection_string="", diff --git a/azure-monitor-opentelemetry-distro/samples/logging/simple.py b/azure-monitor-opentelemetry/samples/logging/simple.py similarity index 92% rename from azure-monitor-opentelemetry-distro/samples/logging/simple.py rename to azure-monitor-opentelemetry/samples/logging/simple.py index 1c41b1d8..ee0f175c 100644 --- a/azure-monitor-opentelemetry-distro/samples/logging/simple.py +++ b/azure-monitor-opentelemetry/samples/logging/simple.py @@ -6,7 +6,7 @@ from logging import WARNING, getLogger -from azure.monitor.opentelemetry.distro import configure_azure_monitor +from azure.monitor.opentelemetry import configure_azure_monitor from opentelemetry.sdk.resources import Resource, ResourceAttributes configure_azure_monitor( diff --git a/azure-monitor-opentelemetry-distro/samples/metrics/attributes.py b/azure-monitor-opentelemetry/samples/metrics/attributes.py similarity index 92% rename from azure-monitor-opentelemetry-distro/samples/metrics/attributes.py rename to azure-monitor-opentelemetry/samples/metrics/attributes.py index 2e566be1..6496ddab 100644 --- a/azure-monitor-opentelemetry-distro/samples/metrics/attributes.py +++ b/azure-monitor-opentelemetry/samples/metrics/attributes.py @@ -1,6 +1,7 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. -from azure.monitor.opentelemetry.distro import configure_azure_monitor + +from azure.monitor.opentelemetry import configure_azure_monitor from opentelemetry import metrics # Configure Azure monitor collection telemetry pipeline diff --git a/azure-monitor-opentelemetry-distro/samples/metrics/instruments.py b/azure-monitor-opentelemetry/samples/metrics/instruments.py similarity index 96% rename from azure-monitor-opentelemetry-distro/samples/metrics/instruments.py rename to azure-monitor-opentelemetry/samples/metrics/instruments.py index 461916d6..82bd5d11 100644 --- a/azure-monitor-opentelemetry-distro/samples/metrics/instruments.py +++ b/azure-monitor-opentelemetry/samples/metrics/instruments.py @@ -2,7 +2,7 @@ # Licensed under the MIT License. from typing import Iterable -from azure.monitor.opentelemetry.distro import configure_azure_monitor +from azure.monitor.opentelemetry import configure_azure_monitor from opentelemetry import metrics from opentelemetry.metrics import CallbackOptions, Observation from opentelemetry.sdk.resources import Resource, ResourceAttributes diff --git a/azure-monitor-opentelemetry-distro/samples/metrics/views.py b/azure-monitor-opentelemetry/samples/metrics/views.py similarity index 93% rename from azure-monitor-opentelemetry-distro/samples/metrics/views.py rename to azure-monitor-opentelemetry/samples/metrics/views.py index e9f38910..2eb3925c 100644 --- a/azure-monitor-opentelemetry-distro/samples/metrics/views.py +++ b/azure-monitor-opentelemetry/samples/metrics/views.py @@ -1,6 +1,6 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. -from azure.monitor.opentelemetry.distro import configure_azure_monitor +from azure.monitor.opentelemetry import configure_azure_monitor from opentelemetry import metrics from opentelemetry.sdk.metrics import Counter from opentelemetry.sdk.metrics.view import View diff --git a/azure-monitor-opentelemetry-distro/samples/tracing/client.py b/azure-monitor-opentelemetry/samples/tracing/client.py similarity index 95% rename from azure-monitor-opentelemetry-distro/samples/tracing/client.py rename to azure-monitor-opentelemetry/samples/tracing/client.py index c94279f5..dee02d90 100644 --- a/azure-monitor-opentelemetry-distro/samples/tracing/client.py +++ b/azure-monitor-opentelemetry/samples/tracing/client.py @@ -6,7 +6,7 @@ import logging import requests -from azure.monitor.opentelemetry.distro import configure_azure_monitor +from azure.monitor.opentelemetry import configure_azure_monitor from opentelemetry import trace logger = logging.getLogger(__name__) diff --git a/azure-monitor-opentelemetry-distro/samples/tracing/db_psycopg2.py b/azure-monitor-opentelemetry/samples/tracing/db_psycopg2.py similarity index 91% rename from azure-monitor-opentelemetry-distro/samples/tracing/db_psycopg2.py rename to azure-monitor-opentelemetry/samples/tracing/db_psycopg2.py index a398cffe..7d21e523 100644 --- a/azure-monitor-opentelemetry-distro/samples/tracing/db_psycopg2.py +++ b/azure-monitor-opentelemetry/samples/tracing/db_psycopg2.py @@ -4,7 +4,7 @@ # license information. # -------------------------------------------------------------------------- import psycopg2 -from azure.monitor.opentelemetry.distro import configure_azure_monitor +from azure.monitor.opentelemetry import configure_azure_monitor # Configure Azure monitor collection telemetry pipeline configure_azure_monitor( diff --git a/azure-monitor-opentelemetry-distro/samples/tracing/django/sample/example/__init__.py b/azure-monitor-opentelemetry/samples/tracing/django/sample/example/__init__.py similarity index 100% rename from azure-monitor-opentelemetry-distro/samples/tracing/django/sample/example/__init__.py rename to azure-monitor-opentelemetry/samples/tracing/django/sample/example/__init__.py diff --git a/azure-monitor-opentelemetry-distro/samples/tracing/django/sample/example/admin.py b/azure-monitor-opentelemetry/samples/tracing/django/sample/example/admin.py similarity index 100% rename from azure-monitor-opentelemetry-distro/samples/tracing/django/sample/example/admin.py rename to azure-monitor-opentelemetry/samples/tracing/django/sample/example/admin.py diff --git a/azure-monitor-opentelemetry-distro/samples/tracing/django/sample/example/apps.py b/azure-monitor-opentelemetry/samples/tracing/django/sample/example/apps.py similarity index 100% rename from azure-monitor-opentelemetry-distro/samples/tracing/django/sample/example/apps.py rename to azure-monitor-opentelemetry/samples/tracing/django/sample/example/apps.py diff --git a/azure-monitor-opentelemetry-distro/samples/tracing/django/sample/example/migrations/__init__.py b/azure-monitor-opentelemetry/samples/tracing/django/sample/example/migrations/__init__.py similarity index 100% rename from azure-monitor-opentelemetry-distro/samples/tracing/django/sample/example/migrations/__init__.py rename to azure-monitor-opentelemetry/samples/tracing/django/sample/example/migrations/__init__.py diff --git a/azure-monitor-opentelemetry-distro/samples/tracing/django/sample/example/models.py b/azure-monitor-opentelemetry/samples/tracing/django/sample/example/models.py similarity index 100% rename from azure-monitor-opentelemetry-distro/samples/tracing/django/sample/example/models.py rename to azure-monitor-opentelemetry/samples/tracing/django/sample/example/models.py diff --git a/azure-monitor-opentelemetry-distro/samples/tracing/django/sample/example/tests.py b/azure-monitor-opentelemetry/samples/tracing/django/sample/example/tests.py similarity index 100% rename from azure-monitor-opentelemetry-distro/samples/tracing/django/sample/example/tests.py rename to azure-monitor-opentelemetry/samples/tracing/django/sample/example/tests.py diff --git a/azure-monitor-opentelemetry-distro/samples/tracing/django/sample/example/urls.py b/azure-monitor-opentelemetry/samples/tracing/django/sample/example/urls.py similarity index 100% rename from azure-monitor-opentelemetry-distro/samples/tracing/django/sample/example/urls.py rename to azure-monitor-opentelemetry/samples/tracing/django/sample/example/urls.py diff --git a/azure-monitor-opentelemetry-distro/samples/tracing/django/sample/example/views.py b/azure-monitor-opentelemetry/samples/tracing/django/sample/example/views.py similarity index 92% rename from azure-monitor-opentelemetry-distro/samples/tracing/django/sample/example/views.py rename to azure-monitor-opentelemetry/samples/tracing/django/sample/example/views.py index 1b1a0baa..a9616350 100644 --- a/azure-monitor-opentelemetry-distro/samples/tracing/django/sample/example/views.py +++ b/azure-monitor-opentelemetry/samples/tracing/django/sample/example/views.py @@ -4,7 +4,7 @@ # license information. # -------------------------------------------------------------------------- -from azure.monitor.opentelemetry.distro import configure_azure_monitor +from azure.monitor.opentelemetry import configure_azure_monitor from django.http import HttpResponse # Configure Azure monitor collection telemetry pipeline diff --git a/azure-monitor-opentelemetry-distro/samples/tracing/django/sample/manage.py b/azure-monitor-opentelemetry/samples/tracing/django/sample/manage.py similarity index 100% rename from azure-monitor-opentelemetry-distro/samples/tracing/django/sample/manage.py rename to azure-monitor-opentelemetry/samples/tracing/django/sample/manage.py diff --git a/azure-monitor-opentelemetry-distro/samples/tracing/django/sample/sample/__init__.py b/azure-monitor-opentelemetry/samples/tracing/django/sample/sample/__init__.py similarity index 100% rename from azure-monitor-opentelemetry-distro/samples/tracing/django/sample/sample/__init__.py rename to azure-monitor-opentelemetry/samples/tracing/django/sample/sample/__init__.py diff --git a/azure-monitor-opentelemetry-distro/samples/tracing/django/sample/sample/asgi.py b/azure-monitor-opentelemetry/samples/tracing/django/sample/sample/asgi.py similarity index 100% rename from azure-monitor-opentelemetry-distro/samples/tracing/django/sample/sample/asgi.py rename to azure-monitor-opentelemetry/samples/tracing/django/sample/sample/asgi.py diff --git a/azure-monitor-opentelemetry-distro/samples/tracing/django/sample/sample/settings.py b/azure-monitor-opentelemetry/samples/tracing/django/sample/sample/settings.py similarity index 100% rename from azure-monitor-opentelemetry-distro/samples/tracing/django/sample/sample/settings.py rename to azure-monitor-opentelemetry/samples/tracing/django/sample/sample/settings.py diff --git a/azure-monitor-opentelemetry-distro/samples/tracing/django/sample/sample/urls.py b/azure-monitor-opentelemetry/samples/tracing/django/sample/sample/urls.py similarity index 100% rename from azure-monitor-opentelemetry-distro/samples/tracing/django/sample/sample/urls.py rename to azure-monitor-opentelemetry/samples/tracing/django/sample/sample/urls.py diff --git a/azure-monitor-opentelemetry-distro/samples/tracing/django/sample/sample/wsgi.py b/azure-monitor-opentelemetry/samples/tracing/django/sample/sample/wsgi.py similarity index 100% rename from azure-monitor-opentelemetry-distro/samples/tracing/django/sample/sample/wsgi.py rename to azure-monitor-opentelemetry/samples/tracing/django/sample/sample/wsgi.py diff --git a/azure-monitor-opentelemetry-distro/samples/tracing/server_flask.py b/azure-monitor-opentelemetry/samples/tracing/server_flask.py similarity index 94% rename from azure-monitor-opentelemetry-distro/samples/tracing/server_flask.py rename to azure-monitor-opentelemetry/samples/tracing/server_flask.py index 0f07512e..dbfe3c70 100644 --- a/azure-monitor-opentelemetry-distro/samples/tracing/server_flask.py +++ b/azure-monitor-opentelemetry/samples/tracing/server_flask.py @@ -4,7 +4,7 @@ # license information. # -------------------------------------------------------------------------- import flask -from azure.monitor.opentelemetry.distro import configure_azure_monitor +from azure.monitor.opentelemetry import configure_azure_monitor # Configure Azure monitor collection telemetry pipeline configure_azure_monitor( diff --git a/azure-monitor-opentelemetry-distro/samples/tracing/simple.py b/azure-monitor-opentelemetry/samples/tracing/simple.py similarity index 92% rename from azure-monitor-opentelemetry-distro/samples/tracing/simple.py rename to azure-monitor-opentelemetry/samples/tracing/simple.py index 5c6989d0..0212c17a 100644 --- a/azure-monitor-opentelemetry-distro/samples/tracing/simple.py +++ b/azure-monitor-opentelemetry/samples/tracing/simple.py @@ -4,7 +4,7 @@ # license information. # -------------------------------------------------------------------------- -from azure.monitor.opentelemetry.distro import configure_azure_monitor +from azure.monitor.opentelemetry import configure_azure_monitor from opentelemetry import trace from opentelemetry.sdk.resources import Resource, ResourceAttributes diff --git a/azure-monitor-opentelemetry-distro/setup.cfg b/azure-monitor-opentelemetry/setup.cfg similarity index 100% rename from azure-monitor-opentelemetry-distro/setup.cfg rename to azure-monitor-opentelemetry/setup.cfg diff --git a/azure-monitor-opentelemetry-distro/setup.py b/azure-monitor-opentelemetry/setup.py similarity index 93% rename from azure-monitor-opentelemetry-distro/setup.py rename to azure-monitor-opentelemetry/setup.py index d94e8606..6bd6a2be 100644 --- a/azure-monitor-opentelemetry-distro/setup.py +++ b/azure-monitor-opentelemetry/setup.py @@ -13,7 +13,7 @@ from setuptools import find_packages, setup # Change the PACKAGE_NAME only to change folder and different name -PACKAGE_NAME = "azure-monitor-opentelemetry-distro" +PACKAGE_NAME = "azure-monitor-opentelemetry" PACKAGE_PPRINT_NAME = "Azure Monitor Opentelemetry Distro" # a-b-c => a/b/c @@ -76,7 +76,6 @@ # Exclude packages that will be covered by PEP420 or nspkg "azure", "azure.monitor", - "azure.monitor.opentelemetry", ] ), include_package_data=True, @@ -96,10 +95,10 @@ ], entry_points={ "opentelemetry_distro": [ - "azure_monitor_opentelemetry_distro = azure.monitor.opentelemetry.distro._distro:AzureMonitorDistro" + "azure_monitor_opentelemetry_distro = azure.monitor.opentelemetry.autoinstrumentation._distro:AzureMonitorDistro" ], "opentelemetry_configurator": [ - "azure_monitor_opentelemetry_configurator = azure.monitor.opentelemetry.distro._configurator:AzureMonitorConfigurator" + "azure_monitor_opentelemetry_configurator = azure.monitor.opentelemetry.autoinstrumentation._configurator:AzureMonitorConfigurator" ], }, ) diff --git a/azure-monitor-opentelemetry-distro/tests/test_distro.py b/azure-monitor-opentelemetry/tests/autoinstrumentation/test_distro.py similarity index 57% rename from azure-monitor-opentelemetry-distro/tests/test_distro.py rename to azure-monitor-opentelemetry/tests/autoinstrumentation/test_distro.py index 0bb89791..aae4653b 100644 --- a/azure-monitor-opentelemetry-distro/tests/test_distro.py +++ b/azure-monitor-opentelemetry/tests/autoinstrumentation/test_distro.py @@ -1,16 +1,18 @@ from unittest import TestCase from unittest.mock import patch -from azure.monitor.opentelemetry.distro._distro import AzureMonitorDistro +from azure.monitor.opentelemetry.autoinstrumentation._distro import ( + AzureMonitorDistro, +) class TestDistro(TestCase): @patch( - "azure.monitor.opentelemetry.distro._distro.AzureDiagnosticLogging.enable" + "azure.monitor.opentelemetry.autoinstrumentation._distro.AzureDiagnosticLogging.enable" ) # TODO: Enabled when duplciate logging issue is solved # @patch( - # "azure.monitor.opentelemetry.distro._diagnostic_logging._EXPORTER_DIAGNOSTICS_ENABLED", + # "azure.monitor.opentelemetry.autoinstrumentation._diagnostic_logging._EXPORTER_DIAGNOSTICS_ENABLED", # False, # ) def test_configure(self, mock_diagnostics): @@ -20,10 +22,10 @@ def test_configure(self, mock_diagnostics): # TODO: Enabled when duplicate logging issue is solved # @patch( - # "azure.monitor.opentelemetry.distro._distro.AzureDiagnosticLogging.enable" + # "azure.monitor.opentelemetry.autoinstrumentation._distro.AzureDiagnosticLogging.enable" # ) # @patch( - # "azure.monitor.opentelemetry.distro._diagnostic_logging._EXPORTER_DIAGNOSTICS_ENABLED", + # "azure.monitor.opentelemetry.autoinstrumentation._diagnostic_logging._EXPORTER_DIAGNOSTICS_ENABLED", # True, # ) # def test_configure_exporter_diagnostics(self, mock_diagnostics): diff --git a/azure-monitor-opentelemetry-distro/tests/configuration/test_configure.py b/azure-monitor-opentelemetry/tests/configuration/test_configure.py similarity index 85% rename from azure-monitor-opentelemetry-distro/tests/configuration/test_configure.py rename to azure-monitor-opentelemetry/tests/configuration/test_configure.py index 39da79a8..bfb0dd3c 100644 --- a/azure-monitor-opentelemetry-distro/tests/configuration/test_configure.py +++ b/azure-monitor-opentelemetry/tests/configuration/test_configure.py @@ -15,7 +15,7 @@ import unittest from unittest.mock import Mock, call, patch -from azure.monitor.opentelemetry.distro import ( +from azure.monitor.opentelemetry._configure import ( _SUPPORTED_INSTRUMENTED_LIBRARIES, _get_resource, _setup_instrumentations, @@ -28,19 +28,19 @@ class TestConfigure(unittest.TestCase): @patch( - "azure.monitor.opentelemetry.distro._setup_instrumentations", + "azure.monitor.opentelemetry._configure._setup_instrumentations", ) @patch( - "azure.monitor.opentelemetry.distro._setup_metrics", + "azure.monitor.opentelemetry._configure._setup_metrics", ) @patch( - "azure.monitor.opentelemetry.distro._setup_logging", + "azure.monitor.opentelemetry._configure._setup_logging", ) @patch( - "azure.monitor.opentelemetry.distro._setup_tracing", + "azure.monitor.opentelemetry._configure._setup_tracing", ) @patch( - "azure.monitor.opentelemetry.distro._get_resource", + "azure.monitor.opentelemetry._configure._get_resource", ) def test_configure_azure_monitor( self, @@ -76,19 +76,19 @@ def test_configure_azure_monitor( instrumentation_mock.assert_called_once_with(kwargs) @patch( - "azure.monitor.opentelemetry.distro._setup_instrumentations", + "azure.monitor.opentelemetry._configure._setup_instrumentations", ) @patch( - "azure.monitor.opentelemetry.distro._setup_metrics", + "azure.monitor.opentelemetry._configure._setup_metrics", ) @patch( - "azure.monitor.opentelemetry.distro._setup_logging", + "azure.monitor.opentelemetry._configure._setup_logging", ) @patch( - "azure.monitor.opentelemetry.distro._setup_tracing", + "azure.monitor.opentelemetry._configure._setup_tracing", ) @patch( - "azure.monitor.opentelemetry.distro._get_resource", + "azure.monitor.opentelemetry._configure._get_resource", ) def test_configure_azure_monitor_disable_tracing( self, @@ -123,19 +123,19 @@ def test_configure_azure_monitor_disable_tracing( instrumentation_mock.assert_called_once_with(kwargs) @patch( - "azure.monitor.opentelemetry.distro._setup_instrumentations", + "azure.monitor.opentelemetry._configure._setup_instrumentations", ) @patch( - "azure.monitor.opentelemetry.distro._setup_metrics", + "azure.monitor.opentelemetry._configure._setup_metrics", ) @patch( - "azure.monitor.opentelemetry.distro._setup_logging", + "azure.monitor.opentelemetry._configure._setup_logging", ) @patch( - "azure.monitor.opentelemetry.distro._setup_tracing", + "azure.monitor.opentelemetry._configure._setup_tracing", ) @patch( - "azure.monitor.opentelemetry.distro._get_resource", + "azure.monitor.opentelemetry._configure._get_resource", ) def test_configure_azure_monitor_disable_logging( self, @@ -170,19 +170,19 @@ def test_configure_azure_monitor_disable_logging( instrumentation_mock.assert_called_once_with(kwargs) @patch( - "azure.monitor.opentelemetry.distro._setup_instrumentations", + "azure.monitor.opentelemetry._configure._setup_instrumentations", ) @patch( - "azure.monitor.opentelemetry.distro._setup_metrics", + "azure.monitor.opentelemetry._configure._setup_metrics", ) @patch( - "azure.monitor.opentelemetry.distro._setup_logging", + "azure.monitor.opentelemetry._configure._setup_logging", ) @patch( - "azure.monitor.opentelemetry.distro._setup_tracing", + "azure.monitor.opentelemetry._configure._setup_tracing", ) @patch( - "azure.monitor.opentelemetry.distro._get_resource", + "azure.monitor.opentelemetry._configure._get_resource", ) def test_configure_azure_monitor_disable_metrics( self, @@ -221,7 +221,7 @@ def test_get_resource(self): self.assertEqual(res, "test_resource") @patch( - "azure.monitor.opentelemetry.distro.Resource", + "azure.monitor.opentelemetry._configure.Resource", ) def test_get_resource_default(self, resource_mock): configuration = {} @@ -229,23 +229,23 @@ def test_get_resource_default(self, resource_mock): resource_mock.create.assert_called_once_with() @patch( - "azure.monitor.opentelemetry.distro.BatchSpanProcessor", + "azure.monitor.opentelemetry._configure.BatchSpanProcessor", ) @patch( - "azure.monitor.opentelemetry.distro.AzureMonitorTraceExporter", + "azure.monitor.opentelemetry._configure.AzureMonitorTraceExporter", ) @patch( - "azure.monitor.opentelemetry.distro.get_tracer_provider", + "azure.monitor.opentelemetry._configure.get_tracer_provider", ) @patch( - "azure.monitor.opentelemetry.distro.set_tracer_provider", + "azure.monitor.opentelemetry._configure.set_tracer_provider", ) @patch( - "azure.monitor.opentelemetry.distro.TracerProvider", + "azure.monitor.opentelemetry._configure.TracerProvider", autospec=True, ) @patch( - "azure.monitor.opentelemetry.distro.ApplicationInsightsSampler", + "azure.monitor.opentelemetry._configure.ApplicationInsightsSampler", ) def test_setup_tracing( self, @@ -288,25 +288,25 @@ def test_setup_tracing( tp_init_mock.add_span_processor.assert_called_once_with(bsp_init_mock) @patch( - "azure.monitor.opentelemetry.distro.getLogger", + "azure.monitor.opentelemetry._configure.getLogger", ) @patch( - "azure.monitor.opentelemetry.distro.LoggingHandler", + "azure.monitor.opentelemetry._configure.LoggingHandler", ) @patch( - "azure.monitor.opentelemetry.distro.BatchLogRecordProcessor", + "azure.monitor.opentelemetry._configure.BatchLogRecordProcessor", ) @patch( - "azure.monitor.opentelemetry.distro.AzureMonitorLogExporter", + "azure.monitor.opentelemetry._configure.AzureMonitorLogExporter", ) @patch( - "azure.monitor.opentelemetry.distro.get_logger_provider", + "azure.monitor.opentelemetry._configure.get_logger_provider", ) @patch( - "azure.monitor.opentelemetry.distro.set_logger_provider", + "azure.monitor.opentelemetry._configure.set_logger_provider", ) @patch( - "azure.monitor.opentelemetry.distro.LoggerProvider", + "azure.monitor.opentelemetry._configure.LoggerProvider", autospec=True, ) def test_setup_logging( @@ -361,16 +361,16 @@ def test_setup_logging( ) @patch( - "azure.monitor.opentelemetry.distro.PeriodicExportingMetricReader", + "azure.monitor.opentelemetry._configure.PeriodicExportingMetricReader", ) @patch( - "azure.monitor.opentelemetry.distro.AzureMonitorMetricExporter", + "azure.monitor.opentelemetry._configure.AzureMonitorMetricExporter", ) @patch( - "azure.monitor.opentelemetry.distro.set_meter_provider", + "azure.monitor.opentelemetry._configure.set_meter_provider", ) @patch( - "azure.monitor.opentelemetry.distro.MeterProvider", + "azure.monitor.opentelemetry._configure.MeterProvider", autospec=True, ) def test_setup_metrics( @@ -404,7 +404,7 @@ def test_setup_metrics( metric_exporter_mock.assert_called_once() reader_mock.assert_called_once_with(metric_exp_init_mock) - @patch("azure.monitor.opentelemetry.distro.getattr") + @patch("azure.monitor.opentelemetry._configure.getattr") def test_setup_instrumentations( self, getattr_mock, @@ -425,7 +425,7 @@ def test_setup_instrumentations( instrumentor_mock.assert_called_once() instrument_mock.instrument.assert_called_once() - @patch("azure.monitor.opentelemetry.distro.getattr") + @patch("azure.monitor.opentelemetry._configure.getattr") def test_setup_instrumentations_lib_not_found( self, getattr_mock, @@ -441,7 +441,7 @@ def test_setup_instrumentations_lib_not_found( instrumentor_mock.assert_not_called() instrument_mock.instrument.assert_not_called() - @patch("azure.monitor.opentelemetry.distro.getattr") + @patch("azure.monitor.opentelemetry._configure.getattr") def test_setup_instrumentations_import_lib_failed( self, getattr_mock, @@ -460,7 +460,7 @@ def test_setup_instrumentations_import_lib_failed( instrumentor_mock.assert_not_called() instrument_mock.instrument.assert_not_called() - @patch("azure.monitor.opentelemetry.distro.getattr") + @patch("azure.monitor.opentelemetry._configure.getattr") def test_setup_instrumentations_import_instr_failed( self, getattr_mock, @@ -481,7 +481,7 @@ def test_setup_instrumentations_import_instr_failed( instrumentor_mock.assert_not_called() instrument_mock.instrument.assert_not_called() - @patch("azure.monitor.opentelemetry.distro.getattr") + @patch("azure.monitor.opentelemetry._configure.getattr") def test_setup_instrumentations_failed_general( self, getattr_mock, @@ -502,7 +502,7 @@ def test_setup_instrumentations_failed_general( instrumentor_mock.assert_not_called() instrument_mock.instrument.assert_not_called() - @patch("azure.monitor.opentelemetry.distro.getattr") + @patch("azure.monitor.opentelemetry._configure.getattr") def test_setup_instrumentations_custom_configuration( self, getattr_mock, @@ -528,7 +528,7 @@ def test_setup_instrumentations_custom_configuration( **{"test_key": "test_value"} ) - @patch("azure.monitor.opentelemetry.distro.getattr") + @patch("azure.monitor.opentelemetry._configure.getattr") def test_setup_instrumentations_custom_configuration_not_enabled( self, getattr_mock, @@ -548,7 +548,7 @@ def test_setup_instrumentations_custom_configuration_not_enabled( instrumentor_mock.assert_not_called() instrument_mock.instrument.assert_not_called() - @patch("azure.monitor.opentelemetry.distro.getattr") + @patch("azure.monitor.opentelemetry._configure.getattr") def test_setup_instrumentations_custom_configuration_incorrect( self, getattr_mock, diff --git a/azure-monitor-opentelemetry-distro/tests/configuration/test_util.py b/azure-monitor-opentelemetry/tests/configuration/test_util.py similarity index 97% rename from azure-monitor-opentelemetry-distro/tests/configuration/test_util.py rename to azure-monitor-opentelemetry/tests/configuration/test_util.py index ca1897d0..79fac41d 100644 --- a/azure-monitor-opentelemetry-distro/tests/configuration/test_util.py +++ b/azure-monitor-opentelemetry/tests/configuration/test_util.py @@ -14,7 +14,7 @@ import unittest -from azure.monitor.opentelemetry.distro.util import _get_configurations +from azure.monitor.opentelemetry.util import _get_configurations class TestUtil(unittest.TestCase): diff --git a/azure-monitor-opentelemetry-distro/tests/diagnostics/test_diagnostic_logging.py b/azure-monitor-opentelemetry/tests/diagnostics/test_diagnostic_logging.py similarity index 91% rename from azure-monitor-opentelemetry-distro/tests/diagnostics/test_diagnostic_logging.py rename to azure-monitor-opentelemetry/tests/diagnostics/test_diagnostic_logging.py index 6f874566..99e6bc1d 100644 --- a/azure-monitor-opentelemetry-distro/tests/diagnostics/test_diagnostic_logging.py +++ b/azure-monitor-opentelemetry/tests/diagnostics/test_diagnostic_logging.py @@ -12,7 +12,7 @@ from unittest import TestCase from unittest.mock import patch -import azure.monitor.opentelemetry.distro._diagnostics._diagnostic_logging as diagnostic_logger +import azure.monitor.opentelemetry.diagnostics._diagnostic_logging as diagnostic_logger TEST_LOGGER_PATH = str(Path.home()) TEST_DIAGNOSTIC_LOGGER_FILE_NAME = "test-applicationinsights-extension.log" @@ -88,27 +88,27 @@ def set_up( reload(diagnostic_logger) assert not diagnostic_logger.AzureDiagnosticLogging._initialized patch( - "azure.monitor.opentelemetry.distro._diagnostics._diagnostic_logging._DIAGNOSTIC_LOG_PATH", + "azure.monitor.opentelemetry.diagnostics._diagnostic_logging._DIAGNOSTIC_LOG_PATH", TEST_LOGGER_PATH, ).start() patch( - "azure.monitor.opentelemetry.distro._diagnostics._diagnostic_logging._DIAGNOSTIC_LOGGER_FILE_NAME", + "azure.monitor.opentelemetry.diagnostics._diagnostic_logging._DIAGNOSTIC_LOGGER_FILE_NAME", TEST_DIAGNOSTIC_LOGGER_FILE_NAME, ).start() patch( - "azure.monitor.opentelemetry.distro._diagnostics._diagnostic_logging._CUSTOMER_IKEY", + "azure.monitor.opentelemetry.diagnostics._diagnostic_logging._CUSTOMER_IKEY", TEST_CUSTOMER_IKEY, ).start() patch( - "azure.monitor.opentelemetry.distro._diagnostics._diagnostic_logging._EXTENSION_VERSION", + "azure.monitor.opentelemetry.diagnostics._diagnostic_logging._EXTENSION_VERSION", TEST_EXTENSION_VERSION, ).start() patch( - "azure.monitor.opentelemetry.distro._diagnostics._diagnostic_logging.VERSION", + "azure.monitor.opentelemetry.diagnostics._diagnostic_logging.VERSION", TEST_VERSION, ).start() patch( - "azure.monitor.opentelemetry.distro._diagnostics._diagnostic_logging._IS_DIAGNOSTICS_ENABLED", + "azure.monitor.opentelemetry.diagnostics._diagnostic_logging._IS_DIAGNOSTICS_ENABLED", is_diagnostics_enabled, ).start() diagnostic_logger.AzureDiagnosticLogging.enable(logger) diff --git a/azure-monitor-opentelemetry-distro/tests/diagnostics/test_status_logger.py b/azure-monitor-opentelemetry/tests/diagnostics/test_status_logger.py similarity index 57% rename from azure-monitor-opentelemetry-distro/tests/diagnostics/test_status_logger.py rename to azure-monitor-opentelemetry/tests/diagnostics/test_status_logger.py index 0df79142..1bedde2d 100644 --- a/azure-monitor-opentelemetry-distro/tests/diagnostics/test_status_logger.py +++ b/azure-monitor-opentelemetry/tests/diagnostics/test_status_logger.py @@ -10,7 +10,7 @@ from unittest import TestCase from unittest.mock import patch -from azure.monitor.opentelemetry.distro._diagnostics._status_logger import ( +from azure.monitor.opentelemetry.diagnostics._status_logger import ( AzureStatusLogger, ) @@ -69,31 +69,31 @@ def setUp(self) -> None: clear_file() @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger._STATUS_LOG_PATH", + "azure.monitor.opentelemetry.diagnostics._status_logger._STATUS_LOG_PATH", TEST_LOGGER_PATH, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger._CUSTOMER_IKEY", + "azure.monitor.opentelemetry.diagnostics._status_logger._CUSTOMER_IKEY", TEST_CUSTOMER_IKEY, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger._EXTENSION_VERSION", + "azure.monitor.opentelemetry.diagnostics._status_logger._EXTENSION_VERSION", TEST_EXTENSION_VERSION, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger.VERSION", + "azure.monitor.opentelemetry.diagnostics._status_logger.VERSION", TEST_VERSION, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger._IS_DIAGNOSTICS_ENABLED", + "azure.monitor.opentelemetry.diagnostics._status_logger._IS_DIAGNOSTICS_ENABLED", True, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger.getpid", + "azure.monitor.opentelemetry.diagnostics._status_logger.getpid", return_value=TEST_PID, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger._MACHINE_NAME", + "azure.monitor.opentelemetry.diagnostics._status_logger._MACHINE_NAME", TEST_MACHINE_NAME, ) def test_log_status_success(self, mock_getpid): @@ -102,31 +102,31 @@ def test_log_status_success(self, mock_getpid): check_file_for_messages(True, MESSAGE2) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger._STATUS_LOG_PATH", + "azure.monitor.opentelemetry.diagnostics._status_logger._STATUS_LOG_PATH", TEST_LOGGER_PATH, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger._CUSTOMER_IKEY", + "azure.monitor.opentelemetry.diagnostics._status_logger._CUSTOMER_IKEY", TEST_CUSTOMER_IKEY, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger._EXTENSION_VERSION", + "azure.monitor.opentelemetry.diagnostics._status_logger._EXTENSION_VERSION", TEST_EXTENSION_VERSION, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger.VERSION", + "azure.monitor.opentelemetry.diagnostics._status_logger.VERSION", TEST_VERSION, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger._IS_DIAGNOSTICS_ENABLED", + "azure.monitor.opentelemetry.diagnostics._status_logger._IS_DIAGNOSTICS_ENABLED", True, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger.getpid", + "azure.monitor.opentelemetry.diagnostics._status_logger.getpid", return_value=TEST_PID, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger._MACHINE_NAME", + "azure.monitor.opentelemetry.diagnostics._status_logger._MACHINE_NAME", TEST_MACHINE_NAME, ) def test_log_status_failed_initialization(self, mock_getpid): @@ -135,31 +135,31 @@ def test_log_status_failed_initialization(self, mock_getpid): check_file_for_messages(False, MESSAGE2) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger._STATUS_LOG_PATH", + "azure.monitor.opentelemetry.diagnostics._status_logger._STATUS_LOG_PATH", TEST_LOGGER_PATH, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger._CUSTOMER_IKEY", + "azure.monitor.opentelemetry.diagnostics._status_logger._CUSTOMER_IKEY", TEST_CUSTOMER_IKEY, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger._EXTENSION_VERSION", + "azure.monitor.opentelemetry.diagnostics._status_logger._EXTENSION_VERSION", TEST_EXTENSION_VERSION, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger.VERSION", + "azure.monitor.opentelemetry.diagnostics._status_logger.VERSION", TEST_VERSION, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger._IS_DIAGNOSTICS_ENABLED", + "azure.monitor.opentelemetry.diagnostics._status_logger._IS_DIAGNOSTICS_ENABLED", True, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger.getpid", + "azure.monitor.opentelemetry.diagnostics._status_logger.getpid", return_value=TEST_PID, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger._MACHINE_NAME", + "azure.monitor.opentelemetry.diagnostics._status_logger._MACHINE_NAME", TEST_MACHINE_NAME, ) def test_log_status_no_reason(self, mock_getpid): @@ -168,31 +168,31 @@ def test_log_status_no_reason(self, mock_getpid): check_file_for_messages(True) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger._STATUS_LOG_PATH", + "azure.monitor.opentelemetry.diagnostics._status_logger._STATUS_LOG_PATH", TEST_LOGGER_PATH, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger._CUSTOMER_IKEY", + "azure.monitor.opentelemetry.diagnostics._status_logger._CUSTOMER_IKEY", TEST_CUSTOMER_IKEY, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger._EXTENSION_VERSION", + "azure.monitor.opentelemetry.diagnostics._status_logger._EXTENSION_VERSION", TEST_EXTENSION_VERSION, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger.VERSION", + "azure.monitor.opentelemetry.diagnostics._status_logger.VERSION", TEST_VERSION, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger._IS_DIAGNOSTICS_ENABLED", + "azure.monitor.opentelemetry.diagnostics._status_logger._IS_DIAGNOSTICS_ENABLED", False, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger.getpid", + "azure.monitor.opentelemetry.diagnostics._status_logger.getpid", return_value=TEST_PID, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger._MACHINE_NAME", + "azure.monitor.opentelemetry.diagnostics._status_logger._MACHINE_NAME", TEST_MACHINE_NAME, ) def test_disabled_log_status_success(self, mock_getpid): @@ -201,31 +201,31 @@ def test_disabled_log_status_success(self, mock_getpid): check_file_is_empty() @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger._STATUS_LOG_PATH", + "azure.monitor.opentelemetry.diagnostics._status_logger._STATUS_LOG_PATH", TEST_LOGGER_PATH, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger._CUSTOMER_IKEY", + "azure.monitor.opentelemetry.diagnostics._status_logger._CUSTOMER_IKEY", TEST_CUSTOMER_IKEY, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger._EXTENSION_VERSION", + "azure.monitor.opentelemetry.diagnostics._status_logger._EXTENSION_VERSION", TEST_EXTENSION_VERSION, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger.VERSION", + "azure.monitor.opentelemetry.diagnostics._status_logger.VERSION", TEST_VERSION, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger._IS_DIAGNOSTICS_ENABLED", + "azure.monitor.opentelemetry.diagnostics._status_logger._IS_DIAGNOSTICS_ENABLED", False, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger.getpid", + "azure.monitor.opentelemetry.diagnostics._status_logger.getpid", return_value=TEST_PID, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger._MACHINE_NAME", + "azure.monitor.opentelemetry.diagnostics._status_logger._MACHINE_NAME", TEST_MACHINE_NAME, ) def test_disabled_log_status_failed_initialization(self, mock_getpid): @@ -234,31 +234,31 @@ def test_disabled_log_status_failed_initialization(self, mock_getpid): check_file_is_empty() @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger._STATUS_LOG_PATH", + "azure.monitor.opentelemetry.diagnostics._status_logger._STATUS_LOG_PATH", TEST_LOGGER_PATH, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger._CUSTOMER_IKEY", + "azure.monitor.opentelemetry.diagnostics._status_logger._CUSTOMER_IKEY", TEST_CUSTOMER_IKEY, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger._EXTENSION_VERSION", + "azure.monitor.opentelemetry.diagnostics._status_logger._EXTENSION_VERSION", TEST_EXTENSION_VERSION, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger.VERSION", + "azure.monitor.opentelemetry.diagnostics._status_logger.VERSION", TEST_VERSION, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger._IS_DIAGNOSTICS_ENABLED", + "azure.monitor.opentelemetry.diagnostics._status_logger._IS_DIAGNOSTICS_ENABLED", False, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger.getpid", + "azure.monitor.opentelemetry.diagnostics._status_logger.getpid", return_value=TEST_PID, ) @patch( - "azure.monitor.opentelemetry.distro._diagnostics._status_logger._MACHINE_NAME", + "azure.monitor.opentelemetry.diagnostics._status_logger._MACHINE_NAME", TEST_MACHINE_NAME, ) def test_disabled_log_status_no_reason(self, mock_getpid): diff --git a/azure-monitor-opentelemetry-distro/tests/exporter/test_exporter.py b/azure-monitor-opentelemetry/tests/exporter/test_exporter.py similarity index 100% rename from azure-monitor-opentelemetry-distro/tests/exporter/test_exporter.py rename to azure-monitor-opentelemetry/tests/exporter/test_exporter.py diff --git a/azure-monitor-opentelemetry-distro/tests/instrumentation/test_django.py b/azure-monitor-opentelemetry/tests/instrumentation/test_django.py similarity index 100% rename from azure-monitor-opentelemetry-distro/tests/instrumentation/test_django.py rename to azure-monitor-opentelemetry/tests/instrumentation/test_django.py diff --git a/azure-monitor-opentelemetry-distro/tests/instrumentation/test_flask.py b/azure-monitor-opentelemetry/tests/instrumentation/test_flask.py similarity index 100% rename from azure-monitor-opentelemetry-distro/tests/instrumentation/test_flask.py rename to azure-monitor-opentelemetry/tests/instrumentation/test_flask.py diff --git a/azure-monitor-opentelemetry-distro/tests/instrumentation/test_psycopg2.py b/azure-monitor-opentelemetry/tests/instrumentation/test_psycopg2.py similarity index 100% rename from azure-monitor-opentelemetry-distro/tests/instrumentation/test_psycopg2.py rename to azure-monitor-opentelemetry/tests/instrumentation/test_psycopg2.py diff --git a/azure-monitor-opentelemetry-distro/tests/instrumentation/test_requests.py b/azure-monitor-opentelemetry/tests/instrumentation/test_requests.py similarity index 100% rename from azure-monitor-opentelemetry-distro/tests/instrumentation/test_requests.py rename to azure-monitor-opentelemetry/tests/instrumentation/test_requests.py diff --git a/azure-monitor-opentelemetry-distro/tests/test_constants.py b/azure-monitor-opentelemetry/tests/test_constants.py similarity index 90% rename from azure-monitor-opentelemetry-distro/tests/test_constants.py rename to azure-monitor-opentelemetry/tests/test_constants.py index d887435e..c81aff52 100644 --- a/azure-monitor-opentelemetry-distro/tests/test_constants.py +++ b/azure-monitor-opentelemetry/tests/test_constants.py @@ -9,7 +9,7 @@ from unittest import TestCase from unittest.mock import patch -from azure.monitor.opentelemetry.distro import _constants +from azure.monitor.opentelemetry import _constants TEST_VALUE = "TEST_VALUE" TEST_IKEY = "1234abcd-ab12-34cd-ab12-a23456abcdef" @@ -80,7 +80,7 @@ def test_diagnostics_disabled(self): self.assertFalse(_constants._IS_DIAGNOSTICS_ENABLED) @patch( - "azure.monitor.opentelemetry.distro._constants.platform.system", + "azure.monitor.opentelemetry._constants.platform.system", return_value="Linux", ) def test_log_path_linux(self, mock_system): @@ -89,7 +89,7 @@ def test_log_path_linux(self, mock_system): ) @patch( - "azure.monitor.opentelemetry.distro._constants.platform.system", + "azure.monitor.opentelemetry._constants.platform.system", return_value="Linux", ) def test_status_log_path_linux(self, mock_system): @@ -99,7 +99,7 @@ def test_status_log_path_linux(self, mock_system): ) @patch( - "azure.monitor.opentelemetry.distro._constants.platform.system", + "azure.monitor.opentelemetry._constants.platform.system", return_value="Windows", ) @patch("pathlib.Path.home", return_value="\\HOME\\DIR") @@ -110,7 +110,7 @@ def test_log_path_windows(self, mock_system, mock_home): ) @patch( - "azure.monitor.opentelemetry.distro._constants.platform.system", + "azure.monitor.opentelemetry._constants.platform.system", return_value="Windows", ) @patch("pathlib.Path.home", return_value="\\HOME\\DIR") @@ -121,14 +121,14 @@ def test_status_log_path_windows(self, mock_system, mock_home): ) @patch( - "azure.monitor.opentelemetry.distro._constants.platform.system", + "azure.monitor.opentelemetry._constants.platform.system", return_value="Window", ) def test_log_path_other(self, mock_platform): self.assertIsNone(_constants._get_log_path()) @patch( - "azure.monitor.opentelemetry.distro._constants.platform.system", + "azure.monitor.opentelemetry._constants.platform.system", return_value="linux", ) def test_status_log_path_other(self, mock_platform): diff --git a/tox.ini b/tox.ini index 0aad9c15..b68dfd20 100644 --- a/tox.ini +++ b/tox.ini @@ -10,11 +10,11 @@ deps = -r test-requirements.txt changedir = - distro: azure-monitor-opentelemetry-distro/tests + distro: azure-monitor-opentelemetry/tests commands_pre = py3{7,8,9,10,11}: python -m pip install -U pip setuptools wheel - distro: pip install {toxinidir}/azure-monitor-opentelemetry-distro + distro: pip install {toxinidir}/azure-monitor-opentelemetry commands = distro: pytest {posargs} @@ -26,7 +26,7 @@ deps = -r lint-requirements.txt commands_pre = - python -m pip install -e {toxinidir}/azure-monitor-opentelemetry-distro + python -m pip install -e {toxinidir}/azure-monitor-opentelemetry commands = black --config pyproject.toml {toxinidir} --diff --check