Skip to content
Merged
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
Prev Previous commit
Next Next commit
fix instrument
  • Loading branch information
Liudmila Molkova committed Oct 29, 2024
commit 8f3afc2b8e3169018298e38c4f7b60778d8a2d1d
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,6 @@ def _setup_instrumentations(configurations: Dict[str, ConfigurationValue]):
_logger.debug("Instrumentation skipped for library %s", entry_point.name)
continue
try:
if lib_name == _AZURE_SDK_INSTRUMENTATION_NAME:
_setup_additional_azure_sdk_instrumentations()
continue

# Check if dependent libraries/version are installed
conflict = get_dist_dependency_conflicts(entry_point.dist) # type: ignore
if conflict:
Expand All @@ -218,6 +214,7 @@ def _setup_instrumentations(configurations: Dict[str, ConfigurationValue]):
lib_name,
exc_info=ex,
)
_setup_additional_azure_sdk_instrumentations(configurations)


def _send_attach_warning():
Expand All @@ -229,14 +226,24 @@ def _send_attach_warning():
)


def _setup_additional_azure_sdk_instrumentations():
def _setup_additional_azure_sdk_instrumentations(configurations: Dict[str, ConfigurationValue]):
if not _AZURE_SDK_INSTRUMENTATION_NAME in _ALL_SUPPORTED_INSTRUMENTED_LIBRARIES:
return

if (not _is_instrumentation_enabled(configurations, _AZURE_SDK_INSTRUMENTATION_NAME)):
_logger.debug(
"Instrumentation skipped for library azure_sdk"
)
return

try:
from azure.ai.inference.tracing import AIInferenceInstrumentor # type: ignore
except Exception as ex: # pylint: disable=broad-except
_logger.debug(
"Failed to import AIInferenceInstrumentor from azure-ai-inference",
exc_info=ex,
)
return

try:
AIInferenceInstrumentor().instrument()
Expand Down