Skip to content

Commit 6a49f52

Browse files
committed
minor change
1 parent 2c1a862 commit 6a49f52

4 files changed

Lines changed: 13 additions & 9 deletions

File tree

‎libraries/microsoft-agents-a365-observability-core/microsoft_agents_a365/observability/core/exporters/agent365_exporter.py‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
from .utils import (
2121
DEFAULT_MAX_PAYLOAD_BYTES,
22-
INFERENCE_OPERATION_TYPE_NAMES,
2322
build_export_url,
2423
chunk_by_size,
2524
estimate_span_bytes,
@@ -83,8 +82,8 @@ def export(self, spans: Sequence[ReadableSpan]) -> SpanExportResult:
8382
try:
8483
groups = filter_and_partition_by_identity(spans)
8584
if not groups:
86-
# No spans with identity; treat as success
87-
logger.info("No spans with tenant/agent identity found; nothing exported.")
85+
# No eligible genAI spans to export after filtering/partitioning; treat as success
86+
logger.info("No eligible genAI spans to export; nothing exported.")
8887
return SpanExportResult.SUCCESS
8988

9089
# Log number of groups and total span count

‎libraries/microsoft-agents-a365-observability-core/microsoft_agents_a365/observability/core/exporters/utils.py‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,15 @@ def filter_and_partition_by_identity(
175175

176176
if non_gen_ai_count > 0:
177177
logger.debug(
178-
f"[Agent365Exporter] {non_gen_ai_count} spans without an eligible "
179-
"gen_ai.operation.name filtered out"
178+
"[Agent365Exporter] %d spans without an eligible "
179+
"gen_ai.operation.name filtered out",
180+
non_gen_ai_count,
180181
)
181182
if missing_identity_count > 0:
182183
logger.debug(
183-
f"[Agent365Exporter] {missing_identity_count} spans skipped due to "
184-
"missing tenant or agent ID"
184+
"[Agent365Exporter] %d spans skipped due to "
185+
"missing tenant or agent ID",
186+
missing_identity_count,
185187
)
186188
return groups
187189

‎tests/observability/core/exporters/test_payload_chunking.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
from unittest.mock import Mock, patch
1111

1212
from microsoft_agents_a365.observability.core.constants import (
13+
CHAT_OPERATION_NAME,
1314
GEN_AI_AGENT_ID_KEY,
15+
GEN_AI_OPERATION_NAME_KEY,
1416
TENANT_ID_KEY,
1517
)
1618
from microsoft_agents_a365.observability.core.exporters.agent365_exporter import (
@@ -165,6 +167,7 @@ def _make_span(self, span_id: int, attribute_size: int) -> ReadableSpan:
165167
mock_span.attributes = {
166168
TENANT_ID_KEY: "tenant-1",
167169
GEN_AI_AGENT_ID_KEY: "agent-1",
170+
GEN_AI_OPERATION_NAME_KEY: CHAT_OPERATION_NAME,
168171
"payload": "x" * attribute_size,
169172
}
170173
mock_span.events = []

‎tests/observability/core/test_agent365_exporter.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ def test_export_includes_inference_operation_type_chat_spans(self):
720720
spans_out = request_data["resourceSpans"][0]["scopeSpans"][0]["spans"]
721721
self.assertEqual(len(spans_out), 1)
722722
# Value is preserved as-is; no normalization
723-
self.assertEqual(spans_out[0]["attributes"]["gen_ai.operation.name"], "Chat")
723+
self.assertEqual(spans_out[0]["attributes"][GEN_AI_OPERATION_NAME_KEY], "Chat")
724724

725725
def test_export_filters_out_unsupported_inference_operation_types(self):
726726
"""Spans with TextCompletion / GenerateContent are filtered out."""
@@ -754,7 +754,7 @@ def test_export_does_not_normalize_canonical_operation_names(self):
754754
_, body, _ = mock_post.call_args[0]
755755
request_data = json.loads(body)
756756
span_out = request_data["resourceSpans"][0]["scopeSpans"][0]["spans"][0]
757-
self.assertEqual(span_out["attributes"]["gen_ai.operation.name"], op)
757+
self.assertEqual(span_out["attributes"][GEN_AI_OPERATION_NAME_KEY], op)
758758

759759

760760
if __name__ == "__main__":

0 commit comments

Comments
 (0)