Skip to content
Merged
Changes from 2 commits
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 @@ -269,20 +269,42 @@ def _setup_additional_azure_sdk_instrumentations(configurations: Dict[str, Confi
_logger.debug("Instrumentation skipped for library azure_sdk")
return

ai_inference_instrumentor_imported = False
try:
from azure.ai.inference.tracing import AIInferenceInstrumentor # pylint: disable=import-error,no-name-in-module
ai_inference_instrumentor_imported = True
except Exception as ex: # pylint: disable=broad-except
_logger.debug(
"Failed to import AIInferenceInstrumentor from azure-ai-inference",
exc_info=ex,
)
return

if ai_inference_instrumentor_imported:
Comment thread
lmolkova marked this conversation as resolved.
Outdated
try:
AIInferenceInstrumentor().instrument()
except Exception as ex: # pylint: disable=broad-except
_logger.warning(
"Exception occurred when instrumenting: %s.",
"azure-ai-inference",
exc_info=ex,
)

ai_agents_instrumentor_imported = False
try:
AIInferenceInstrumentor().instrument()
from azure.ai.projects.telemetry.agents import AIAgentsInstrumentor # pylint: disable=import-error,no-name-in-module
ai_agents_instrumentor_imported = True
except Exception as ex: # pylint: disable=broad-except
_logger.warning(
"Exception occurred when instrumenting: %s.",
"azure-ai-inference",
_logger.debug(
"Failed to import AIAgentsInstrumentor from azure-ai-projects-telemetry-agents",
exc_info=ex,
)

if ai_agents_instrumentor_imported:
try:
AIAgentsInstrumentor().instrument()
Comment thread
lmolkova marked this conversation as resolved.
Outdated
Comment thread
lmolkova marked this conversation as resolved.
Outdated
except Exception as ex: # pylint: disable=broad-except
_logger.warning(
"Exception occurred when instrumenting: %s.",
"azure-ai-projects-telemetry-agents",
exc_info=ex,
)
Loading