Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ from microsoft_agents.hosting.core import Authorization, TurnContext
from microsoft_agents_a365.notifications.agent_notification import NotificationTypes

# Observability Components
from microsoft_agents_a365.observability.core.config import configure
# Observability is initialized by the Microsoft OpenTelemetry distro in
# host_agent_server.py via use_microsoft_opentelemetry().
# See: https://github.com/microsoft/opentelemetry-distro-python

# MCP Tooling
from microsoft_agents_a365.tooling.extensions.agentframework.services.mcp_tool_registration_service import (
Expand Down
15 changes: 2 additions & 13 deletions python/agent-framework/sample-agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@
from microsoft_agents_a365.notifications.agent_notification import NotificationTypes

# Observability Components
# TEMPORARILY DISABLED - OpenTelemetry compatibility issue
# from microsoft_agents_a365.observability.extensions.agentframework.trace_instrumentor import (
# AgentFrameworkInstrumentor,
# )
# AgentFramework auto-instrumentation is handled by the microsoft-opentelemetry
# distro (see host_agent_server.py). No manual instrumentor setup is needed.

# MCP Tooling
from microsoft_agents_a365.tooling.extensions.agentframework.services.mcp_tool_registration_service import (
Expand Down Expand Up @@ -94,10 +92,6 @@ def __init__(self):
"""Initialize the AgentFramework agent."""
self.logger = logging.getLogger(self.__class__.__name__)

# Initialize auto instrumentation with Agent 365 Observability SDK
# TEMPORARILY DISABLED - OpenTelemetry compatibility issue
# self._enable_agentframework_instrumentation()

# Initialize authentication options
self.auth_options = LocalAuthenticationOptions.from_environment()

Expand Down Expand Up @@ -184,11 +178,6 @@ def token_resolver(self, agent_id: str, tenant_id: str) -> str | None:
logger.error(f"Error resolving token: {e}")
return None

def _enable_agentframework_instrumentation(self):
"""Enable AgentFramework instrumentation"""
# TEMPORARILY DISABLED - OpenTelemetry compatibility issue
logger.warning("⚠️ AgentFramework instrumentation disabled due to OpenTelemetry version mismatch")

# </ObservabilityConfiguration>

# =========================================================================
Expand Down
18 changes: 13 additions & 5 deletions python/agent-framework/sample-agent/host_agent_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
)
from microsoft_agents_a365.notifications import EmailResponse

from microsoft_agents_a365.observability.core.config import configure
from microsoft.opentelemetry import use_microsoft_opentelemetry
from microsoft_agents_a365.observability.core.middleware.baggage_builder import (
BaggageBuilder,
)
from microsoft_agents_a365.runtime.environment_utils import (
get_observability_authentication_scope,
)
from token_cache import cache_agentic_token
from token_cache import cache_agentic_token, get_cached_agentic_token

# --- Configuration ---
ms_agents_logger = logging.getLogger("microsoft_agents")
Expand All @@ -72,9 +72,17 @@ def create_and_run_host(
f"Agent class {agent_class.__name__} must inherit from AgentInterface"
)

configure(
service_name="AgentFrameworkTracingWithAzureOpenAI",
service_namespace="AgentFrameworkTesting",
# Initialize Microsoft OpenTelemetry distro for observability.
# Replaces the legacy configure() call with a single entrypoint that sets up
# tracing, metrics, and logging pipelines including A365 telemetry export.
# See: https://github.com/microsoft/opentelemetry-distro-python
use_microsoft_opentelemetry(
enable_a365=True,
enable_azure_monitor=False,
a365_token_resolver=lambda agent_id, tenant_id: get_cached_agentic_token(
tenant_id, agent_id
)
or "",
)

host = GenericAgentHost(agent_class, *agent_args, **agent_kwargs)
Expand Down
2 changes: 1 addition & 1 deletion python/agent-framework/sample-agent/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ dependencies = [
"microsoft_agents_a365_tooling >= 0.1.0",
"microsoft_agents_a365_tooling_extensions_agentframework >= 0.1.0",
"microsoft_agents_a365_observability_core >= 0.1.0",
"microsoft_agents_a365_observability_extensions_agent_framework >= 0.1.0",
"microsoft-opentelemetry >= 0.1.0a3",
"microsoft_agents_a365_runtime >= 0.1.0",
"microsoft_agents_a365_notifications >= 0.1.0"
]
Expand Down
Loading