Preserve distributed job context and expose grade 4 operational signals

This commit is contained in:
Artyom
2026-11-06 12:57:10 +03:00
parent 1a171d0d0f
commit 44d81fd80e
32 changed files with 1098 additions and 35 deletions
+13
View File
@@ -31,6 +31,7 @@ def test_job_observer_counts_by_type_and_outcome_and_marks_the_span() -> None:
for item, outcome in ((done, "done"), (failed, "failed"), (done, "duplicate_noop")):
with tracer.start_as_current_span("process", kind=SpanKind.CONSUMER):
observer.observe(item, outcome, 0.3)
observer.active(1)
data = reader.get_metrics_data()
assert data is not None
found = {
@@ -39,6 +40,18 @@ def test_job_observer_counts_by_type_and_outcome_and_marks_the_span() -> None:
for scope in resource.scope_metrics
for metric in scope.metrics
}
assert (
sum(
p.count
for p in found["messenger.job.time_to_ready"].data.data_points
if isinstance(p, HistogramDataPoint)
)
== 1
)
busy = next(iter(found["messenger.worker.busy"].data.data_points))
assert isinstance(busy, NumberDataPoint)
assert busy.value == 1
observer.active(-1)
counted = {
(point.attributes or {})["outcome"]: point.value
for point in found["messenger.jobs.processed"].data.data_points