Skip to content

Commit da4f6cc

Browse files
Fix redundant '_ms' from duration histogram instruments
1 parent 2b2a25b commit da4f6cc

4 files changed

Lines changed: 9 additions & 9 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ def test_instruments_exist(self, monkeypatch):
8686
"span_events_enqueued",
8787
"span_events_dropped",
8888
"queue_depth",
89-
"queue_lag_ms",
89+
"queue_lag",
9090
"batch_items",
9191
"batch_size",
92-
"batch_drain_duration_ms",
92+
"batch_drain_duration",
9393
"export_batches",
9494
"export_spans",
9595
"export_batch_failures",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def test_record_batch_coalesced_records_lag(self, monkeypatch):
6969
)
7070
mock_metrics.queue_depth.record.assert_called_once_with(3)
7171
mock_metrics.batch_items.record.assert_called_once_with(2)
72-
mock_metrics.queue_lag_ms.record.assert_called_once_with(1000.0)
72+
mock_metrics.queue_lag.record.assert_called_once_with(1000.0)
7373

7474
def test_record_export_failure(self, monkeypatch):
7575
monkeypatch.setenv("AGENTEX_TRACING_METRICS", "1")

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ def __init__(self) -> None:
5252
unit="1",
5353
description="asyncio queue depth at the start of a drain batch",
5454
)
55-
self.queue_lag_ms = meter.create_histogram(
56-
name="agentex.tracing.queue.lag_ms",
55+
self.queue_lag = meter.create_histogram(
56+
name="agentex.tracing.queue.lag",
5757
unit="ms",
5858
description="Max time from enqueue to drain-batch start for items in the batch",
5959
)
@@ -67,8 +67,8 @@ def __init__(self) -> None:
6767
unit="1",
6868
description="Span events in one START or END dispatch phase",
6969
)
70-
self.batch_drain_duration_ms = meter.create_histogram(
71-
name="agentex.tracing.batch.drain_duration_ms",
70+
self.batch_drain_duration = meter.create_histogram(
71+
name="agentex.tracing.batch.drain_duration",
7272
unit="ms",
7373
description="Wall time for one START or END _process_items dispatch",
7474
)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def record_batch_coalesced(
7878
continue
7979
lag_ms = max(lag_ms, (now - item.enqueued_at) * 1000.0)
8080
if lag_ms > 0:
81-
metrics.queue_lag_ms.record(lag_ms)
81+
metrics.queue_lag.record(lag_ms)
8282
except Exception:
8383
pass
8484

@@ -92,7 +92,7 @@ def record_batch_phase(*, phase: str, size: int, duration_ms: float) -> None:
9292
attrs = {"phase": phase}
9393
metrics = get_tracing_metrics()
9494
metrics.batch_size.record(size, attrs)
95-
metrics.batch_drain_duration_ms.record(duration_ms, attrs)
95+
metrics.batch_drain_duration.record(duration_ms, attrs)
9696
except Exception:
9797
pass
9898

0 commit comments

Comments
 (0)