Give a rate-limit flush its own run, linked to the run that held the value
A flush ran its cascade under no id, so its executions and failures belonged to no run. It now records a run with source "flush", and the holding run's id travels on the queue item into a new `flow_run.parent` column, also on the `/observability/runs` rows.
This commit is contained in:
@@ -94,6 +94,9 @@ class WorkItem:
|
||||
#: The run this item is, on a ``run`` item. Everything else about a run is
|
||||
#: in its database row, so the journal only has to name it.
|
||||
run_id: str = ""
|
||||
#: The run that scheduled this item, on a ``flush``: the one whose value
|
||||
#: the rate limit held back.
|
||||
parent: str = ""
|
||||
|
||||
def to_fields(self) -> dict[str, str]:
|
||||
return {
|
||||
@@ -107,6 +110,7 @@ class WorkItem:
|
||||
"guard_value": self.guard_value,
|
||||
"enqueued_at": str(self.enqueued_at),
|
||||
"run_id": self.run_id,
|
||||
"parent": self.parent,
|
||||
}
|
||||
|
||||
@classmethod
|
||||
@@ -126,6 +130,7 @@ class WorkItem:
|
||||
deliveries=deliveries,
|
||||
enqueued_at=float(fields.get("enqueued_at") or time.time()),
|
||||
run_id=fields.get("run_id", ""),
|
||||
parent=fields.get("parent", ""),
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user