unoffical wafrn mirror
wafrn.net
atproto
social-network
activitypub
1{
2 "annotations": {
3 "list": [
4 {
5 "builtIn": 1,
6 "datasource": {
7 "type": "datasource",
8 "uid": "grafana"
9 },
10 "enable": true,
11 "hide": true,
12 "iconColor": "rgba(0, 211, 255, 1)",
13 "name": "Annotations & Alerts",
14 "type": "dashboard"
15 }
16 ]
17 },
18 "editable": true,
19 "fiscalYearStartMonth": 0,
20 "graphTooltip": 0,
21 "links": [],
22 "panels": [
23 {
24 "datasource": {
25 "type": "grafana-postgresql-datasource",
26 "uid": "pgwatch-metrics"
27 },
28 "description": "Based on last 5m data. > 1 ~ Error. Causes WAL accumulation on the master and possibly autovacuum inefficiencies",
29 "fieldConfig": {
30 "defaults": {
31 "color": {
32 "mode": "thresholds"
33 },
34 "decimals": 0,
35 "mappings": [
36 {
37 "options": {
38 "match": "null",
39 "result": {
40 "text": "N/A"
41 }
42 },
43 "type": "special"
44 }
45 ],
46 "thresholds": {
47 "mode": "absolute",
48 "steps": [
49 {
50 "color": "#299c46",
51 "value": null
52 },
53 {
54 "color": "#bf1b00",
55 "value": 1
56 },
57 {
58 "color": "#d44a3a",
59 "value": 1000
60 }
61 ]
62 },
63 "unit": "none"
64 },
65 "overrides": []
66 },
67 "gridPos": {
68 "h": 2,
69 "w": 3,
70 "x": 0,
71 "y": 0
72 },
73 "hideTimeOverride": true,
74 "id": 4,
75 "maxDataPoints": 100,
76 "options": {
77 "colorMode": "background",
78 "graphMode": "none",
79 "justifyMode": "auto",
80 "orientation": "horizontal",
81 "reduceOptions": {
82 "calcs": [
83 "lastNotNull"
84 ],
85 "fields": "",
86 "values": false
87 },
88 "showPercentChange": false,
89 "textMode": "auto",
90 "wideLayout": true
91 },
92 "pluginVersion": "10.4.1",
93 "targets": [
94 {
95 "datasource": {
96 "type": "grafana-postgresql-datasource",
97 "uid": "pgwatch-metrics"
98 },
99 "format": "time_series",
100 "group": [],
101 "groupBy": [
102 {
103 "params": [
104 "1m"
105 ],
106 "type": "time"
107 },
108 {
109 "params": [
110 "none"
111 ],
112 "type": "fill"
113 }
114 ],
115 "measurement": "replication_slots",
116 "metricColumn": "none",
117 "orderByTime": "ASC",
118 "policy": "default",
119 "query": "select sum(\"last\") from (select last(\"non_active_int\") FROM \"replication_slots\" WHERE \"dbname\" =~ /^$dbname$/ AND $timeFilter group by \"dbname\", \"slot_name\")",
120 "rawQuery": true,
121 "rawSql": "SELECT\n 0 as time,\n sum((data->'non_active_int')::int)\nFROM\n replication_slots\nWHERE\n time in (select max(time) from replication_slots where $__timeFilter(time) AND dbname in ($dbname) group by dbname)\n AND dbname in ($dbname)\n",
122 "refId": "A",
123 "resultFormat": "time_series",
124 "select": [
125 [
126 {
127 "params": [
128 "active"
129 ],
130 "type": "field"
131 },
132 {
133 "params": [],
134 "type": "last"
135 }
136 ]
137 ],
138 "tags": [],
139 "timeColumn": "time",
140 "where": [
141 {
142 "name": "$__timeFilter",
143 "params": [],
144 "type": "macro"
145 }
146 ]
147 }
148 ],
149 "timeFrom": "5m",
150 "title": "Inactive repl. slots",
151 "type": "stat"
152 },
153 {
154 "datasource": {
155 "type": "grafana-postgresql-datasource",
156 "uid": "pgwatch-metrics"
157 },
158 "description": "Based on last 5m data. FYI - no thresholds defined",
159 "fieldConfig": {
160 "defaults": {
161 "color": {
162 "mode": "thresholds"
163 },
164 "decimals": 0,
165 "mappings": [
166 {
167 "options": {
168 "match": "null",
169 "result": {
170 "text": "N/A"
171 }
172 },
173 "type": "special"
174 }
175 ],
176 "thresholds": {
177 "mode": "absolute",
178 "steps": [
179 {
180 "color": "#299c46",
181 "value": null
182 },
183 {
184 "color": "#bf1b00",
185 "value": 1
186 },
187 {
188 "color": "#d44a3a",
189 "value": 1000
190 }
191 ]
192 },
193 "unit": "none"
194 },
195 "overrides": []
196 },
197 "gridPos": {
198 "h": 2,
199 "w": 3,
200 "x": 3,
201 "y": 0
202 },
203 "hideTimeOverride": true,
204 "id": 13,
205 "maxDataPoints": 100,
206 "options": {
207 "colorMode": "none",
208 "graphMode": "none",
209 "justifyMode": "auto",
210 "orientation": "horizontal",
211 "reduceOptions": {
212 "calcs": [
213 "lastNotNull"
214 ],
215 "fields": "",
216 "values": false
217 },
218 "showPercentChange": false,
219 "textMode": "auto",
220 "wideLayout": true
221 },
222 "pluginVersion": "10.4.1",
223 "targets": [
224 {
225 "datasource": {
226 "type": "grafana-postgresql-datasource",
227 "uid": "pgwatch-metrics"
228 },
229 "format": "time_series",
230 "group": [],
231 "groupBy": [
232 {
233 "params": [
234 "1m"
235 ],
236 "type": "time"
237 },
238 {
239 "params": [
240 "none"
241 ],
242 "type": "fill"
243 }
244 ],
245 "measurement": "replication_slots",
246 "metricColumn": "none",
247 "orderByTime": "ASC",
248 "policy": "default",
249 "query": "select count(\"active\") from (select last(\"active\") as \"active\" FROM \"replication_slots\" WHERE \"dbname\" =~ /^$dbname$/ AND $timeFilter group by \"dbname\", \"slot_name\") WHERE \"active\" = true",
250 "rawQuery": true,
251 "rawSql": "SELECT\n 0 as time,\n count(*) filter (where data->>'non_active_int' = '0')\nFROM\n replication_slots\nWHERE\n time in (select max(time) from replication_slots where $__timeFilter(time) AND dbname in ($dbname) group by dbname)\n AND dbname in ($dbname)\n",
252 "refId": "A",
253 "resultFormat": "time_series",
254 "select": [
255 [
256 {
257 "params": [
258 "active"
259 ],
260 "type": "field"
261 },
262 {
263 "params": [],
264 "type": "last"
265 }
266 ]
267 ],
268 "tags": [],
269 "timeColumn": "time",
270 "where": [
271 {
272 "name": "$__timeFilter",
273 "params": [],
274 "type": "macro"
275 }
276 ]
277 }
278 ],
279 "timeFrom": "5m",
280 "title": "Active repl. slots",
281 "type": "stat"
282 },
283 {
284 "datasource": {
285 "type": "grafana-postgresql-datasource",
286 "uid": "pgwatch-metrics"
287 },
288 "description": "Data is available only on connected replicas. No thresholds by default",
289 "fieldConfig": {
290 "defaults": {
291 "color": {
292 "mode": "thresholds"
293 },
294 "decimals": 0,
295 "mappings": [
296 {
297 "options": {
298 "match": "null",
299 "result": {
300 "text": "N/A"
301 }
302 },
303 "type": "special"
304 }
305 ],
306 "thresholds": {
307 "mode": "absolute",
308 "steps": [
309 {
310 "color": "#299c46",
311 "value": null
312 },
313 {
314 "color": "rgba(237, 129, 40, 0.89)",
315 "value": 100000000
316 },
317 {
318 "color": "#d44a3a",
319 "value": 1000000000
320 }
321 ]
322 },
323 "unit": "short"
324 },
325 "overrides": []
326 },
327 "gridPos": {
328 "h": 2,
329 "w": 3,
330 "x": 6,
331 "y": 0
332 },
333 "hideTimeOverride": true,
334 "id": 14,
335 "maxDataPoints": 100,
336 "options": {
337 "colorMode": "none",
338 "graphMode": "none",
339 "justifyMode": "auto",
340 "orientation": "horizontal",
341 "reduceOptions": {
342 "calcs": [
343 "lastNotNull"
344 ],
345 "fields": "",
346 "values": false
347 },
348 "showPercentChange": false,
349 "textMode": "auto",
350 "wideLayout": true
351 },
352 "pluginVersion": "10.4.1",
353 "targets": [
354 {
355 "datasource": {
356 "type": "grafana-postgresql-datasource",
357 "uid": "pgwatch-metrics"
358 },
359 "format": "time_series",
360 "group": [],
361 "groupBy": [
362 {
363 "params": [
364 "1d"
365 ],
366 "type": "time"
367 },
368 {
369 "params": [
370 "none"
371 ],
372 "type": "fill"
373 }
374 ],
375 "measurement": "replication",
376 "metricColumn": "none",
377 "orderByTime": "ASC",
378 "policy": "default",
379 "query": "select count(\"last\") from (SELECT last(\"state\") FROM \"replication\" WHERE (\"dbname\" =~ /^$dbname$/) AND $timeFilter GROUP BY time(1d), dbname, client_info fill(none)) where \"last\" = 'streaming'",
380 "rawQuery": true,
381 "rawSql": "SELECT\n 0 as time,\n count(*)\nFROM\n replication\nWHERE\n time in (select max(time) from replication where $__timeFilter(time) AND dbname in ($dbname) group by dbname)\n AND dbname in ($dbname)\n",
382 "refId": "A",
383 "resultFormat": "time_series",
384 "select": [
385 [
386 {
387 "params": [
388 "replay_lag_b"
389 ],
390 "type": "field"
391 },
392 {
393 "params": [],
394 "type": "count"
395 }
396 ]
397 ],
398 "tags": [
399 {
400 "key": "dbname",
401 "operator": "=~",
402 "value": "/^$dbname$/"
403 }
404 ],
405 "timeColumn": "time",
406 "where": [
407 {
408 "name": "$__timeFilter",
409 "params": [],
410 "type": "macro"
411 }
412 ]
413 }
414 ],
415 "timeFrom": "5m",
416 "title": "Active replicas",
417 "type": "stat"
418 },
419 {
420 "datasource": {
421 "type": "grafana-postgresql-datasource",
422 "uid": "pgwatch-metrics"
423 },
424 "description": "Data is available only on connected replicas. No thresholds by default",
425 "fieldConfig": {
426 "defaults": {
427 "color": {
428 "mode": "thresholds"
429 },
430 "decimals": 0,
431 "mappings": [
432 {
433 "options": {
434 "match": "null",
435 "result": {
436 "text": "N/A"
437 }
438 },
439 "type": "special"
440 }
441 ],
442 "thresholds": {
443 "mode": "absolute",
444 "steps": [
445 {
446 "color": "green",
447 "value": null
448 },
449 {
450 "color": "red",
451 "value": 80
452 }
453 ]
454 },
455 "unit": "short"
456 },
457 "overrides": []
458 },
459 "gridPos": {
460 "h": 2,
461 "w": 3,
462 "x": 9,
463 "y": 0
464 },
465 "hideTimeOverride": true,
466 "id": 15,
467 "maxDataPoints": 100,
468 "options": {
469 "colorMode": "none",
470 "graphMode": "none",
471 "justifyMode": "auto",
472 "orientation": "horizontal",
473 "reduceOptions": {
474 "calcs": [
475 "lastNotNull"
476 ],
477 "fields": "",
478 "values": false
479 },
480 "showPercentChange": false,
481 "textMode": "auto",
482 "wideLayout": true
483 },
484 "pluginVersion": "10.4.1",
485 "targets": [
486 {
487 "datasource": {
488 "type": "grafana-postgresql-datasource",
489 "uid": "pgwatch-metrics"
490 },
491 "format": "time_series",
492 "group": [],
493 "groupBy": [
494 {
495 "params": [
496 "1d"
497 ],
498 "type": "time"
499 },
500 {
501 "params": [
502 "none"
503 ],
504 "type": "fill"
505 }
506 ],
507 "measurement": "replication",
508 "metricColumn": "none",
509 "orderByTime": "ASC",
510 "policy": "default",
511 "query": "select sum(\"last\") from (SELECT last(\"is_sync_int\") FROM \"replication\" WHERE (\"dbname\" =~ /^$dbname$/) AND $timeFilter GROUP BY time(1d), dbname, client_info fill(none))",
512 "rawQuery": true,
513 "rawSql": "SELECT\n 0 as time,\n count(*) filter (where data->>'is_sync_int' = '1') \nFROM\n replication\nWHERE\n time in (select max(time) from replication where $__timeFilter(time) AND dbname in ($dbname) group by dbname)\n AND dbname in ($dbname)\n",
514 "refId": "A",
515 "resultFormat": "time_series",
516 "select": [
517 [
518 {
519 "params": [
520 "replay_lag_b"
521 ],
522 "type": "field"
523 },
524 {
525 "params": [],
526 "type": "count"
527 }
528 ]
529 ],
530 "tags": [
531 {
532 "key": "dbname",
533 "operator": "=~",
534 "value": "/^$dbname$/"
535 }
536 ],
537 "timeColumn": "time",
538 "where": [
539 {
540 "name": "$__timeFilter",
541 "params": [],
542 "type": "macro"
543 }
544 ]
545 }
546 ],
547 "timeFrom": "5m",
548 "title": "Active \"sync\" replicas",
549 "type": "stat"
550 },
551 {
552 "datasource": {
553 "type": "grafana-postgresql-datasource",
554 "uid": "pgwatch-metrics"
555 },
556 "description": "Based on last 5m of \"pg_replication_slots.restart_lsn\" and translates to \"overhead\" WAL folder size",
557 "fieldConfig": {
558 "defaults": {
559 "color": {
560 "mode": "thresholds"
561 },
562 "decimals": 1,
563 "mappings": [
564 {
565 "options": {
566 "match": "null",
567 "result": {
568 "text": "N/A"
569 }
570 },
571 "type": "special"
572 }
573 ],
574 "thresholds": {
575 "mode": "absolute",
576 "steps": [
577 {
578 "color": "#299c46",
579 "value": null
580 },
581 {
582 "color": "rgba(237, 129, 40, 0.89)",
583 "value": 16000000
584 },
585 {
586 "color": "#d44a3a",
587 "value": 1000000000
588 }
589 ]
590 },
591 "unit": "bytes"
592 },
593 "overrides": []
594 },
595 "gridPos": {
596 "h": 2,
597 "w": 3,
598 "x": 12,
599 "y": 0
600 },
601 "hideTimeOverride": true,
602 "id": 7,
603 "maxDataPoints": 100,
604 "options": {
605 "colorMode": "background",
606 "graphMode": "none",
607 "justifyMode": "auto",
608 "orientation": "horizontal",
609 "reduceOptions": {
610 "calcs": [
611 "lastNotNull"
612 ],
613 "fields": "",
614 "values": false
615 },
616 "showPercentChange": false,
617 "textMode": "auto",
618 "wideLayout": true
619 },
620 "pluginVersion": "10.4.1",
621 "targets": [
622 {
623 "datasource": {
624 "type": "grafana-postgresql-datasource",
625 "uid": "pgwatch-metrics"
626 },
627 "format": "time_series",
628 "group": [],
629 "groupBy": [
630 {
631 "params": [
632 "$__interval"
633 ],
634 "type": "time"
635 },
636 {
637 "params": [
638 "none"
639 ],
640 "type": "fill"
641 }
642 ],
643 "measurement": "replication_slots",
644 "metricColumn": "none",
645 "orderByTime": "ASC",
646 "policy": "default",
647 "query": "SELECT max(\"restart_lsn_lag_b\") FROM \"replication_slots\" WHERE \"dbname\" =~ /^$dbname$/ AND $timeFilter GROUP BY time(1d) fill(none)",
648 "rawQuery": true,
649 "rawSql": "SELECT\n 0 as time,\n max((data->'restart_lsn_lag_b')::int8)\nFROM\n replication_slots\nWHERE\n time in (select max(time) from replication_slots where $__timeFilter(time) AND dbname in ($dbname) group by dbname)\n AND dbname in ($dbname)\n\n",
650 "refId": "A",
651 "resultFormat": "time_series",
652 "select": [
653 [
654 {
655 "params": [
656 "restart_lsn_lag_b"
657 ],
658 "type": "field"
659 },
660 {
661 "params": [],
662 "type": "max"
663 }
664 ]
665 ],
666 "tags": [],
667 "timeColumn": "time",
668 "where": [
669 {
670 "name": "$__timeFilter",
671 "params": [],
672 "type": "macro"
673 }
674 ]
675 }
676 ],
677 "timeFrom": "5m",
678 "title": "Slot max. restart_lsn lag",
679 "type": "stat"
680 },
681 {
682 "datasource": {
683 "type": "grafana-postgresql-datasource",
684 "uid": "pgwatch-metrics"
685 },
686 "description": "Data is available only on connected replicas! Based on last 5m data.",
687 "fieldConfig": {
688 "defaults": {
689 "color": {
690 "mode": "thresholds"
691 },
692 "decimals": 1,
693 "mappings": [
694 {
695 "options": {
696 "match": "null",
697 "result": {
698 "text": "N/A"
699 }
700 },
701 "type": "special"
702 }
703 ],
704 "thresholds": {
705 "mode": "absolute",
706 "steps": [
707 {
708 "color": "#299c46",
709 "value": null
710 },
711 {
712 "color": "rgba(237, 129, 40, 0.89)",
713 "value": 100000000
714 },
715 {
716 "color": "#d44a3a",
717 "value": 1000000000
718 }
719 ]
720 },
721 "unit": "bytes"
722 },
723 "overrides": []
724 },
725 "gridPos": {
726 "h": 2,
727 "w": 3,
728 "x": 15,
729 "y": 0
730 },
731 "hideTimeOverride": true,
732 "id": 6,
733 "maxDataPoints": 100,
734 "options": {
735 "colorMode": "value",
736 "graphMode": "none",
737 "justifyMode": "auto",
738 "orientation": "horizontal",
739 "reduceOptions": {
740 "calcs": [
741 "lastNotNull"
742 ],
743 "fields": "",
744 "values": false
745 },
746 "showPercentChange": false,
747 "textMode": "auto",
748 "wideLayout": true
749 },
750 "pluginVersion": "10.4.1",
751 "targets": [
752 {
753 "datasource": {
754 "type": "grafana-postgresql-datasource",
755 "uid": "pgwatch-metrics"
756 },
757 "format": "time_series",
758 "group": [],
759 "groupBy": [
760 {
761 "params": [
762 "1d"
763 ],
764 "type": "time"
765 },
766 {
767 "params": [
768 "none"
769 ],
770 "type": "fill"
771 }
772 ],
773 "measurement": "replication",
774 "metricColumn": "none",
775 "orderByTime": "ASC",
776 "policy": "default",
777 "query": "SELECT max(\"write_lag_b\") FROM \"replication\" WHERE $timeFilter GROUP BY time($__interval) fill(none)",
778 "rawQuery": true,
779 "rawSql": "SELECT\n 0 as time,\n max((data->'write_lag_b')::int8)\nFROM\n replication\nWHERE\n time in (select max(time) from replication where $__timeFilter(time) AND dbname in ($dbname) group by dbname)\n AND dbname in ($dbname)\n\n",
780 "refId": "A",
781 "resultFormat": "time_series",
782 "select": [
783 [
784 {
785 "params": [
786 "write_lag_b"
787 ],
788 "type": "field"
789 },
790 {
791 "params": [],
792 "type": "max"
793 }
794 ]
795 ],
796 "tags": [
797 {
798 "key": "dbname",
799 "operator": "=~",
800 "value": "/^$dbname$/"
801 }
802 ],
803 "timeColumn": "time",
804 "where": [
805 {
806 "name": "$__timeFilter",
807 "params": [],
808 "type": "macro"
809 }
810 ]
811 }
812 ],
813 "timeFrom": "5m",
814 "title": "Max. write lag",
815 "type": "stat"
816 },
817 {
818 "datasource": {
819 "type": "grafana-postgresql-datasource",
820 "uid": "pgwatch-metrics"
821 },
822 "description": "Data is available only on connected replicas! Based on last 5m data.",
823 "fieldConfig": {
824 "defaults": {
825 "color": {
826 "mode": "thresholds"
827 },
828 "decimals": 1,
829 "mappings": [
830 {
831 "options": {
832 "match": "null",
833 "result": {
834 "text": "N/A"
835 }
836 },
837 "type": "special"
838 }
839 ],
840 "thresholds": {
841 "mode": "absolute",
842 "steps": [
843 {
844 "color": "#299c46",
845 "value": null
846 },
847 {
848 "color": "rgba(237, 129, 40, 0.89)",
849 "value": 100000000
850 },
851 {
852 "color": "#d44a3a",
853 "value": 1000000000
854 }
855 ]
856 },
857 "unit": "bytes"
858 },
859 "overrides": []
860 },
861 "gridPos": {
862 "h": 2,
863 "w": 3,
864 "x": 18,
865 "y": 0
866 },
867 "hideTimeOverride": true,
868 "id": 16,
869 "maxDataPoints": 100,
870 "options": {
871 "colorMode": "value",
872 "graphMode": "none",
873 "justifyMode": "auto",
874 "orientation": "horizontal",
875 "reduceOptions": {
876 "calcs": [
877 "lastNotNull"
878 ],
879 "fields": "",
880 "values": false
881 },
882 "showPercentChange": false,
883 "textMode": "auto",
884 "wideLayout": true
885 },
886 "pluginVersion": "10.4.1",
887 "targets": [
888 {
889 "datasource": {
890 "type": "grafana-postgresql-datasource",
891 "uid": "pgwatch-metrics"
892 },
893 "format": "time_series",
894 "group": [],
895 "groupBy": [
896 {
897 "params": [
898 "1d"
899 ],
900 "type": "time"
901 },
902 {
903 "params": [
904 "none"
905 ],
906 "type": "fill"
907 }
908 ],
909 "measurement": "replication",
910 "metricColumn": "none",
911 "orderByTime": "ASC",
912 "policy": "default",
913 "query": "SELECT max(\"write_lag_b\") FROM \"replication\" WHERE $timeFilter GROUP BY time($__interval) fill(none)",
914 "rawQuery": true,
915 "rawSql": "SELECT\n 0 as time,\n max((data->'flush_lag_b')::int8)\nFROM\n replication\nWHERE\n time in (select max(time) from replication where $__timeFilter(time) AND dbname in ($dbname) group by dbname)\n AND dbname in ($dbname)\n\n",
916 "refId": "A",
917 "resultFormat": "time_series",
918 "select": [
919 [
920 {
921 "params": [
922 "flush_lag_b"
923 ],
924 "type": "field"
925 },
926 {
927 "params": [],
928 "type": "max"
929 }
930 ]
931 ],
932 "tags": [
933 {
934 "key": "dbname",
935 "operator": "=~",
936 "value": "/^$dbname$/"
937 }
938 ],
939 "timeColumn": "time",
940 "where": [
941 {
942 "name": "$__timeFilter",
943 "params": [],
944 "type": "macro"
945 }
946 ]
947 }
948 ],
949 "timeFrom": "5m",
950 "title": "Max. flush lag",
951 "type": "stat"
952 },
953 {
954 "datasource": {
955 "type": "grafana-postgresql-datasource",
956 "uid": "pgwatch-metrics"
957 },
958 "description": "Data is available only on connected replicas! Based on last 5m data.",
959 "fieldConfig": {
960 "defaults": {
961 "color": {
962 "mode": "thresholds"
963 },
964 "decimals": 1,
965 "mappings": [
966 {
967 "options": {
968 "match": "null",
969 "result": {
970 "text": "N/A"
971 }
972 },
973 "type": "special"
974 }
975 ],
976 "thresholds": {
977 "mode": "absolute",
978 "steps": [
979 {
980 "color": "#299c46",
981 "value": null
982 },
983 {
984 "color": "rgba(237, 129, 40, 0.89)",
985 "value": 100000000
986 },
987 {
988 "color": "#d44a3a",
989 "value": 1000000000
990 }
991 ]
992 },
993 "unit": "bytes"
994 },
995 "overrides": []
996 },
997 "gridPos": {
998 "h": 2,
999 "w": 3,
1000 "x": 21,
1001 "y": 0
1002 },
1003 "hideTimeOverride": true,
1004 "id": 9,
1005 "maxDataPoints": 100,
1006 "options": {
1007 "colorMode": "value",
1008 "graphMode": "none",
1009 "justifyMode": "auto",
1010 "orientation": "horizontal",
1011 "reduceOptions": {
1012 "calcs": [
1013 "lastNotNull"
1014 ],
1015 "fields": "",
1016 "values": false
1017 },
1018 "showPercentChange": false,
1019 "textMode": "auto",
1020 "wideLayout": true
1021 },
1022 "pluginVersion": "10.4.1",
1023 "targets": [
1024 {
1025 "datasource": {
1026 "type": "grafana-postgresql-datasource",
1027 "uid": "pgwatch-metrics"
1028 },
1029 "format": "time_series",
1030 "group": [],
1031 "groupBy": [
1032 {
1033 "params": [
1034 "1d"
1035 ],
1036 "type": "time"
1037 },
1038 {
1039 "params": [
1040 "none"
1041 ],
1042 "type": "fill"
1043 }
1044 ],
1045 "measurement": "replication",
1046 "metricColumn": "none",
1047 "orderByTime": "ASC",
1048 "policy": "default",
1049 "query": "SELECT max(\"replay_lag_b\") FROM \"replication\" WHERE (\"dbname\" =~ /^$dbname$/) AND $timeFilter GROUP BY time($__interval) fill(none)",
1050 "rawQuery": true,
1051 "rawSql": "SELECT\n 0 as time,\n max((data->'replay_lag_b')::int8)\nFROM\n replication\nWHERE\n time in (select max(time) from replication where $__timeFilter(time) AND dbname in ($dbname) group by dbname)\n AND dbname in ($dbname)\n\n",
1052 "refId": "A",
1053 "resultFormat": "time_series",
1054 "select": [
1055 [
1056 {
1057 "params": [
1058 "replay_lag_b"
1059 ],
1060 "type": "field"
1061 },
1062 {
1063 "params": [],
1064 "type": "max"
1065 }
1066 ]
1067 ],
1068 "tags": [
1069 {
1070 "key": "dbname",
1071 "operator": "=~",
1072 "value": "/^$dbname$/"
1073 }
1074 ],
1075 "timeColumn": "time",
1076 "where": [
1077 {
1078 "name": "$__timeFilter",
1079 "params": [],
1080 "type": "macro"
1081 }
1082 ]
1083 }
1084 ],
1085 "timeFrom": "5m",
1086 "title": "Max. replay lag",
1087 "type": "stat"
1088 },
1089 {
1090 "datasource": {
1091 "type": "grafana-postgresql-datasource",
1092 "uid": "pgwatch-metrics"
1093 },
1094 "description": "Based on pg_replication_slots. Primary only",
1095 "fieldConfig": {
1096 "defaults": {
1097 "color": {
1098 "mode": "palette-classic"
1099 },
1100 "custom": {
1101 "axisBorderShow": false,
1102 "axisCenteredZero": false,
1103 "axisColorMode": "text",
1104 "axisLabel": "",
1105 "axisPlacement": "auto",
1106 "barAlignment": 0,
1107 "drawStyle": "line",
1108 "fillOpacity": 10,
1109 "gradientMode": "none",
1110 "hideFrom": {
1111 "legend": false,
1112 "tooltip": false,
1113 "viz": false
1114 },
1115 "insertNulls": false,
1116 "lineInterpolation": "linear",
1117 "lineWidth": 1,
1118 "pointSize": 5,
1119 "scaleDistribution": {
1120 "type": "linear"
1121 },
1122 "showPoints": "never",
1123 "spanNulls": false,
1124 "stacking": {
1125 "group": "A",
1126 "mode": "none"
1127 },
1128 "thresholdsStyle": {
1129 "mode": "off"
1130 }
1131 },
1132 "mappings": [],
1133 "min": 0,
1134 "thresholds": {
1135 "mode": "absolute",
1136 "steps": [
1137 {
1138 "color": "green",
1139 "value": null
1140 },
1141 {
1142 "color": "red",
1143 "value": 80
1144 }
1145 ]
1146 },
1147 "unit": "bytes"
1148 },
1149 "overrides": []
1150 },
1151 "gridPos": {
1152 "h": 4,
1153 "w": 24,
1154 "x": 0,
1155 "y": 2
1156 },
1157 "id": 2,
1158 "interval": "5m",
1159 "options": {
1160 "legend": {
1161 "calcs": [
1162 "mean"
1163 ],
1164 "displayMode": "list",
1165 "placement": "bottom",
1166 "showLegend": true
1167 },
1168 "tooltip": {
1169 "mode": "multi",
1170 "sort": "none"
1171 }
1172 },
1173 "pluginVersion": "10.4.1",
1174 "targets": [
1175 {
1176 "alias": "[[tag_dbname]] slot=[[tag_slot_name]]",
1177 "datasource": {
1178 "type": "grafana-postgresql-datasource",
1179 "uid": "pgwatch-metrics"
1180 },
1181 "format": "time_series",
1182 "group": [],
1183 "groupBy": [
1184 {
1185 "params": [
1186 "$__interval"
1187 ],
1188 "type": "time"
1189 },
1190 {
1191 "params": [
1192 "dbname"
1193 ],
1194 "type": "tag"
1195 },
1196 {
1197 "params": [
1198 "slot_name"
1199 ],
1200 "type": "tag"
1201 },
1202 {
1203 "params": [
1204 "none"
1205 ],
1206 "type": "fill"
1207 }
1208 ],
1209 "measurement": "replication_slots",
1210 "metricColumn": "none",
1211 "orderByTime": "ASC",
1212 "policy": "default",
1213 "query": "",
1214 "rawQuery": true,
1215 "rawSql": "SELECT\n $__timeGroup(time, $__interval),\n dbname,\n max((data->'restart_lsn_lag_b')::int8)\nFROM\n replication_slots\nWHERE\n $__timeFilter(time)\n AND dbname in ($dbname)\nGROUP BY 1, 2\nORDER BY 1, 2\n\n",
1216 "refId": "A",
1217 "resultFormat": "time_series",
1218 "select": [
1219 [
1220 {
1221 "params": [
1222 "restart_lsn_lag_b"
1223 ],
1224 "type": "field"
1225 },
1226 {
1227 "params": [],
1228 "type": "mean"
1229 }
1230 ]
1231 ],
1232 "tags": [
1233 {
1234 "key": "dbname",
1235 "operator": "=~",
1236 "value": "/^$dbname$/"
1237 }
1238 ],
1239 "timeColumn": "time",
1240 "where": [
1241 {
1242 "name": "$__timeFilter",
1243 "params": [],
1244 "type": "macro"
1245 }
1246 ]
1247 }
1248 ],
1249 "title": "Replication slot restart_lsn lag (primary extra WAL size)",
1250 "type": "timeseries"
1251 },
1252 {
1253 "datasource": {
1254 "type": "grafana-postgresql-datasource",
1255 "uid": "pgwatch-metrics"
1256 },
1257 "description": "Based on pg_stat_replication on primaries. Data is available only on connected replicas!",
1258 "fieldConfig": {
1259 "defaults": {
1260 "color": {
1261 "mode": "palette-classic"
1262 },
1263 "custom": {
1264 "axisBorderShow": false,
1265 "axisCenteredZero": false,
1266 "axisColorMode": "text",
1267 "axisLabel": "",
1268 "axisPlacement": "auto",
1269 "barAlignment": 0,
1270 "drawStyle": "line",
1271 "fillOpacity": 10,
1272 "gradientMode": "none",
1273 "hideFrom": {
1274 "legend": false,
1275 "tooltip": false,
1276 "viz": false
1277 },
1278 "insertNulls": false,
1279 "lineInterpolation": "linear",
1280 "lineWidth": 1,
1281 "pointSize": 5,
1282 "scaleDistribution": {
1283 "type": "linear"
1284 },
1285 "showPoints": "never",
1286 "spanNulls": false,
1287 "stacking": {
1288 "group": "A",
1289 "mode": "none"
1290 },
1291 "thresholdsStyle": {
1292 "mode": "off"
1293 }
1294 },
1295 "mappings": [],
1296 "min": 0,
1297 "thresholds": {
1298 "mode": "absolute",
1299 "steps": [
1300 {
1301 "color": "green",
1302 "value": null
1303 },
1304 {
1305 "color": "red",
1306 "value": 80
1307 }
1308 ]
1309 },
1310 "unit": "bytes"
1311 },
1312 "overrides": []
1313 },
1314 "gridPos": {
1315 "h": 4,
1316 "w": 24,
1317 "x": 0,
1318 "y": 6
1319 },
1320 "id": 17,
1321 "interval": "2m",
1322 "options": {
1323 "legend": {
1324 "calcs": [
1325 "mean"
1326 ],
1327 "displayMode": "list",
1328 "placement": "bottom",
1329 "showLegend": true
1330 },
1331 "tooltip": {
1332 "mode": "multi",
1333 "sort": "none"
1334 }
1335 },
1336 "pluginVersion": "10.4.1",
1337 "targets": [
1338 {
1339 "alias": "[[tag_dbname]] [[tag_application_name]] [[tag_client_info]]",
1340 "datasource": {
1341 "type": "grafana-postgresql-datasource",
1342 "uid": "pgwatch-metrics"
1343 },
1344 "format": "time_series",
1345 "group": [],
1346 "groupBy": [
1347 {
1348 "params": [
1349 "$__interval"
1350 ],
1351 "type": "time"
1352 },
1353 {
1354 "params": [
1355 "dbname"
1356 ],
1357 "type": "tag"
1358 },
1359 {
1360 "params": [
1361 "client_info"
1362 ],
1363 "type": "tag"
1364 },
1365 {
1366 "params": [
1367 "application_name"
1368 ],
1369 "type": "tag"
1370 },
1371 {
1372 "params": [
1373 "none"
1374 ],
1375 "type": "fill"
1376 }
1377 ],
1378 "measurement": "replication",
1379 "metricColumn": "none",
1380 "orderByTime": "ASC",
1381 "policy": "default",
1382 "query": "SELECT mean(\"write_lag_b\") FROM \"replication\" WHERE (\"dbname\" =~ /^$dbname$/) AND $timeFilter GROUP BY time($__interval), \"dbname\", \"client_info\", \"application_name\" fill(none)",
1383 "rawQuery": true,
1384 "rawSql": "SELECT\n $__timeGroup(time, $__interval),\n dbname,\n avg((data->'flush_lag_b')::int8)\nFROM\n replication\nWHERE\n $__timeFilter(time)\n AND dbname in ($dbname)\nGROUP BY\n 1, 2\nORDER BY\n 1, 2\n \n",
1385 "refId": "B",
1386 "resultFormat": "time_series",
1387 "select": [
1388 [
1389 {
1390 "params": [
1391 "flush_lag_b"
1392 ],
1393 "type": "field"
1394 },
1395 {
1396 "params": [],
1397 "type": "mean"
1398 }
1399 ]
1400 ],
1401 "tags": [
1402 {
1403 "key": "dbname",
1404 "operator": "=~",
1405 "value": "/^$dbname$/"
1406 }
1407 ],
1408 "timeColumn": "time",
1409 "where": [
1410 {
1411 "name": "$__timeFilter",
1412 "params": [],
1413 "type": "macro"
1414 }
1415 ]
1416 }
1417 ],
1418 "title": "Replication flush lag",
1419 "type": "timeseries"
1420 },
1421 {
1422 "datasource": {
1423 "type": "grafana-postgresql-datasource",
1424 "uid": "pgwatch-metrics"
1425 },
1426 "description": "Based on pg_stat_replication on primaries. Data is available only on connected replicas!",
1427 "fieldConfig": {
1428 "defaults": {
1429 "color": {
1430 "mode": "palette-classic"
1431 },
1432 "custom": {
1433 "axisBorderShow": false,
1434 "axisCenteredZero": false,
1435 "axisColorMode": "text",
1436 "axisLabel": "",
1437 "axisPlacement": "auto",
1438 "barAlignment": 0,
1439 "drawStyle": "line",
1440 "fillOpacity": 10,
1441 "gradientMode": "none",
1442 "hideFrom": {
1443 "legend": false,
1444 "tooltip": false,
1445 "viz": false
1446 },
1447 "insertNulls": false,
1448 "lineInterpolation": "linear",
1449 "lineWidth": 1,
1450 "pointSize": 5,
1451 "scaleDistribution": {
1452 "type": "linear"
1453 },
1454 "showPoints": "never",
1455 "spanNulls": false,
1456 "stacking": {
1457 "group": "A",
1458 "mode": "none"
1459 },
1460 "thresholdsStyle": {
1461 "mode": "off"
1462 }
1463 },
1464 "mappings": [],
1465 "min": 0,
1466 "thresholds": {
1467 "mode": "absolute",
1468 "steps": [
1469 {
1470 "color": "green",
1471 "value": null
1472 },
1473 {
1474 "color": "red",
1475 "value": 80
1476 }
1477 ]
1478 },
1479 "unit": "bytes"
1480 },
1481 "overrides": []
1482 },
1483 "gridPos": {
1484 "h": 4,
1485 "w": 24,
1486 "x": 0,
1487 "y": 10
1488 },
1489 "id": 8,
1490 "interval": "15m",
1491 "options": {
1492 "legend": {
1493 "calcs": [
1494 "mean"
1495 ],
1496 "displayMode": "list",
1497 "placement": "bottom",
1498 "showLegend": true
1499 },
1500 "tooltip": {
1501 "mode": "multi",
1502 "sort": "none"
1503 }
1504 },
1505 "pluginVersion": "10.4.1",
1506 "targets": [
1507 {
1508 "alias": "[[tag_dbname]] [[tag_application_name]] [[tag_client_info]]",
1509 "datasource": {
1510 "type": "grafana-postgresql-datasource",
1511 "uid": "pgwatch-metrics"
1512 },
1513 "format": "time_series",
1514 "group": [],
1515 "groupBy": [
1516 {
1517 "params": [
1518 "$__interval"
1519 ],
1520 "type": "time"
1521 },
1522 {
1523 "params": [
1524 "dbname"
1525 ],
1526 "type": "tag"
1527 },
1528 {
1529 "params": [
1530 "client_info"
1531 ],
1532 "type": "tag"
1533 },
1534 {
1535 "params": [
1536 "application_name"
1537 ],
1538 "type": "tag"
1539 },
1540 {
1541 "params": [
1542 "none"
1543 ],
1544 "type": "fill"
1545 }
1546 ],
1547 "measurement": "replication",
1548 "metricColumn": "none",
1549 "orderByTime": "ASC",
1550 "policy": "default",
1551 "query": "",
1552 "rawQuery": true,
1553 "rawSql": "SELECT\n $__timeGroup(time, $__interval),\n dbname,\n avg((data->'replay_lag_b')::int8)\nFROM\n replication\nWHERE\n $__timeFilter(time)\n AND dbname in ($dbname)\nGROUP BY\n 1, 2\nORDER BY\n 1, 2\n \n",
1554 "refId": "B",
1555 "resultFormat": "time_series",
1556 "select": [
1557 [
1558 {
1559 "params": [
1560 "replay_lag_b"
1561 ],
1562 "type": "field"
1563 },
1564 {
1565 "params": [],
1566 "type": "mean"
1567 }
1568 ]
1569 ],
1570 "tags": [
1571 {
1572 "key": "dbname",
1573 "operator": "=~",
1574 "value": "/^$dbname$/"
1575 }
1576 ],
1577 "timeColumn": "time",
1578 "where": [
1579 {
1580 "name": "$__timeFilter",
1581 "params": [],
1582 "type": "macro"
1583 }
1584 ]
1585 }
1586 ],
1587 "title": "Replication replay lag",
1588 "type": "timeseries"
1589 },
1590 {
1591 "datasource": {
1592 "type": "grafana-postgresql-datasource",
1593 "uid": "pgwatch-metrics"
1594 },
1595 "description": "Based on \"pg_replication_slots.xmin\". The oldest transaction that this slot needs the database to retain. VACUUM cannot remove tuples deleted by any later transaction.",
1596 "fieldConfig": {
1597 "defaults": {
1598 "color": {
1599 "mode": "palette-classic"
1600 },
1601 "custom": {
1602 "axisBorderShow": false,
1603 "axisCenteredZero": false,
1604 "axisColorMode": "text",
1605 "axisLabel": "",
1606 "axisPlacement": "auto",
1607 "barAlignment": 0,
1608 "drawStyle": "line",
1609 "fillOpacity": 10,
1610 "gradientMode": "none",
1611 "hideFrom": {
1612 "legend": false,
1613 "tooltip": false,
1614 "viz": false
1615 },
1616 "insertNulls": false,
1617 "lineInterpolation": "linear",
1618 "lineWidth": 1,
1619 "pointSize": 5,
1620 "scaleDistribution": {
1621 "type": "linear"
1622 },
1623 "showPoints": "never",
1624 "spanNulls": false,
1625 "stacking": {
1626 "group": "A",
1627 "mode": "none"
1628 },
1629 "thresholdsStyle": {
1630 "mode": "off"
1631 }
1632 },
1633 "mappings": [],
1634 "min": 0,
1635 "thresholds": {
1636 "mode": "absolute",
1637 "steps": [
1638 {
1639 "color": "green",
1640 "value": null
1641 },
1642 {
1643 "color": "red",
1644 "value": 80
1645 }
1646 ]
1647 },
1648 "unit": "short"
1649 },
1650 "overrides": []
1651 },
1652 "gridPos": {
1653 "h": 4,
1654 "w": 24,
1655 "x": 0,
1656 "y": 14
1657 },
1658 "id": 10,
1659 "interval": "5m",
1660 "options": {
1661 "legend": {
1662 "calcs": [
1663 "mean"
1664 ],
1665 "displayMode": "list",
1666 "placement": "bottom",
1667 "showLegend": true
1668 },
1669 "tooltip": {
1670 "mode": "multi",
1671 "sort": "none"
1672 }
1673 },
1674 "pluginVersion": "10.4.1",
1675 "targets": [
1676 {
1677 "alias": "[[tag_dbname]] [[tag_slot_name]]",
1678 "datasource": {
1679 "type": "grafana-postgresql-datasource",
1680 "uid": "pgwatch-metrics"
1681 },
1682 "format": "time_series",
1683 "group": [],
1684 "groupBy": [
1685 {
1686 "params": [
1687 "$__interval"
1688 ],
1689 "type": "time"
1690 },
1691 {
1692 "params": [
1693 "dbname"
1694 ],
1695 "type": "tag"
1696 },
1697 {
1698 "params": [
1699 "plugin"
1700 ],
1701 "type": "tag"
1702 },
1703 {
1704 "params": [
1705 "slot_name"
1706 ],
1707 "type": "tag"
1708 },
1709 {
1710 "params": [
1711 "none"
1712 ],
1713 "type": "fill"
1714 }
1715 ],
1716 "measurement": "replication_slots",
1717 "metricColumn": "none",
1718 "orderByTime": "ASC",
1719 "policy": "default",
1720 "query": "",
1721 "rawQuery": true,
1722 "rawSql": "SELECT\n $__timeGroup(time, $__interval),\n dbname,\n avg((data->'xmin_age_tx')::int8)\nFROM\n replication_slots\nWHERE\n $__timeFilter(time)\n AND dbname in ($dbname)\nGROUP BY 1, 2\nORDER BY 1, 2",
1723 "refId": "B",
1724 "resultFormat": "time_series",
1725 "select": [
1726 [
1727 {
1728 "params": [
1729 "xmin_age_tx"
1730 ],
1731 "type": "field"
1732 },
1733 {
1734 "params": [],
1735 "type": "mean"
1736 }
1737 ]
1738 ],
1739 "tags": [
1740 {
1741 "key": "dbname",
1742 "operator": "=~",
1743 "value": "/^$dbname$/"
1744 }
1745 ],
1746 "timeColumn": "time",
1747 "where": [
1748 {
1749 "name": "$__timeFilter",
1750 "params": [],
1751 "type": "macro"
1752 }
1753 ]
1754 }
1755 ],
1756 "title": "Repl. slot XMIN age (in transactions)",
1757 "type": "timeseries"
1758 },
1759 {
1760 "datasource": {
1761 "type": "grafana-postgresql-datasource",
1762 "uid": "pgwatch-metrics"
1763 },
1764 "gridPos": {
1765 "h": 4,
1766 "w": 24,
1767 "x": 0,
1768 "y": 18
1769 },
1770 "id": 12,
1771 "options": {
1772 "code": {
1773 "language": "plaintext",
1774 "showLineNumbers": false,
1775 "showMiniMap": false
1776 },
1777 "content": "<h2>Brought to you by</h2><div style=\"padding: 25px;\"><a href=\"https://www.cybertec-postgresql.com/en/\"><img src=\"https://www.cybertec-postgresql.com/wp-content/uploads/2025/02/cybertec-logo-white-blue.svg\" alt=\"Cybertec – The PostgreSQL Database Company\"></a></div>",
1778 "mode": "html"
1779 },
1780 "pluginVersion": "10.4.1",
1781 "targets": [
1782 {
1783 "datasource": {
1784 "type": "grafana-postgresql-datasource",
1785 "uid": "pgwatch-metrics"
1786 },
1787 "refId": "A"
1788 }
1789 ],
1790 "transparent": true,
1791 "type": "text"
1792 }
1793 ],
1794 "refresh": false,
1795 "schemaVersion": 39,
1796 "tags": [
1797 "pgwatch"
1798 ],
1799 "templating": {
1800 "list": [
1801 {
1802 "current": {
1803 "selected": true,
1804 "text": [
1805 "All"
1806 ],
1807 "value": [
1808 "$__all"
1809 ]
1810 },
1811 "datasource": {
1812 "type": "grafana-postgresql-datasource",
1813 "uid": "pgwatch-metrics"
1814 },
1815 "definition": "",
1816 "hide": 0,
1817 "includeAll": true,
1818 "multi": true,
1819 "name": "dbname",
1820 "options": [],
1821 "query": "SELECT DISTINCT dbname FROM admin.all_distinct_dbname_metrics WHERE metric IN ('replication', 'replication_slots') ORDER BY 1;",
1822 "refresh": 1,
1823 "regex": "",
1824 "skipUrlSync": false,
1825 "sort": 0,
1826 "tagValuesQuery": "",
1827 "tagsQuery": "",
1828 "type": "query",
1829 "useTags": false
1830 }
1831 ]
1832 },
1833 "time": {
1834 "from": "now-3h",
1835 "to": "now"
1836 },
1837 "timepicker": {
1838 "refresh_intervals": [
1839 "5s",
1840 "10s",
1841 "30s",
1842 "1m",
1843 "5m",
1844 "15m",
1845 "30m",
1846 "1h",
1847 "2h",
1848 "1d"
1849 ],
1850 "time_options": [
1851 "5m",
1852 "15m",
1853 "1h",
1854 "6h",
1855 "12h",
1856 "24h",
1857 "2d",
1858 "7d",
1859 "30d"
1860 ]
1861 },
1862 "timezone": "browser",
1863 "title": "Replication",
1864 "uid": "replication",
1865 "version": 1,
1866 "weekStart": ""
1867}