microsoft.opentelemetry.a365.core.enricher_utils module

Shared utilities for A365 span enrichers.

Provides content extraction helpers used by framework-specific enrichers (Agent Framework, Semantic Kernel, LangChain) to convert structured OTel messages to plain content arrays before A365 export.

microsoft.opentelemetry.a365.core.enricher_utils.extract_content_as_string_list(messages_json, role_filter=None)[source]

Extract content values from messages JSON and return as JSON string list.

Handles the OTel structured message format with "parts" arrays. Only extracts text content, ignoring tool_call and tool_call_response parts.

Parameters:
  • messages_json (str) – JSON string of messages.

  • role_filter (str | None) – If provided, only extract content from messages with this role.

Return type:

str

Returns:

JSON string containing only the text content values as an array, or the original string if parsing fails.

microsoft.opentelemetry.a365.core.enricher_utils.extract_input_content(messages_json)[source]

Extract text content from user messages only.

Return type:

str

microsoft.opentelemetry.a365.core.enricher_utils.extract_output_content(messages_json)[source]

Extract only assistant text content from output messages.

Return type:

str