Skip to content

Commit 8ecee7b

Browse files
fix(tracing): drop outcome label and rename export span failure metric
1 parent da4f6cc commit 8ecee7b

6 files changed

Lines changed: 16 additions & 17 deletions

File tree

src/agentex/lib/core/observability/tests/test_tracing_metrics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def test_instruments_exist(self, monkeypatch):
9393
"export_batches",
9494
"export_spans",
9595
"export_batch_failures",
96-
"export_spans_failed",
96+
"export_span_failures",
9797
"shutdown_timeouts",
9898
"shutdown_remaining_items",
9999
):

src/agentex/lib/core/observability/tests/test_tracing_metrics_recording.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class AuthenticationError(Exception):
9494
)
9595

9696
mock_metrics.export_batch_failures.add.assert_called_once()
97-
mock_metrics.export_spans_failed.add.assert_called_once_with(
97+
mock_metrics.export_span_failures.add.assert_called_once_with(
9898
5,
9999
{
100100
"processor": "sgp",
@@ -116,11 +116,11 @@ def test_record_export_success(self, monkeypatch):
116116

117117
mock_metrics.export_batches.add.assert_called_once_with(
118118
1,
119-
{"processor": "sgp", "event_type": "end", "outcome": "success"},
119+
{"processor": "sgp", "event_type": "end"},
120120
)
121121
mock_metrics.export_spans.add.assert_called_once_with(
122122
12,
123-
{"processor": "sgp", "event_type": "end", "outcome": "success"},
123+
{"processor": "sgp", "event_type": "end"},
124124
)
125125

126126
def test_record_export_success_accepts_processor_label(self, monkeypatch):
@@ -137,5 +137,5 @@ def test_record_export_success_accepts_processor_label(self, monkeypatch):
137137

138138
mock_metrics.export_batches.add.assert_called_once_with(
139139
1,
140-
{"processor": "other", "event_type": "start", "outcome": "success"},
140+
{"processor": "other", "event_type": "start"},
141141
)

src/agentex/lib/core/observability/tracing_metrics.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@
1212
Cardinality is bounded:
1313
- ``event_type``: ``start`` | ``end``
1414
- ``processor``: ``sgp`` | ``other``
15-
- ``outcome``: ``success`` | ``failure`` (export counters only)
16-
- ``http_code``: small fixed set from ``classify_export_error``
17-
- ``error_class``: small fixed set from ``classify_export_error``
15+
- ``http_code``: small fixed set from ``classify_export_error`` (failure counters only)
16+
- ``error_class``: small fixed set from ``classify_export_error`` (failure counters only)
1817
- ``reason``: ``shutdown`` (drops only)
1918
- ``phase``: ``start`` | ``end`` (batch drain histograms)
2019
@@ -75,20 +74,20 @@ def __init__(self) -> None:
7574
self.export_batches = meter.create_counter(
7675
name="agentex.tracing.export.batches",
7776
unit="1",
78-
description="HTTP export batch attempts tagged with outcome",
77+
description="Successful HTTP export batches by processor and event type",
7978
)
8079
self.export_spans = meter.create_counter(
8180
name="agentex.tracing.export.spans",
8281
unit="1",
83-
description="Spans included in HTTP export batches tagged with outcome",
82+
description="Spans in successful HTTP export batches by processor and event type",
8483
)
8584
self.export_batch_failures = meter.create_counter(
8685
name="agentex.tracing.export.batch_failures",
8786
unit="1",
8887
description="Failed HTTP export batches by processor and HTTP status",
8988
)
90-
self.export_spans_failed = meter.create_counter(
91-
name="agentex.tracing.export.spans_failed",
89+
self.export_span_failures = meter.create_counter(
90+
name="agentex.tracing.export.span_failures",
9291
unit="1",
9392
description="Spans in failed HTTP export batches by processor and HTTP status",
9493
)

src/agentex/lib/core/observability/tracing_metrics_recording.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def record_export_success(*, event_type: str, span_count: int, processor: str =
103103
try:
104104
from agentex.lib.core.observability.tracing_metrics import get_tracing_metrics
105105

106-
attrs = {"processor": processor, "event_type": event_type, "outcome": "success"}
106+
attrs = {"processor": processor, "event_type": event_type}
107107
metrics = get_tracing_metrics()
108108
metrics.export_batches.add(1, attrs)
109109
metrics.export_spans.add(span_count, attrs)
@@ -137,7 +137,7 @@ def record_export_failure(
137137
}
138138
metrics = get_tracing_metrics()
139139
metrics.export_batch_failures.add(1, attrs)
140-
metrics.export_spans_failed.add(span_count, attrs)
140+
metrics.export_span_failures.add(span_count, attrs)
141141
except Exception:
142142
pass
143143

tests/lib/core/tracing/processors/test_sgp_tracing_processor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,11 @@ async def test_on_spans_start_records_export_success_metrics(self, monkeypatch):
240240

241241
mock_metrics.export_batches.add.assert_called_once_with(
242242
1,
243-
{"processor": "sgp", "event_type": "start", "outcome": "success"},
243+
{"processor": "sgp", "event_type": "start"},
244244
)
245245
mock_metrics.export_spans.add.assert_called_once_with(
246246
n,
247-
{"processor": "sgp", "event_type": "start", "outcome": "success"},
247+
{"processor": "sgp", "event_type": "start"},
248248
)
249249
assert mock_client.spans.upsert_batch.call_count == 1
250250

tests/lib/core/tracing/test_span_queue.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ class ExportError(Exception):
569569
await queue.shutdown()
570570

571571
mock_metrics.export_batch_failures.add.assert_called_once()
572-
mock_metrics.export_spans_failed.add.assert_called_once()
572+
mock_metrics.export_span_failures.add.assert_called_once()
573573

574574
async def test_enqueue_overhead_with_metrics_disabled(self, monkeypatch):
575575
monkeypatch.setenv("AGENTEX_TRACING_METRICS", "0")

0 commit comments

Comments
 (0)