Update telemetry dependencies and align acceptance clocks and measurement windows

This commit is contained in:
2026-11-16 03:01:31 +03:00
parent 6bb252efbd
commit 0fd39f973f
9 changed files with 133 additions and 83 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ from .storage import ObjectStorage
logger = logging.getLogger("messenger")
logging.basicConfig(level=os.getenv("LOG_LEVEL", "INFO"), format="%(message)s")
INSTANCE_ID = str(uuid4())
INSTANCE_ID = telemetry.INSTANCE_ID
CODES = {
400: "invalid_request",
+3 -3
View File
@@ -72,8 +72,8 @@ class Jobs:
def enqueue(self, conn, attachment_id, source_key, version=1):
job_id = str(uuid4())
conn.execute(
"INSERT INTO attachment_jobs(id,attachment_id,pipeline_version,source_key,state,attempt_limit,traceparent,tracestate) "
"VALUES (%s,%s,%s,%s,'queued',%s,%s,%s)",
"INSERT INTO attachment_jobs(id,attachment_id,pipeline_version,source_key,state,attempt_limit,traceparent,tracestate,accepted_at) "
"VALUES (%s,%s,%s,%s,'queued',%s,%s,%s,clock_timestamp())",
(job_id, attachment_id, version, source_key, self.attempt_limit, telemetry.carrier().get("traceparent"), telemetry.carrier().get("tracestate")),
)
conn.execute("INSERT INTO job_outbox(job_id) VALUES (%s)", (job_id,))
@@ -184,7 +184,7 @@ class Jobs:
self.audit(conn, job["id"], "published", job["attempt"])
t = telemetry.current()
if t:
t.ready_duration.record((datetime.now(UTC) - job["created_at"]).total_seconds(), {"job_type": "attachment.process.v1"})
t.ready_duration.record((datetime.now(UTC) - job["accepted_at"]).total_seconds(), {"job_type": "attachment.process.v1"})
return True
def fail(self, job, code, permanent=False):
+1 -1
View File
@@ -200,7 +200,7 @@ class Telemetry:
def collect():
while not self.stop.wait(2):
counts = self.export_stats.snapshot()
# Read-only queue observation of pinned SDK 1.39.0. Conservation
# Read-only queue observation of pinned SDK 1.45.2. Conservation
# is evaluated after quiescence, not during concurrent export.
pending = len(self.batch_spans._batch_processor._queue)
counts["spans_pending"] = pending