{ "uid": "messenger-lab7", "title": "Messenger Lab7: secure metrics, logs, traces", "schemaVersion": 40, "version": 1, "editable": false, "refresh": "5s", "time": { "from": "now-15m", "to": "now" }, "tags": [ "lab6" ], "panels": [ { "id": 1, "title": "API RPS", "type": "timeseries", "gridPos": { "x": 0, "y": 0, "w": 12, "h": 8 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "targets": [ { "refId": "A", "expr": "sum(rate(http_server_requests_total{service_name=\"messenger-api\"}[1m]))", "legendFormat": "{{service_instance_id}} {{outcome}}", "queryType": "range" } ], "fieldConfig": { "defaults": { "unit": "reqps" }, "overrides": [] }, "options": { "legend": { "displayMode": "table", "placement": "bottom" } }, "description": "sum(rate(http_server_requests_total{service_name=\"messenger-api\"}[1m]))" }, { "id": 2, "title": "API 5xx ratio", "type": "timeseries", "gridPos": { "x": 12, "y": 0, "w": 12, "h": 8 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "targets": [ { "refId": "A", "expr": "sum(rate(http_server_requests_total{service_name=\"messenger-api\",status_class=\"5xx\"}[1m])) / clamp_min(sum(rate(http_server_requests_total{service_name=\"messenger-api\"}[1m])),0.001)", "legendFormat": "{{service_instance_id}} {{outcome}}", "queryType": "range" } ], "fieldConfig": { "defaults": { "unit": "percentunit" }, "overrides": [] }, "options": { "legend": { "displayMode": "table", "placement": "bottom" } }, "description": "5xx / all business API responses, excludes health, includes client 4xx in denominator." }, { "id": 3, "title": "API p50", "type": "timeseries", "gridPos": { "x": 0, "y": 8, "w": 12, "h": 8 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "targets": [ { "refId": "A", "expr": "histogram_quantile(0.5,sum by(le)(rate(http_server_duration_seconds_bucket{service_name=\"messenger-api\"}[1m])))", "legendFormat": "{{service_instance_id}} {{outcome}}", "queryType": "range" } ], "fieldConfig": { "defaults": { "unit": "s" }, "overrides": [] }, "options": { "legend": { "displayMode": "table", "placement": "bottom" } }, "description": "Histogram buckets aggregated across API replicas before quantile; seconds." }, { "id": 4, "title": "API p95", "type": "timeseries", "gridPos": { "x": 12, "y": 8, "w": 12, "h": 8 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "targets": [ { "refId": "A", "expr": "histogram_quantile(0.95,sum by(le)(rate(http_server_duration_seconds_bucket{service_name=\"messenger-api\"}[1m])))", "legendFormat": "{{service_instance_id}} {{outcome}}", "queryType": "range" } ], "fieldConfig": { "defaults": { "unit": "s" }, "overrides": [] }, "options": { "legend": { "displayMode": "table", "placement": "bottom" } }, "description": "Histogram buckets aggregated across API replicas before quantile; seconds." }, { "id": 5, "title": "API p99", "type": "timeseries", "gridPos": { "x": 0, "y": 16, "w": 12, "h": 8 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "targets": [ { "refId": "A", "expr": "histogram_quantile(0.99,sum by(le)(rate(http_server_duration_seconds_bucket{service_name=\"messenger-api\"}[1m])))", "legendFormat": "{{service_instance_id}} {{outcome}}", "queryType": "range" } ], "fieldConfig": { "defaults": { "unit": "s" }, "overrides": [] }, "options": { "legend": { "displayMode": "table", "placement": "bottom" } }, "description": "Histogram buckets aggregated across API replicas before quantile; seconds." }, { "id": 6, "title": "Worker outcomes", "type": "timeseries", "gridPos": { "x": 12, "y": 16, "w": 12, "h": 8 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "targets": [ { "refId": "A", "expr": "sum by(outcome)(rate(worker_jobs_total{service_name=\"messenger-worker\"}[1m]))", "legendFormat": "{{service_instance_id}} {{outcome}}", "queryType": "range" } ], "fieldConfig": { "defaults": { "unit": "ops" }, "overrides": [] }, "options": { "legend": { "displayMode": "table", "placement": "bottom" } }, "description": "sum by(outcome)(rate(worker_jobs_total{service_name=\"messenger-worker\"}[1m]))" }, { "id": 7, "title": "Worker p95 processing", "type": "timeseries", "gridPos": { "x": 0, "y": 24, "w": 12, "h": 8 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "targets": [ { "refId": "A", "expr": "histogram_quantile(0.95,sum by(le)(rate(worker_job_duration_seconds_bucket{service_name=\"messenger-worker\"}[1m])))", "legendFormat": "{{service_instance_id}} {{outcome}}", "queryType": "range" } ], "fieldConfig": { "defaults": { "unit": "s" }, "overrides": [] }, "options": { "legend": { "displayMode": "table", "placement": "bottom" } }, "description": "histogram_quantile(0.95,sum by(le)(rate(worker_job_duration_seconds_bucket{service_name=\"messenger-worker\"}[1m])))" }, { "id": 8, "title": "Ready p95 end to end", "type": "timeseries", "gridPos": { "x": 12, "y": 24, "w": 12, "h": 8 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "targets": [ { "refId": "A", "expr": "histogram_quantile(0.95,sum by(le)(rate(attachment_ready_duration_seconds_bucket[1m])))", "legendFormat": "{{service_instance_id}} {{outcome}}", "queryType": "range" } ], "fieldConfig": { "defaults": { "unit": "s" }, "overrides": [] }, "options": { "legend": { "displayMode": "table", "placement": "bottom" } }, "description": "histogram_quantile(0.95,sum by(le)(rate(attachment_ready_duration_seconds_bucket[1m])))" }, { "id": 9, "title": "Durable queue depth", "type": "timeseries", "gridPos": { "x": 0, "y": 32, "w": 12, "h": 8 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "targets": [ { "refId": "A", "expr": "max(queue_depth{service_name=\"messenger-publisher\"})", "legendFormat": "{{service_instance_id}} {{outcome}}", "queryType": "range" } ], "fieldConfig": { "defaults": { "unit": "short" }, "overrides": [] }, "options": { "legend": { "displayMode": "table", "placement": "bottom" } }, "description": "max(queue_depth{service_name=\"messenger-publisher\"})" }, { "id": 10, "title": "Oldest unfinished job", "type": "timeseries", "gridPos": { "x": 12, "y": 32, "w": 12, "h": 8 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "targets": [ { "refId": "A", "expr": "max(queue_oldest_age_seconds{service_name=\"messenger-publisher\"})", "legendFormat": "{{service_instance_id}} {{outcome}}", "queryType": "range" } ], "fieldConfig": { "defaults": { "unit": "s" }, "overrides": [] }, "options": { "legend": { "displayMode": "table", "placement": "bottom" } }, "description": "max(queue_oldest_age_seconds{service_name=\"messenger-publisher\"})" }, { "id": 11, "title": "DB pool used / process", "type": "timeseries", "gridPos": { "x": 0, "y": 40, "w": 12, "h": 8 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "targets": [ { "refId": "A", "expr": "db_pool_used", "legendFormat": "{{service_instance_id}} {{outcome}}", "queryType": "range" } ], "fieldConfig": { "defaults": { "unit": "short" }, "overrides": [] }, "options": { "legend": { "displayMode": "table", "placement": "bottom" } }, "description": "db_pool_used" }, { "id": 12, "title": "DB pool waiting / process", "type": "timeseries", "gridPos": { "x": 12, "y": 40, "w": 12, "h": 8 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "targets": [ { "refId": "A", "expr": "db_pool_waiting", "legendFormat": "{{service_instance_id}} {{outcome}}", "queryType": "range" } ], "fieldConfig": { "defaults": { "unit": "short" }, "overrides": [] }, "options": { "legend": { "displayMode": "table", "placement": "bottom" } }, "description": "db_pool_waiting" }, { "id": 13, "title": "Worker busy / configured capacity", "type": "timeseries", "gridPos": { "x": 0, "y": 48, "w": 12, "h": 8 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "targets": [ { "refId": "A", "expr": "max(worker_busy)/clamp_min(max(worker_capacity),1)", "legendFormat": "{{service_instance_id}} {{outcome}}", "queryType": "range" } ], "fieldConfig": { "defaults": { "unit": "percentunit" }, "overrides": [] }, "options": { "legend": { "displayMode": "table", "placement": "bottom" } }, "description": "max(worker_busy)/clamp_min(max(worker_capacity),1)" }, { "id": 14, "title": "Process resident RAM", "type": "timeseries", "gridPos": { "x": 12, "y": 48, "w": 12, "h": 8 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "targets": [ { "refId": "A", "expr": "process_memory_bytes", "legendFormat": "{{service_instance_id}} {{outcome}}", "queryType": "range" } ], "fieldConfig": { "defaults": { "unit": "bytes" }, "overrides": [] }, "options": { "legend": { "displayMode": "table", "placement": "bottom" } }, "description": "process_memory_bytes" }, { "id": 15, "title": "Process CPU cores", "type": "timeseries", "gridPos": { "x": 0, "y": 56, "w": 12, "h": 8 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "targets": [ { "refId": "A", "expr": "rate(process_cpu_seconds_total[1m])", "legendFormat": "{{service_instance_id}} {{outcome}}", "queryType": "range" } ], "fieldConfig": { "defaults": { "unit": "short" }, "overrides": [] }, "options": { "legend": { "displayMode": "table", "placement": "bottom" } }, "description": "rate(process_cpu_seconds_total[1m])" }, { "id": 16, "title": "Local alerts", "type": "timeseries", "gridPos": { "x": 12, "y": 56, "w": 12, "h": 8 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "targets": [ { "refId": "A", "expr": "ALERTS{alertstate=\"firing\"}", "legendFormat": "{{service_instance_id}} {{outcome}}", "queryType": "range" } ], "fieldConfig": { "defaults": { "unit": "short" }, "overrides": [] }, "options": { "legend": { "displayMode": "table", "placement": "bottom" } }, "description": "ALERTS{alertstate=\"firing\"}" }, { "id": 17, "title": "API structured logs", "type": "logs", "gridPos": { "x": 0, "y": 64, "w": 12, "h": 8 }, "datasource": { "type": "loki", "uid": "loki" }, "targets": [ { "refId": "A", "expr": "{service_name=\"messenger-api\"} | json", "legendFormat": "{{service_instance_id}} {{outcome}}", "queryType": "range" } ], "fieldConfig": { "defaults": { "unit": "short" }, "overrides": [] }, "options": { "legend": { "displayMode": "table", "placement": "bottom" } }, "description": "{service_name=\"messenger-api\"} | json" }, { "id": 18, "title": "Worker structured logs", "type": "logs", "gridPos": { "x": 12, "y": 64, "w": 12, "h": 8 }, "datasource": { "type": "loki", "uid": "loki" }, "targets": [ { "refId": "A", "expr": "{service_name=\"messenger-worker\"} | json", "legendFormat": "{{service_instance_id}} {{outcome}}", "queryType": "range" } ], "fieldConfig": { "defaults": { "unit": "short" }, "overrides": [] }, "options": { "legend": { "displayMode": "table", "placement": "bottom" } }, "description": "{service_name=\"messenger-worker\"} | json" }, { "id": 19, "title": "Exporter failed spans", "type": "timeseries", "gridPos": { "x": 0, "y": 72, "w": 12, "h": 8 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "targets": [ { "refId": "A", "expr": "sum(rate(otelcol_exporter_send_failed_spans_total[1m]))", "legendFormat": "{{service_instance_id}} {{outcome}}", "queryType": "range" } ], "fieldConfig": { "defaults": { "unit": "ops" }, "overrides": [] }, "options": { "legend": { "displayMode": "table", "placement": "bottom" } }, "description": "sum(rate(otelcol_exporter_send_failed_spans_total[1m]))" }, { "id": 20, "title": "Collector queue usage", "type": "timeseries", "gridPos": { "x": 12, "y": 72, "w": 12, "h": 8 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "targets": [ { "refId": "A", "expr": "otelcol_exporter_queue_size / clamp_min(otelcol_exporter_queue_capacity,1)", "legendFormat": "{{service_instance_id}} {{outcome}}", "queryType": "range" } ], "fieldConfig": { "defaults": { "unit": "percentunit" }, "overrides": [] }, "options": { "legend": { "displayMode": "table", "placement": "bottom" } }, "description": "otelcol_exporter_queue_size / clamp_min(otelcol_exporter_queue_capacity,1)" } ], "annotations": { "list": [] } }