From da58d682c109bcd2e70f812bf48c367a5f5ea27a Mon Sep 17 00:00:00 2001 From: igor04091968 Date: Fri, 22 May 2026 09:48:28 +0300 Subject: [PATCH] fix(grafana): make file-1c dashboards live by default --- .../files/1c-executive-summary.json | 16 +++++------ .../files/1c-investigation-timeline.json | 28 +++++++++---------- .../files/1c-operations-health.json | 8 +++--- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/clickhouse-1c/grafana/provisioning/dashboards/files/1c-executive-summary.json b/clickhouse-1c/grafana/provisioning/dashboards/files/1c-executive-summary.json index c89da78..c9126f5 100644 --- a/clickhouse-1c/grafana/provisioning/dashboards/files/1c-executive-summary.json +++ b/clickhouse-1c/grafana/provisioning/dashboards/files/1c-executive-summary.json @@ -10,7 +10,7 @@ "panels": [ { "id": 1, - "title": "Продажи за 7 дней", + "title": "Снимки баз за 7 дней", "type": "stat", "datasource": { "type": "grafana-clickhouse-datasource", @@ -33,7 +33,7 @@ "format": 1, "pluginVersion": "11.2.2", "queryType": "table", - "rawSql": "SELECT sum(amount) AS value FROM analytics_1c.documents WHERE doc_type = 'Реализация' AND $__timeFilter(ts)", + "rawSql": "SELECT count() AS value FROM analytics_1c.documents WHERE doc_type = 'InfobaseSnapshot' AND $__timeFilter(ts)", "refId": "A" } ], @@ -79,7 +79,7 @@ }, { "id": 2, - "title": "Просроченная дебиторка", + "title": "Базы в состоянии busy", "type": "stat", "datasource": { "type": "grafana-clickhouse-datasource", @@ -102,7 +102,7 @@ "format": 1, "pluginVersion": "11.2.2", "queryType": "table", - "rawSql": "SELECT sum(amount) AS value FROM analytics_1c.documents WHERE status = 'overdue' AND $__timeFilter(ts)", + "rawSql": "SELECT countDistinct(infobase) AS value FROM analytics_1c.documents WHERE status = 'busy' AND $__timeFilter(ts)", "refId": "A" } ], @@ -286,7 +286,7 @@ }, { "id": 5, - "title": "Продажи по дням", + "title": "Снимки баз по дням", "type": "timeseries", "datasource": { "type": "grafana-clickhouse-datasource", @@ -309,7 +309,7 @@ "format": 1, "pluginVersion": "11.2.2", "queryType": "timeSeries", - "rawSql": "SELECT toStartOfDay(ts) AS time, sum(amount) AS value FROM analytics_1c.documents WHERE doc_type = 'Реализация' AND $__timeFilter(ts) GROUP BY time ORDER BY time", + "rawSql": "SELECT toStartOfDay(ts) AS time, count() AS value FROM analytics_1c.documents WHERE doc_type = 'InfobaseSnapshot' AND $__timeFilter(ts) GROUP BY time ORDER BY time", "refId": "A" } ], @@ -565,6 +565,6 @@ "timezone": "browser", "title": "1C File - Executive Summary", "uid": "1c-file-exec", - "version": 1, + "version": 2, "weekStart": "" -} \ No newline at end of file +} diff --git a/clickhouse-1c/grafana/provisioning/dashboards/files/1c-investigation-timeline.json b/clickhouse-1c/grafana/provisioning/dashboards/files/1c-investigation-timeline.json index 3c9c7f4..624f8cf 100644 --- a/clickhouse-1c/grafana/provisioning/dashboards/files/1c-investigation-timeline.json +++ b/clickhouse-1c/grafana/provisioning/dashboards/files/1c-investigation-timeline.json @@ -33,7 +33,7 @@ "format": 1, "pluginVersion": "11.2.2", "queryType": "table", - "rawSql": "SELECT ts, entity_type, entity_id, actor, source, event_type, severity, score, summary FROM analytics_1c.entity_timeline WHERE $__timeFilter(ts) AND entity_type = '${entity_type}' AND entity_id = '${entity_id}' ORDER BY ts DESC LIMIT 200", + "rawSql": "SELECT ts, entity_type, entity_id, actor, source, event_type, severity, score, summary FROM analytics_1c.entity_timeline WHERE $__timeFilter(ts) AND ('${entity_type}' IN ('', '$__all') OR entity_type = '${entity_type}') AND ('${entity_id}' IN ('', '$__all') OR entity_id = '${entity_id}') ORDER BY ts DESC LIMIT 200", "refId": "A" } ], @@ -76,7 +76,7 @@ "format": 1, "pluginVersion": "11.2.2", "queryType": "table", - "rawSql": "SELECT ts, rule_title, severity, score, summary FROM analytics_1c.detections WHERE entity_type = '${entity_type}' AND entity_id = '${entity_id}' AND $__timeFilter(ts) ORDER BY ts DESC LIMIT 100", + "rawSql": "SELECT ts, rule_title, severity, score, summary FROM analytics_1c.detections WHERE $__timeFilter(ts) AND ('${entity_type}' IN ('', '$__all') OR entity_type = '${entity_type}') AND ('${entity_id}' IN ('', '$__all') OR entity_id = '${entity_id}') ORDER BY ts DESC LIMIT 100", "refId": "A" } ], @@ -323,15 +323,15 @@ "uid": "clickhouse-1c" }, "refresh": 1, - "definition": "SELECT arrayJoin(['user','document','host'])", - "query": "SELECT arrayJoin(['user','document','host'])", + "definition": "SELECT DISTINCT entity_type FROM analytics_1c.entity_timeline ORDER BY entity_type", + "query": "SELECT DISTINCT entity_type FROM analytics_1c.entity_timeline ORDER BY entity_type", "multi": false, - "includeAll": false, + "includeAll": true, "sort": 1, "current": { "selected": false, - "text": "", - "value": "" + "text": "All", + "value": "$__all" } }, { @@ -343,15 +343,15 @@ "uid": "clickhouse-1c" }, "refresh": 1, - "definition": "SELECT DISTINCT entity_id FROM analytics_1c.entity_timeline ORDER BY entity_id", - "query": "SELECT DISTINCT entity_id FROM analytics_1c.entity_timeline ORDER BY entity_id", + "definition": "SELECT DISTINCT entity_id FROM analytics_1c.entity_timeline WHERE ('${entity_type}' IN ('', '$__all') OR entity_type = '${entity_type}') ORDER BY entity_id", + "query": "SELECT DISTINCT entity_id FROM analytics_1c.entity_timeline WHERE ('${entity_type}' IN ('', '$__all') OR entity_type = '${entity_type}') ORDER BY entity_id", "multi": false, - "includeAll": false, + "includeAll": true, "sort": 1, "current": { "selected": false, - "text": "", - "value": "" + "text": "All", + "value": "$__all" } } ] @@ -364,6 +364,6 @@ "timezone": "browser", "title": "1C File - Investigation Timeline", "uid": "1c-file-investigation", - "version": 1, + "version": 2, "weekStart": "" -} \ No newline at end of file +} diff --git a/clickhouse-1c/grafana/provisioning/dashboards/files/1c-operations-health.json b/clickhouse-1c/grafana/provisioning/dashboards/files/1c-operations-health.json index 1e51732..246d500 100644 --- a/clickhouse-1c/grafana/provisioning/dashboards/files/1c-operations-health.json +++ b/clickhouse-1c/grafana/provisioning/dashboards/files/1c-operations-health.json @@ -190,7 +190,7 @@ }, { "id": 5, - "title": "Длительные операции", + "title": "События занятости файловой базы", "type": "table", "datasource": { "type": "grafana-clickhouse-datasource", @@ -213,7 +213,7 @@ "format": 1, "pluginVersion": "11.2.2", "queryType": "table", - "rawSql": "SELECT ts, infobase, user, event_name, duration_ms, message FROM analytics_1c.reglog_events WHERE duration_ms > 3000 AND $__timeFilter(ts) ORDER BY duration_ms DESC LIMIT 50", + "rawSql": "SELECT ts, infobase, user, event_name, level, message FROM analytics_1c.reglog_events WHERE event_name = 'FileBaseBusy' AND $__timeFilter(ts) ORDER BY ts DESC LIMIT 50", "refId": "A" } ], @@ -332,6 +332,6 @@ "timezone": "browser", "title": "1C File - Operations Health", "uid": "1c-file-ops", - "version": 1, + "version": 2, "weekStart": "" -} \ No newline at end of file +}