Skip to content

Commit 7740f3e

Browse files
committed
Addressing comments
1 parent 332ea81 commit 7740f3e

3 files changed

Lines changed: 10 additions & 12 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
hex_trace_id,
2525
kind_name,
2626
parse_retry_after,
27-
partition_by_identity,
27+
filter_and_partition_by_identity,
2828
status_name,
2929
truncate_span,
3030
)
@@ -75,7 +75,7 @@ def export(self, spans: Sequence[ReadableSpan]) -> SpanExportResult:
7575
return SpanExportResult.FAILURE
7676

7777
try:
78-
groups = partition_by_identity(spans)
78+
groups = filter_and_partition_by_identity(spans)
7979
if not groups:
8080
# No spans with identity; treat as success
8181
logger.info("No spans with tenant/agent identity found; nothing exported.")

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

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,11 @@ def truncate_span(span_dict: dict[str, Any]) -> dict[str, Any]:
146146
return span_dict
147147

148148

149-
def partition_by_identity(
149+
def filter_and_partition_by_identity(
150150
spans: Sequence[ReadableSpan],
151151
) -> dict[tuple[str, str], list[ReadableSpan]]:
152152
"""
153-
Partition spans by (tenantId, agentId).
153+
Filter export-eligible spans and partition them by (tenantId, agentId).
154154
155155
Only genAI spans (those with a known ``gen_ai.operation.name``) are
156156
included; non-genAI spans (e.g. HTTP, DB) are filtered out. Spans
@@ -174,17 +174,15 @@ def partition_by_identity(
174174
groups.setdefault(key, []).append(sp)
175175

176176
if non_gen_ai_count > 0:
177-
logger.info(f"[Agent365Exporter] {non_gen_ai_count} non-genAI spans filtered out")
177+
logger.debug(
178+
f"[Agent365Exporter] {non_gen_ai_count} spans without an eligible "
179+
"gen_ai.operation.name filtered out"
180+
)
178181
if missing_identity_count > 0:
179-
logger.warning(
182+
logger.debug(
180183
f"[Agent365Exporter] {missing_identity_count} spans skipped due to "
181184
"missing tenant or agent ID"
182185
)
183-
skipped = non_gen_ai_count + missing_identity_count
184-
logger.info(
185-
f"[Agent365Exporter] Partitioned into {len(groups)} identity groups "
186-
f"({skipped} spans skipped)"
187-
)
188186
return groups
189187

190188

‎tests/observability/core/test_agent365_exporter.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def _create_mock_span(
8484
mock_span.kind = Mock()
8585
mock_span.kind.name = "INTERNAL"
8686

87-
# Add identity attributes for partition_by_identity to work
87+
# Add identity attributes for filter_and_partition_by_identity to work
8888
span_attributes = attributes or {}
8989
if tenant_id and agent_id:
9090
span_attributes.update({

0 commit comments

Comments
 (0)