{ "annotations": { "list": [] }, "editable": true, "graphTooltip": 1, "refresh": "30s", "schemaVersion": 41, "tags": ["erp", "bot"], "time": { "from": "now-24h", "to": "now" }, "timezone": "browser", "title": "بات — اکسپلورر ترس‌ها", "uid": "bot-trace-explorer", "version": 1, "panels": [ { "type": "table", "title": "آخرین ترس‌ها", "id": 1, "datasource": { "type": "postgres", "uid": "bot-postgres" }, "gridPos": { "h": 12, "w": 24, "x": 0, "y": 0 }, "targets": [{ "refId": "A", "format": "table", "rawSql": "SELECT t.id::text AS \"trace_id\", t.created_at AS \"زمان\", coalesce(t.source,'bale') AS \"منبع\", t.chat_id AS \"چت\", t.kind AS \"نوع\", coalesce(t.status,'—') AS \"وضعیت\", (SELECT count(*) FROM bot_trace_events e WHERE e.trace_id=t.id) AS \"رخدادها\" FROM bot_traces t WHERE ($trace_id = '' OR t.id::text = $trace_id) AND $__timeFilter(t.created_at) ORDER BY t.created_at DESC LIMIT 100" }], "fieldConfig": { "defaults": { "custom": { "align": "auto" } }, "overrides": [] } }, { "type": "table", "title": "رویدادهای ترس انتخاب‌شده (به ترتیب زمان)", "id": 2, "datasource": { "type": "postgres", "uid": "bot-postgres" }, "gridPos": { "h": 14, "w": 24, "x": 0, "y": 12 }, "targets": [{ "refId": "A", "format": "table", "rawSql": "SELECT e.created_at AS \"زمان\", e.stage AS \"مرحله\", e.ok AS \"ok\", coalesce(e.latency_ms::text,'—') AS \"تأخیر (ms)\", coalesce(e.model,'—') AS \"مدل\", coalesce(e.field,'—') AS \"فیلد\", left(e.payload::text, 700) AS \"payload\" FROM bot_trace_events e WHERE e.trace_id::text = $trace_id ORDER BY e.created_at ASC LIMIT 500" }], "fieldConfig": { "defaults": { "custom": { "align": "auto", "cellOptions": { "type": "text" } } }, "overrides": [] } } ], "templating": { "list": [ { "name": "trace_id", "label": "شناسه ترس", "type": "textbox", "hide": 0, "current": { "selected": false, "text": "", "value": "" }, "options": [], "query": "", "description": "trace_id را از جدول بالا کپی و اینجا بچسبانید" } ] } }