Skip to content

Commit a71d05d

Browse files
Changing env var that flags OTLPSpanExporter usage
1 parent e948c90 commit a71d05d

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

  • libraries/microsoft-agents-a365-observability-core/microsoft_agents_a365/observability/core
  • tests/observability/core

libraries/microsoft-agents-a365-observability-core/microsoft_agents_a365/observability/core/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Copyright (c) Microsoft Corporation.
22
# Licensed under the MIT License.
33

4-
import logging
54
import os
5+
import logging
66
import threading
77
from collections.abc import Callable
88
from typing import Any, Optional
@@ -184,7 +184,7 @@ def _configure_internal(
184184
self._span_processors["batch"] = batch_processor
185185
self._span_processors["agent"] = agent_processor
186186

187-
if os.environ.get("OTEL_EXPORTER_OTLP_ENDPOINT"):
187+
if os.environ.get("ENABLE_OTLP_EXPORTER", "").lower() == "true":
188188
# The OTLPSpanExporter is auto configured from the environment variables
189189
otlp_exporter = OTLPSpanExporter()
190190
tracer_provider.add_span_processor(

tests/observability/core/test_agent365.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,9 @@ def test_configure_uses_existing_tracer_provider(self, mock_get_provider, mock_i
206206
"microsoft_agents_a365.observability.core.config.is_agent365_exporter_enabled",
207207
return_value=False,
208208
)
209-
@patch.dict("os.environ", {"OTEL_EXPORTER_OTLP_ENDPOINT": "http://localhost:4318"}, clear=True)
209+
@patch.dict("os.environ", {"ENABLE_OTLP_EXPORTER": "true"}, clear=True)
210210
def test_otlp_exporter_initialized_when_env_var_set(self, mock_is_enabled, mock_otlp_exporter):
211-
"""Test that OTLPSpanExporter is initialized when OTEL_EXPORTER_OTLP_ENDPOINT is set."""
211+
"""Test that OTLPSpanExporter is initialized when ENABLE_OTLP_EXPORTER is set."""
212212

213213
result = configure(
214214
service_name="test-service",
@@ -227,7 +227,7 @@ def test_otlp_exporter_initialized_when_env_var_set(self, mock_is_enabled, mock_
227227
def test_otlp_exporter_not_initialized_when_env_var_not_set(
228228
self, mock_is_enabled, mock_otlp_exporter
229229
):
230-
"""Test that OTLPSpanExporter is NOT initialized when OTEL_EXPORTER_OTLP_ENDPOINT is not set."""
230+
"""Test that OTLPSpanExporter is NOT initialized when ENABLE_OTLP_EXPORTER is not set."""
231231

232232
result = configure(
233233
service_name="test-service",

0 commit comments

Comments
 (0)