forked from mtusi2026/mtusi2026lab7
fix(tracing): preserve upload causality during watchdog republication
This commit is contained in:
+7
-1
@@ -108,7 +108,13 @@ def event(conn, job_id, name, detail=None):
|
||||
def enqueue(conn, job_id):
|
||||
row = conn.execute("SELECT * FROM jobs WHERE id=%s", (job_id,)).fetchone()
|
||||
context = telemetry.carrier()
|
||||
if not context and row.get("traceparent"):
|
||||
retained = row.get("traceparent", "")
|
||||
# A watchdog DB span may start an unrelated trace. Keep the upload's
|
||||
# causal trace; an actual retry in that same trace may advance its parent.
|
||||
if retained and (
|
||||
context.get("traceparent", "").split("-")[1:2]
|
||||
!= retained.split("-")[1:2]
|
||||
):
|
||||
context = {"traceparent": row["traceparent"]}
|
||||
if row.get("tracestate"):
|
||||
context["tracestate"] = row["tracestate"]
|
||||
|
||||
Reference in New Issue
Block a user