diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md b/sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md index b6fff03d9e53..e2e72e8c3358 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 1.0.0b22 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 1.0.0b21 (2024-01-16) ### Other Changes diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_version.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_version.py index edb297964488..bd2982c8ea94 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_version.py +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "1.0.0b21" +VERSION = "1.0.0b22" diff --git a/sdk/monitor/azure-monitor-opentelemetry/CHANGELOG.md b/sdk/monitor/azure-monitor-opentelemetry/CHANGELOG.md index d9f4cb4ec31e..2064c74e40f1 100644 --- a/sdk/monitor/azure-monitor-opentelemetry/CHANGELOG.md +++ b/sdk/monitor/azure-monitor-opentelemetry/CHANGELOG.md @@ -14,6 +14,8 @@ ([#33761](https://github.com/Azure/azure-sdk-for-python/pull/33761)) - Fix siteName in diagnostic logging ([#33808](https://github.com/Azure/azure-sdk-for-python/pull/33808)) +- Update min dependency versions opentelemetry-resource-detector-azure~=0.1.1, exporter~=1.0.0b21, OTel SDK/API~= 1.21 + ([#33866](https://github.com/Azure/azure-sdk-for-python/pull/33866)) ## 1.1.1 (2023-12-04) 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 13472a550808..d814c845e560 100644 --- a/sdk/monitor/azure-monitor-opentelemetry/azure/monitor/opentelemetry/_configure.py +++ b/sdk/monitor/azure-monitor-opentelemetry/azure/monitor/opentelemetry/_configure.py @@ -18,6 +18,7 @@ from opentelemetry.sdk._logs.export import BatchLogRecordProcessor from opentelemetry.sdk.metrics import MeterProvider from opentelemetry.sdk.metrics.export import PeriodicExportingMetricReader +from opentelemetry.sdk.resources import Resource from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import BatchSpanProcessor from opentelemetry.trace import get_tracer_provider, set_tracer_provider @@ -92,7 +93,7 @@ def configure_azure_monitor(**kwargs) -> None: def _setup_tracing(configurations: Dict[str, ConfigurationValue]): - resource = configurations[RESOURCE_ARG] # type: ignore + resource: Resource = configurations[RESOURCE_ARG] # type: ignore sampling_ratio = configurations[SAMPLING_RATIO_ARG] tracer_provider = TracerProvider( sampler=ApplicationInsightsSampler(sampling_ratio=cast(float, sampling_ratio)), @@ -109,7 +110,7 @@ def _setup_tracing(configurations: Dict[str, ConfigurationValue]): def _setup_logging(configurations: Dict[str, ConfigurationValue]): - resource = configurations[RESOURCE_ARG] # type: ignore + resource: Resource = configurations[RESOURCE_ARG] # type: ignore logger_provider = LoggerProvider(resource=resource) set_logger_provider(logger_provider) log_exporter = AzureMonitorLogExporter(**configurations) @@ -118,12 +119,12 @@ def _setup_logging(configurations: Dict[str, ConfigurationValue]): ) get_logger_provider().add_log_record_processor(log_record_processor) # type: ignore handler = LoggingHandler(logger_provider=get_logger_provider()) - logger_name = configurations[LOGGER_NAME_ARG] # type: ignore + logger_name: str = configurations[LOGGER_NAME_ARG] # type: ignore getLogger(logger_name).addHandler(handler) def _setup_metrics(configurations: Dict[str, ConfigurationValue]): - resource = configurations[RESOURCE_ARG] # type: ignore + resource: Resource = configurations[RESOURCE_ARG] # type: ignore metric_exporter = AzureMonitorMetricExporter(**configurations) reader = PeriodicExportingMetricReader(metric_exporter) meter_provider = MeterProvider( diff --git a/sdk/monitor/azure-monitor-opentelemetry/setup.py b/sdk/monitor/azure-monitor-opentelemetry/setup.py index ea8da9a731ac..cc2ff376a681 100644 --- a/sdk/monitor/azure-monitor-opentelemetry/setup.py +++ b/sdk/monitor/azure-monitor-opentelemetry/setup.py @@ -88,15 +88,15 @@ install_requires=[ "azure-core<2.0.0,>=1.24.0", "azure-core-tracing-opentelemetry~=1.0.0b10", - "azure-monitor-opentelemetry-exporter~=1.0.0b18", - "opentelemetry-instrumentation-django~=0.41b0", - "opentelemetry-instrumentation-fastapi~=0.41b0", - "opentelemetry-instrumentation-flask~=0.41b0", - "opentelemetry-instrumentation-psycopg2~=0.41b0", - "opentelemetry-instrumentation-requests~=0.41b0", - "opentelemetry-instrumentation-urllib~=0.41b0", - "opentelemetry-instrumentation-urllib3~=0.41b0", - "opentelemetry-resource-detector-azure~=0.1.0", + "azure-monitor-opentelemetry-exporter~=1.0.0b21", + "opentelemetry-instrumentation-django~=0.42b0", + "opentelemetry-instrumentation-fastapi~=0.42b0", + "opentelemetry-instrumentation-flask~=0.42b0", + "opentelemetry-instrumentation-psycopg2~=0.42b0", + "opentelemetry-instrumentation-requests~=0.42b0", + "opentelemetry-instrumentation-urllib~=0.42b0", + "opentelemetry-instrumentation-urllib3~=0.42b0", + "opentelemetry-resource-detector-azure~=0.1.1", ], entry_points={ "opentelemetry_distro": [ 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 3adde3a71517..43ca2f652db0 100644 --- a/sdk/monitor/azure-monitor-opentelemetry/tests/configuration/test_configure.py +++ b/sdk/monitor/azure-monitor-opentelemetry/tests/configuration/test_configure.py @@ -11,10 +11,11 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -import os import unittest from unittest.mock import Mock, patch +from opentelemetry.sdk.resources import Resource + from azure.core.tracing.ext.opentelemetry_span import OpenTelemetrySpan from azure.monitor.opentelemetry._configure import ( _setup_instrumentations, @@ -25,6 +26,9 @@ ) +TEST_RESOURCE = Resource({"foo": "bar"}) + + class TestConfigure(unittest.TestCase): @patch( "azure.monitor.opentelemetry._configure._setup_instrumentations", @@ -221,13 +225,13 @@ def test_setup_tracing( "azure_sdk": {"enabled": True} }, "sampling_ratio": 0.5, - "resource": "test_resource", + "resource": TEST_RESOURCE, } _setup_tracing(configurations) sampler_mock.assert_called_once_with(sampling_ratio=0.5) tp_mock.assert_called_once_with( sampler=sampler_init_mock, - resource="test_resource" + resource=TEST_RESOURCE ) set_tracer_provider_mock.assert_called_once_with(tp_init_mock) get_tracer_provider_mock.assert_called() @@ -285,11 +289,11 @@ def test_setup_logging( configurations = { "connection_string": "test_cs", "logger_name": "test", - "resource": "test_resource", + "resource": TEST_RESOURCE, } _setup_logging(configurations) - lp_mock.assert_called_once_with(resource="test_resource") + lp_mock.assert_called_once_with(resource=TEST_RESOURCE) set_logger_provider_mock.assert_called_once_with(lp_init_mock) get_logger_provider_mock.assert_called() log_exporter_mock.assert_called_once_with(**configurations) @@ -336,12 +340,12 @@ def test_setup_metrics( configurations = { "connection_string": "test_cs", - "resource": "test_resource", + "resource": TEST_RESOURCE, } _setup_metrics(configurations) mp_mock.assert_called_once_with( metric_readers=[reader_init_mock], - resource="test_resource" + resource=TEST_RESOURCE ) set_meter_provider_mock.assert_called_once_with(mp_init_mock) metric_exporter_mock.assert_called_once_with(**configurations)