Skip to content

Commit 1cafd69

Browse files
Merge pull request #76 from grafana/add_creation_of_dashboard
Create the mixin locally
2 parents 58171a6 + 2144cea commit 1cafd69

15 files changed

+5711
-251
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
production/

Makefile

+12
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,15 @@ help:
88

99
helm-lint: ## Run helm linter
1010
$(MAKE) -BC charts/meta-monitoring lint
11+
12+
MIXIN_PATH := production/loki-mixin
13+
MIXIN_OUT_PATH_META_MONITORING := production/loki-mixin-compiled-meta-monitoring
14+
15+
mixin: ## Create our version of the mixin
16+
@rm -rf $(MIXIN_PATH)
17+
./scripts/clone_loki_mixin.sh
18+
@rm -rf $(MIXIN_OUT_PATH_META_MONITORING) && mkdir $(MIXIN_OUT_PATH_META_MONITORING)
19+
@cd $(MIXIN_PATH) && jb install
20+
@mixtool generate all --output-alerts $(MIXIN_OUT_PATH_META_MONITORING)/alerts.yaml --output-rules $(MIXIN_OUT_PATH_META_MONITORING)/rules.yaml --directory $(MIXIN_OUT_PATH_META_MONITORING)/dashboards ${MIXIN_PATH}/mixin-meta-monitoring.libsonnet
21+
@cp $(MIXIN_OUT_PATH_META_MONITORING)/dashboards/* charts/meta-monitoring/src/dashboards
22+
@cp $(MIXIN_OUT_PATH_META_MONITORING)/rules.yaml charts/meta-monitoring/src/rules/loki-rules.yaml

charts/meta-monitoring/src/dashboards/loki-chunks.json

+24-24
Large diffs are not rendered by default.

charts/meta-monitoring/src/dashboards/loki-deletion.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@
579579
"span": 6,
580580
"targets": [
581581
{
582-
"expr": "sum(rate(loki_compactor_deleted_lines{cluster=~\"$cluster\",job=~\"$namespace/(loki|enterprise-logs)-read\"}[$__rate_interval])) by (user)",
582+
"expr": "sum(rate(loki_compactor_deleted_lines{cluster=~\"$cluster\", namespace=~\"$namespace\", pod=~\"(compactor|(loki|enterprise-logs)-backend.*|loki-single-binary)\"}[$__rate_interval])) by (user)",
583583
"format": "time_series",
584584
"legendFormat": "{{user}}",
585585
"legendLink": null
@@ -606,7 +606,7 @@
606606
"span": 6,
607607
"targets": [
608608
{
609-
"expr": "{cluster=~\"$cluster\", namespace=~\"$namespace\", container=\"compactor\"} |~ \"Started processing delete request|delete request for user marked as processed\" | logfmt | line_format \"{{.ts}} user={{.user}} delete_request_id={{.delete_request_id}} msg={{.msg}}\" ",
609+
"expr": "{cluster=~\"$cluster\", namespace=~\"$namespace\", pod=~\"(compactor|(loki|enterprise-logs)-backend.*|loki-single-binary)\"} |~ \"Started processing delete request|delete request for user marked as processed\" | logfmt | line_format \"{{.ts}} user={{.user}} delete_request_id={{.delete_request_id}} msg={{.msg}}\" ",
610610
"refId": "A"
611611
}
612612
],
@@ -619,7 +619,7 @@
619619
"span": 6,
620620
"targets": [
621621
{
622-
"expr": "{cluster=~\"$cluster\", namespace=~\"$namespace\", container=\"compactor\"} |~ \"delete request for user added\" | logfmt | line_format \"{{.ts}} user={{.user}} query='{{.query}}'\"",
622+
"expr": "{cluster=~\"$cluster\", namespace=~\"$namespace\", pod=~\"(compactor|(loki|enterprise-logs)-backend.*|loki-single-binary)\"} |~ \"delete request for user added\" | logfmt | line_format \"{{.ts}} user={{.user}} query='{{.query}}'\"",
623623
"refId": "A"
624624
}
625625
],

charts/meta-monitoring/src/dashboards/loki-logs.json

+35-5
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@
114114
"dashLength": 10,
115115
"dashes": false,
116116
"datasource": "$datasource",
117+
"fieldConfig": {
118+
"defaults": {
119+
"unit": "s"
120+
}
121+
},
117122
"fill": 1,
118123
"fillGradient": 0,
119124
"gridPos": {
@@ -236,7 +241,7 @@
236241
"steppedLine": false,
237242
"targets": [
238243
{
239-
"expr": "sum(rate(container_cpu_usage_seconds_total{cluster=\"$cluster\", namespace=\"$namespace\", pod=~\"$deployment.*\", pod=~\"$pod\", container=~\"$container\"}[5m]))",
244+
"expr": "sum(rate(container_cpu_usage_seconds_total{cluster=\"$cluster\", namespace=\"$namespace\", pod=~\"$deployment.*\", pod=~\"$pod\", container=~\"$container\"}[$__rate_interval]))",
240245
"refId": "A"
241246
}
242247
],
@@ -287,6 +292,11 @@
287292
"dashLength": 10,
288293
"dashes": false,
289294
"datasource": "$datasource",
295+
"fieldConfig": {
296+
"defaults": {
297+
"unit": "bytes"
298+
}
299+
},
290300
"fill": 1,
291301
"fillGradient": 0,
292302
"gridPos": {
@@ -373,6 +383,11 @@
373383
"dashLength": 10,
374384
"dashes": false,
375385
"datasource": "$datasource",
386+
"fieldConfig": {
387+
"defaults": {
388+
"unit": "binBps"
389+
}
390+
},
376391
"fill": 1,
377392
"fillGradient": 0,
378393
"gridPos": {
@@ -408,7 +423,7 @@
408423
"steppedLine": false,
409424
"targets": [
410425
{
411-
"expr": "sum(rate(container_network_transmit_bytes_total{cluster=\"$cluster\", namespace=\"$namespace\", pod=~\"$deployment.*\", pod=~\"$pod\"}[5m]))",
426+
"expr": "sum(rate(container_network_transmit_bytes_total{cluster=\"$cluster\", namespace=\"$namespace\", pod=~\"$deployment.*\", pod=~\"$pod\"}[$__rate_interval]))",
412427
"refId": "A"
413428
}
414429
],
@@ -459,6 +474,11 @@
459474
"dashLength": 10,
460475
"dashes": false,
461476
"datasource": "$datasource",
477+
"fieldConfig": {
478+
"defaults": {
479+
"unit": "binBps"
480+
}
481+
},
462482
"fill": 1,
463483
"fillGradient": 0,
464484
"gridPos": {
@@ -494,7 +514,7 @@
494514
"steppedLine": false,
495515
"targets": [
496516
{
497-
"expr": "sum(rate(container_network_receive_bytes_total{cluster=\"$cluster\", namespace=\"$namespace\", pod=~\"$deployment.*\", pod=~\"$pod\"}[5m]))",
517+
"expr": "sum(rate(container_network_receive_bytes_total{cluster=\"$cluster\", namespace=\"$namespace\", pod=~\"$deployment.*\", pod=~\"$pod\"}[$__rate_interval]))",
498518
"refId": "A"
499519
}
500520
],
@@ -632,6 +652,11 @@
632652
"dashLength": 10,
633653
"dashes": false,
634654
"datasource": "$datasource",
655+
"fieldConfig": {
656+
"defaults": {
657+
"unit": "ops"
658+
}
659+
},
635660
"fill": 1,
636661
"fillGradient": 0,
637662
"gridPos": {
@@ -667,7 +692,7 @@
667692
"steppedLine": false,
668693
"targets": [
669694
{
670-
"expr": "sum(rate(promtail_custom_bad_words_total{cluster=\"$cluster\", exported_namespace=\"$namespace\", exported_pod=~\"$deployment.*\", exported_pod=~\"$pod\", container=~\"$container\"}[5m])) by (level)",
695+
"expr": "sum(rate(promtail_custom_bad_words_total{cluster=\"$cluster\", exported_namespace=\"$namespace\", exported_pod=~\"$deployment.*\", exported_pod=~\"$pod\", container=~\"$container\"}[$__rate_interval])) by (level)",
671696
"legendFormat": "{{level}}",
672697
"refId": "A"
673698
}
@@ -719,6 +744,11 @@
719744
"dashLength": 10,
720745
"dashes": false,
721746
"datasource": "$loki_datasource",
747+
"fieldConfig": {
748+
"defaults": {
749+
"unit": "ops"
750+
}
751+
},
722752
"fill": 1,
723753
"fillGradient": 0,
724754
"gridPos": {
@@ -771,7 +801,7 @@
771801
"steppedLine": false,
772802
"targets": [
773803
{
774-
"expr": "sum(rate({cluster=\"$cluster\", namespace=\"$namespace\", pod=~\"$deployment.*\", pod=~\"$pod\", container=~\"$container\" } |logfmt| level=\"$level\" |= \"$filter\" [5m])) by (level)",
804+
"expr": "sum(rate({cluster=\"$cluster\", namespace=\"$namespace\", pod=~\"$deployment.*\", pod=~\"$pod\", container=~\"$container\" } |logfmt| level=\"$level\" |= \"$filter\" | __error__=\"\" [$__auto])) by (level)",
775805
"intervalFactor": 3,
776806
"legendFormat": "{{level}}",
777807
"refId": "A"

charts/meta-monitoring/src/dashboards/loki-mixin-recording-rules.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,8 @@
300300
"value": 80
301301
}
302302
]
303-
}
303+
},
304+
"unit": "s"
304305
},
305306
"overrides": [ ]
306307
},

0 commit comments

Comments
 (0)