diff --git a/sdk/monitor/azure-monitor-opentelemetry/CHANGELOG.md b/sdk/monitor/azure-monitor-opentelemetry/CHANGELOG.md index 3d0245f8b3e84..1fd0f816ada98 100644 --- a/sdk/monitor/azure-monitor-opentelemetry/CHANGELOG.md +++ b/sdk/monitor/azure-monitor-opentelemetry/CHANGELOG.md @@ -2,13 +2,14 @@ ## 1.0.1 (Unreleased) -- Add message ids for AppLens - ([#32195](https://github.com/Azure/azure-sdk-for-python/pull/32195)) - ### Features Added - Add ability to specify which logger to export telemetry for via `logger_name` configuration ([#32192](https://github.com/Azure/azure-sdk-for-python/pull/32192)) +- Add message ids for AppLens + ([#32195](https://github.com/Azure/azure-sdk-for-python/pull/32195)) +- Remove pkg_resources + ([#32299](https://github.com/Azure/azure-sdk-for-python/pull/32299)) ### Breaking Changes diff --git a/sdk/monitor/azure-monitor-opentelemetry/azure/monitor/opentelemetry/_configure.py b/sdk/monitor/azure-monitor-opentelemetry/azure/monitor/opentelemetry/_configure.py index bfe54cedd7223..c414d80f53ec8 100644 --- a/sdk/monitor/azure-monitor-opentelemetry/azure/monitor/opentelemetry/_configure.py +++ b/sdk/monitor/azure-monitor-opentelemetry/azure/monitor/opentelemetry/_configure.py @@ -8,6 +8,7 @@ from logging import getLogger from typing import Dict, cast +from importlib_metadata import entry_points from opentelemetry._logs import get_logger_provider, set_logger_provider from opentelemetry.instrumentation.dependencies import ( get_dist_dependency_conflicts, @@ -24,7 +25,6 @@ from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import BatchSpanProcessor from opentelemetry.trace import get_tracer_provider, set_tracer_provider -from pkg_resources import iter_entry_points # type: ignore from azure.core.settings import settings from azure.core.tracing.ext.opentelemetry_span import OpenTelemetrySpan @@ -156,11 +156,11 @@ def _setup_metrics(configurations: Dict[str, ConfigurationValue]): def _setup_instrumentations(configurations: Dict[str, ConfigurationValue]): disabled_instrumentations = configurations[DISABLED_INSTRUMENTATIONS_ARG] - # use pkg_resources for now until https://github.com/open-telemetry/opentelemetry-python/pull/3168 is merged - for entry_point in iter_entry_points( - "opentelemetry_instrumentor" + for entry_point in entry_points( + group="opentelemetry_instrumentor" ): lib_name = entry_point.name + print(lib_name) if lib_name not in _SUPPORTED_INSTRUMENTED_LIBRARIES: continue if entry_point.name in disabled_instrumentations: diff --git a/sdk/monitor/azure-monitor-opentelemetry/tests/configuration/test_configure.py b/sdk/monitor/azure-monitor-opentelemetry/tests/configuration/test_configure.py index 47bcc8059d7f3..5c6dd39a50070 100644 --- a/sdk/monitor/azure-monitor-opentelemetry/tests/configuration/test_configure.py +++ b/sdk/monitor/azure-monitor-opentelemetry/tests/configuration/test_configure.py @@ -368,7 +368,7 @@ def test_setup_metrics( reader_mock.assert_called_once_with(metric_exp_init_mock) @patch("azure.monitor.opentelemetry._configure.get_dist_dependency_conflicts") - @patch("azure.monitor.opentelemetry._configure.iter_entry_points") + @patch("azure.monitor.opentelemetry._configure.entry_points") def test_setup_instrumentations_lib_not_supported( self, iter_mock, @@ -392,7 +392,7 @@ def test_setup_instrumentations_lib_not_supported( @patch("azure.monitor.opentelemetry._configure._logger") @patch("azure.monitor.opentelemetry._configure.get_dist_dependency_conflicts") - @patch("azure.monitor.opentelemetry._configure.iter_entry_points") + @patch("azure.monitor.opentelemetry._configure.entry_points") def test_setup_instrumentations_conflict( self, iter_mock, @@ -415,7 +415,7 @@ def test_setup_instrumentations_conflict( @patch("azure.monitor.opentelemetry._configure._logger") @patch("azure.monitor.opentelemetry._configure.get_dist_dependency_conflicts") - @patch("azure.monitor.opentelemetry._configure.iter_entry_points") + @patch("azure.monitor.opentelemetry._configure.entry_points") def test_setup_instrumentations_exception( self, iter_mock, @@ -438,7 +438,7 @@ def test_setup_instrumentations_exception( @patch("azure.monitor.opentelemetry._configure._logger") @patch("azure.monitor.opentelemetry._configure.get_dist_dependency_conflicts") - @patch("azure.monitor.opentelemetry._configure.iter_entry_points") + @patch("azure.monitor.opentelemetry._configure.entry_points") def test_setup_instrumentations_disabled( self, iter_mock,