feat: propagate trace context through outbox and add pipeline saturation metrics
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"uid": "messenger-overview",
|
||||
"title": "Messenger overview",
|
||||
"description": "Level 3 signals of contracts/observability.md: API RPS, errors and duration, worker jobs and duration, logs and traces (design change otel-telemetry, decision 16). Provisioned from git, UI changes are not saved.",
|
||||
"description": "Signals of contracts/observability.md, levels 3 and 4: API RPS, errors and duration, worker jobs and duration, queue depth and age, time to ready, PostgreSQL pools, worker and container saturation, logs and traces (design changes otel-telemetry, decision 16, and job-trace-propagation, decision 14). Provisioned from git, UI changes are not saved.",
|
||||
"tags": ["messenger", "lab6"],
|
||||
"timezone": "utc",
|
||||
"editable": false,
|
||||
"graphTooltip": 1,
|
||||
"schemaVersion": 39,
|
||||
"version": 1,
|
||||
"version": 2,
|
||||
"refresh": "30s",
|
||||
"time": {"from": "now-1h", "to": "now"},
|
||||
"annotations": {"list": []},
|
||||
@@ -79,7 +79,7 @@
|
||||
{
|
||||
"id": 5,
|
||||
"type": "timeseries",
|
||||
"title": "Request duration p50 and p95 (all replicas)",
|
||||
"title": "Request duration p50, p95 and p99 (all replicas)",
|
||||
"description": "Quantiles from the sum of buckets of all replicas, not averages of replicas.",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 9},
|
||||
@@ -97,6 +97,12 @@
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"expr": "histogram_quantile(0.95, sum by (le) (rate(http_server_request_duration_seconds_bucket{job=\"messenger-api\"}[5m])))",
|
||||
"legendFormat": "p95"
|
||||
},
|
||||
{
|
||||
"refId": "C",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"expr": "histogram_quantile(0.99, sum by (le) (rate(http_server_request_duration_seconds_bucket{job=\"messenger-api\"}[5m])))",
|
||||
"legendFormat": "p99"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -169,8 +175,8 @@
|
||||
{
|
||||
"id": 10,
|
||||
"type": "timeseries",
|
||||
"title": "Job duration p50 and p95 (ready)",
|
||||
"description": "Handling of one delivery after the concurrency slot, outcome ready.",
|
||||
"title": "Job duration p50, p95 and p99 (ready)",
|
||||
"description": "Handling of one delivery after the concurrency slot, outcome ready; quantiles from the sum of buckets of all workers.",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"gridPos": {"h": 8, "w": 8, "x": 16, "y": 18},
|
||||
"fieldConfig": {"defaults": {"unit": "s", "min": 0}, "overrides": []},
|
||||
@@ -187,6 +193,214 @@
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"expr": "histogram_quantile(0.95, sum by (le) (rate(messenger_job_duration_seconds_bucket{job=\"messenger-worker\",messenger_job_outcome=\"ready\"}[5m])))",
|
||||
"legendFormat": "p95"
|
||||
},
|
||||
{
|
||||
"refId": "C",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"expr": "histogram_quantile(0.99, sum by (le) (rate(messenger_job_duration_seconds_bucket{job=\"messenger-worker\",messenger_job_outcome=\"ready\"}[5m])))",
|
||||
"legendFormat": "p99"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 14,
|
||||
"type": "row",
|
||||
"title": "Pipeline (messenger-relay, messenger-worker)",
|
||||
"collapsed": false,
|
||||
"gridPos": {"h": 1, "w": 24, "x": 0, "y": 26},
|
||||
"panels": []
|
||||
},
|
||||
{
|
||||
"id": 15,
|
||||
"type": "timeseries",
|
||||
"title": "Queue depth by stage",
|
||||
"description": "Unfinished jobs from one source, the relay snapshot of PostgreSQL every 5 s: scheduled (waits for the next attempt), outbox (due, not published), published (not taken), processing. A snapshot older than 30 s is not reported; the Collector keeps the last point up to 5 min.",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"gridPos": {"h": 8, "w": 8, "x": 0, "y": 27},
|
||||
"fieldConfig": {"defaults": {"unit": "short", "min": 0}, "overrides": []},
|
||||
"options": {"legend": {"displayMode": "table", "placement": "bottom", "calcs": ["lastNotNull"]}, "tooltip": {"mode": "multi"}},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"expr": "max by (messenger_queue_stage) (messenger_queue_depth{job=\"messenger-relay\"})",
|
||||
"legendFormat": "{{messenger_queue_stage}}"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 16,
|
||||
"type": "timeseries",
|
||||
"title": "Age of the oldest unfinished job",
|
||||
"description": "Seconds since the oldest unfinished job was accepted (queued with its job, before 202): accumulation, not handling time; 0 without unfinished jobs.",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"gridPos": {"h": 8, "w": 8, "x": 8, "y": 27},
|
||||
"fieldConfig": {"defaults": {"unit": "s", "min": 0}, "overrides": []},
|
||||
"options": {"legend": {"displayMode": "list", "placement": "bottom"}, "tooltip": {"mode": "single"}},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"expr": "max(messenger_queue_oldest_age_seconds{job=\"messenger-relay\"})",
|
||||
"legendFormat": "oldest age"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 17,
|
||||
"type": "timeseries",
|
||||
"title": "Time to ready p50, p95 and p99",
|
||||
"description": "From accepted upload (queued with its job) to committed ready, including waiting in the queue, retries and lease returns; jobs after replay are not counted.",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"gridPos": {"h": 8, "w": 8, "x": 16, "y": 27},
|
||||
"fieldConfig": {"defaults": {"unit": "s", "min": 0}, "overrides": []},
|
||||
"options": {"legend": {"displayMode": "list", "placement": "bottom"}, "tooltip": {"mode": "multi"}},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"expr": "histogram_quantile(0.5, sum by (le) (rate(messenger_job_time_to_ready_seconds_bucket{job=\"messenger-worker\"}[5m])))",
|
||||
"legendFormat": "p50"
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"expr": "histogram_quantile(0.95, sum by (le) (rate(messenger_job_time_to_ready_seconds_bucket{job=\"messenger-worker\"}[5m])))",
|
||||
"legendFormat": "p95"
|
||||
},
|
||||
{
|
||||
"refId": "C",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"expr": "histogram_quantile(0.99, sum by (le) (rate(messenger_job_time_to_ready_seconds_bucket{job=\"messenger-worker\"}[5m])))",
|
||||
"legendFormat": "p99"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 18,
|
||||
"type": "row",
|
||||
"title": "Saturation (pools, worker, containers)",
|
||||
"collapsed": false,
|
||||
"gridPos": {"h": 1, "w": 24, "x": 0, "y": 35},
|
||||
"panels": []
|
||||
},
|
||||
{
|
||||
"id": 19,
|
||||
"type": "timeseries",
|
||||
"title": "PostgreSQL pool: used of max",
|
||||
"description": "db.client.connection.count{state=used} to db.client.connection.max per process with the SDK (API replicas, worker, relay); instantaneous value once per export interval.",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"gridPos": {"h": 8, "w": 6, "x": 0, "y": 36},
|
||||
"fieldConfig": {"defaults": {"unit": "percentunit", "min": 0, "max": 1}, "overrides": []},
|
||||
"options": {"legend": {"displayMode": "list", "placement": "bottom"}, "tooltip": {"mode": "multi"}},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"expr": "sum by (job, instance) (db_client_connection_count{db_client_connection_state=\"used\"}) / sum by (job, instance) (db_client_connection_max)",
|
||||
"legendFormat": "{{job}} {{instance}}"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 20,
|
||||
"type": "timeseries",
|
||||
"title": "PostgreSQL pool: waiting and timeouts",
|
||||
"description": "Requests waiting for a pool connection (instantaneous) and pool checkouts that timed out per second.",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"gridPos": {"h": 8, "w": 6, "x": 6, "y": 36},
|
||||
"fieldConfig": {"defaults": {"unit": "short", "min": 0}, "overrides": []},
|
||||
"options": {"legend": {"displayMode": "list", "placement": "bottom"}, "tooltip": {"mode": "multi"}},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"expr": "sum by (job, instance) (db_client_connection_pending_requests)",
|
||||
"legendFormat": "waiting {{job}} {{instance}}"
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"expr": "sum by (job) (rate(db_client_connection_timeouts_total[5m]))",
|
||||
"legendFormat": "timeouts/s {{job}}"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 21,
|
||||
"type": "timeseries",
|
||||
"title": "Worker saturation",
|
||||
"description": "Busy concurrency slots to capacity of all workers (instantaneous) and the window average: sum of delivery durations per second to capacity.",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"gridPos": {"h": 8, "w": 6, "x": 12, "y": 36},
|
||||
"fieldConfig": {"defaults": {"unit": "percentunit", "min": 0}, "overrides": []},
|
||||
"options": {"legend": {"displayMode": "list", "placement": "bottom"}, "tooltip": {"mode": "multi"}},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"expr": "sum(messenger_worker_busy) / sum(messenger_worker_capacity)",
|
||||
"legendFormat": "busy / capacity"
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"expr": "sum(rate(messenger_job_duration_seconds_sum{job=\"messenger-worker\"}[5m])) / sum(messenger_worker_capacity)",
|
||||
"legendFormat": "average over 5m"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 22,
|
||||
"type": "timeseries",
|
||||
"title": "Worker deliveries waiting for a slot",
|
||||
"description": "Deliveries received from the broker (prefetch) that wait for a concurrency slot.",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"gridPos": {"h": 8, "w": 6, "x": 18, "y": 36},
|
||||
"fieldConfig": {"defaults": {"unit": "short", "min": 0}, "overrides": []},
|
||||
"options": {"legend": {"displayMode": "list", "placement": "bottom"}, "tooltip": {"mode": "single"}},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"expr": "sum(messenger_worker_waiting)",
|
||||
"legendFormat": "waiting"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 23,
|
||||
"type": "timeseries",
|
||||
"title": "Container CPU of limit",
|
||||
"description": "CPU of the container from its cgroup v2 (cpu.stat) to the CPU limit (cpu.max), API replicas, worker with render processes, relay. PostgreSQL, S3, broker, load balancer and cleaner are not in these metrics.",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 44},
|
||||
"fieldConfig": {"defaults": {"unit": "percentunit", "min": 0}, "overrides": []},
|
||||
"options": {"legend": {"displayMode": "list", "placement": "bottom"}, "tooltip": {"mode": "multi"}},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"expr": "sum by (job, instance) (rate(container_cpu_time_seconds_total[5m])) / sum by (job, instance) (messenger_container_cpu_limit)",
|
||||
"legendFormat": "{{job}} {{instance}}"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 24,
|
||||
"type": "timeseries",
|
||||
"title": "Container memory of limit",
|
||||
"description": "memory.current of the container to memory.max, same processes as CPU.",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"gridPos": {"h": 8, "w": 12, "x": 12, "y": 44},
|
||||
"fieldConfig": {"defaults": {"unit": "percentunit", "min": 0}, "overrides": []},
|
||||
"options": {"legend": {"displayMode": "list", "placement": "bottom"}, "tooltip": {"mode": "multi"}},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"expr": "sum by (job, instance) (container_memory_usage_bytes) / sum by (job, instance) (messenger_container_memory_limit_bytes)",
|
||||
"legendFormat": "{{job}} {{instance}}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -195,16 +409,16 @@
|
||||
"type": "row",
|
||||
"title": "Logs and traces",
|
||||
"collapsed": false,
|
||||
"gridPos": {"h": 1, "w": 24, "x": 0, "y": 26},
|
||||
"gridPos": {"h": 1, "w": 24, "x": 0, "y": 52},
|
||||
"panels": []
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"type": "logs",
|
||||
"title": "API and worker logs",
|
||||
"title": "API, worker and relay logs",
|
||||
"description": "Records of stdout exported through the Collector; trace_id opens the trace in Tempo.",
|
||||
"datasource": {"type": "loki", "uid": "loki"},
|
||||
"gridPos": {"h": 12, "w": 24, "x": 0, "y": 27},
|
||||
"gridPos": {"h": 12, "w": 24, "x": 0, "y": 53},
|
||||
"options": {"showTime": true, "showLabels": false, "wrapLogMessage": true, "sortOrder": "Descending", "enableLogDetails": true, "dedupStrategy": "none", "prettifyLogMessage": false},
|
||||
"targets": [
|
||||
{
|
||||
@@ -219,9 +433,9 @@
|
||||
"id": 13,
|
||||
"type": "table",
|
||||
"title": "Recent traces",
|
||||
"description": "TraceQL search of API requests and worker deliveries; a trace opens with links to its logs.",
|
||||
"description": "TraceQL search of API requests and worker deliveries; an upload trace holds its relay publications and worker deliveries; a trace opens with links to its logs.",
|
||||
"datasource": {"type": "tempo", "uid": "tempo"},
|
||||
"gridPos": {"h": 10, "w": 24, "x": 0, "y": 39},
|
||||
"gridPos": {"h": 10, "w": 24, "x": 0, "y": 65},
|
||||
"options": {"showHeader": true},
|
||||
"targets": [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user