Skip to content

Commit

Permalink
regen and fix log panels
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinBisson committed Sep 19, 2024
1 parent a9fa9b0 commit ae90573
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 14 deletions.
5 changes: 4 additions & 1 deletion Makefile.custom.mk
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ update-kubernetes-mixin: ## Update Kubernetes mixin dashboards
update-mimir-mixin: install-tools ## Update Mimir mixin dashboards
./mimir/update.sh

update-mixin: update-alertmanager-mixin update-alloy-mixin update-kubernetes-mixin update-mimir-mixin ## Update all mixins dashboards
update-loki-mixin: install-tools ## Update Loki mixin dashboards
./loki/update.sh

update-mixin: update-alertmanager-mixin update-alloy-mixin update-kubernetes-mixin update-mimir-mixin update-loki-mixin ## Update all mixins dashboards

lint-dashboards: install-tools ## Run dashboard-linter for all dashboards in the helm/dashboards directory
@for file in $(dashboards); do \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2037,7 +2037,7 @@
"steppedLine": false,
"targets": [
{
"expr": "sum(rate({cluster_id=\"$cluster\", namespace=\"$namespace\", job=~\"($namespace)/(loki.*|enterprise-logs)-write\"} | logfmt | level=\"error\"[$__auto]))",
"expr": "sum(rate({cluster_id=\"$cluster\", namespace=\"$namespace\", job=~\"($namespace)/loki\", component=\"write\"} | logfmt | level=\"error\"[$__auto]))",
"refId": "A"
}
],
Expand Down Expand Up @@ -2100,7 +2100,7 @@
"panels": [],
"targets": [
{
"expr": "{cluster_id=\"$cluster\", namespace=\"$namespace\", job=~\"($namespace)/(loki.*|enterprise-logs)-write\"} |= \"level=error\"",
"expr": "{cluster_id=\"$cluster\", namespace=\"$namespace\", job=~\"($namespace)/loki\", component=\"write\"} |= \"level=error\"",
"refId": "A"
}
],
Expand Down Expand Up @@ -3264,7 +3264,7 @@
"steppedLine": false,
"targets": [
{
"expr": "sum(rate({cluster_id=\"$cluster\", namespace=\"$namespace\", job=~\"($namespace)/(loki.*|enterprise-logs)-read\"} | logfmt | level=\"error\"[$__auto]))",
"expr": "sum(rate({cluster_id=\"$cluster\", namespace=\"$namespace\", job=~\"($namespace)/loki\", component=\"read\"} | logfmt | level=\"error\"[$__auto]))",
"refId": "A"
}
],
Expand Down Expand Up @@ -3327,7 +3327,7 @@
"panels": [],
"targets": [
{
"expr": "{cluster_id=\"$cluster\", namespace=\"$namespace\", job=~\"($namespace)/(loki.*|enterprise-logs)-read\"} |= \"level=error\"",
"expr": "{cluster_id=\"$cluster\", namespace=\"$namespace\", job=~\"($namespace)/loki\", component=\"read\"} |= \"level=error\"",
"refId": "A"
}
],
Expand Down Expand Up @@ -3675,7 +3675,7 @@
"steppedLine": false,
"targets": [
{
"expr": "sum(rate({cluster_id=\"$cluster\", namespace=\"$namespace\", job=~\"($namespace)/(loki.*|enterprise-logs)-backend\"} | logfmt | level=\"error\"[$__auto]))",
"expr": "sum(rate({cluster_id=\"$cluster\", namespace=\"$namespace\", job=~\"($namespace)/loki\", component=\"backend\"} | logfmt | level=\"error\"[$__auto]))",
"refId": "A"
}
],
Expand Down Expand Up @@ -3738,7 +3738,7 @@
"panels": [],
"targets": [
{
"expr": "{cluster_id=\"$cluster\", namespace=\"$namespace\", job=~\"($namespace)/(loki.*|enterprise-logs)-backend\"} |= \"level=error\"",
"expr": "{cluster_id=\"$cluster\", namespace=\"$namespace\", job=~\"($namespace)/loki\", component=\"backend\"} |= \"level=error\"",
"refId": "A"
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,12 @@
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 6,
"x": 0,
"y": 9
},
"id": 4,
"links": [],
"options": {
Expand Down Expand Up @@ -405,6 +411,12 @@
}
]
},
"gridPos": {
"h": 7,
"w": 8,
"x": 0,
"y": 9
},
"id": 5,
"links": [],
"options": {
Expand Down Expand Up @@ -506,6 +518,12 @@
}
]
},
"gridPos": {
"h": 7,
"w": 8,
"x": 8,
"y": 9
},
"id": 6,
"links": [],
"options": {
Expand Down Expand Up @@ -568,6 +586,12 @@
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 6,
"x": 18,
"y": 9
},
"id": 7,
"links": [],
"options": {
Expand Down Expand Up @@ -618,6 +642,12 @@
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 8,
"x": 0,
"y": 16
},
"id": 8,
"links": [],
"options": {
Expand Down Expand Up @@ -665,6 +695,12 @@
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 8,
"x": 8,
"y": 16
},
"id": 9,
"links": [],
"options": {
Expand Down Expand Up @@ -712,6 +748,12 @@
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 8,
"x": 16,
"y": 16
},
"id": 10,
"links": [],
"options": {
Expand Down Expand Up @@ -810,6 +852,12 @@
}
]
},
"gridPos": {
"h": 7,
"w": 8,
"x": 0,
"y": 24
},
"id": 11,
"links": [],
"options": {
Expand Down Expand Up @@ -911,6 +959,12 @@
}
]
},
"gridPos": {
"h": 7,
"w": 8,
"x": 8,
"y": 24
},
"id": 12,
"links": [],
"options": {
Expand Down Expand Up @@ -973,6 +1027,12 @@
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 8,
"x": 16,
"y": 24
},
"id": 13,
"links": [],
"options": {
Expand Down Expand Up @@ -1023,6 +1083,12 @@
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 8,
"x": 0,
"y": 31
},
"id": 14,
"links": [],
"options": {
Expand Down Expand Up @@ -1070,6 +1136,12 @@
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 8,
"x": 8,
"y": 31
},
"id": 15,
"links": [],
"options": {
Expand Down Expand Up @@ -1117,6 +1189,12 @@
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 8,
"x": 16,
"y": 31
},
"id": 16,
"links": [],
"options": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1369,7 +1369,7 @@
"span": 12,
"targets": [
{
"expr": "{cluster_id=~\"$cluster\", job=~\"($namespace)/(loki.*|enterprise-logs)-backend\"}",
"expr": "{cluster_id=~\"$cluster\", job=~\"($namespace)/loki\", component=\"backend\"}",
"refId": "A"
}
],
Expand Down
4 changes: 4 additions & 0 deletions loki/mixin.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ loki{
per_node_label: 'node',
per_cluster_label: 'cluster_id',

blooms: {
enabled: false,
},

operational: {
memcached: false,
consul: false,
Expand Down
21 changes: 15 additions & 6 deletions loki/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

set -e

BRANCH="main"
MIXIN_URL=https://github.com/grafana/loki/production/loki-mixin@$BRANCH
BRANCH="fix-grid-infos-in-loki-resources-overview-mixin"
MIXIN_URL=https://github.com/QuentinBisson/loki-upstream/production/loki-mixin@$BRANCH
helmDir="$(pwd)/helm/dashboards/charts/private_dashboards_al/dashboards/shared/private"

set -x
Expand All @@ -33,15 +33,24 @@ for file in dashboards_out/*; do
jq '.uid = "loki-" + .uid' "$file" > "$file.out" && mv "$file.out" "$file"
fi

## Remove bloom related dashboards as we do not use them in our setup
if [[ $(basename "$file") == "loki-bloom-compactor.json" ]] || [[ $(basename "$file") == "loki-bloom-gateway.json" ]]; then
rm "$file"
continue
fi

## Needed until this is fixed https://github.com/grafana/loki/pull/12846
#if [[ $(basename "$file") == "loki-deletion.json" ]]; then
# sed -i 's/container=\\"compactor\\"/container=\\"loki\\", pod=~\\"(loki.*|enterprise-logs)-backend.*\\"/g' "$file"
#fi
## Needed to fix the log panels as we are using a different label to differentiate loki components
if [[ $(basename "$file") == "loki-retention.json" ]]; then
# shellcheck disable=SC2016
sed -i 's/"{cluster_id=~\\"$cluster\\", job=~\\"($namespace)\/(loki.*|enterprise-logs)-backend\\"}"/"{cluster_id=~\\"$cluster\\", job=~\\"($namespace)\/loki\\", component=\\"backend\\"}"/g' "$file"
elif [[ $(basename "$file") == "loki-operational.json" ]]; then
# shellcheck disable=SC2016
sed -i 's/{cluster_id=\\"$cluster\\", namespace=\\"$namespace\\", job=~\\"($namespace)\/(loki.*|enterprise-logs)-backend\\"} |/{cluster_id=\\"$cluster\\", namespace=\\"$namespace\\", job=~\\"($namespace)\/loki\\", component=\\"backend\\"} |/g' "$file"
# shellcheck disable=SC2016
sed -i 's/{cluster_id=\\"$cluster\\", namespace=\\"$namespace\\", job=~\\"($namespace)\/(loki.*|enterprise-logs)-read\\"} |/{cluster_id=\\"$cluster\\", namespace=\\"$namespace\\", job=~\\"($namespace)\/loki\\", component=\\"read\\"} |/g' "$file"
# shellcheck disable=SC2016
sed -i 's/{cluster_id=\\"$cluster\\", namespace=\\"$namespace\\", job=~\\"($namespace)\/(loki.*|enterprise-logs)-write\\"} |/{cluster_id=\\"$cluster\\", namespace=\\"$namespace\\", job=~\\"($namespace)\/loki\\", component=\\"write\\"} |/g' "$file"
fi

echo "Copying dashboard to $helmDir"
cp "$file" "$helmDir"
Expand Down

0 comments on commit ae90573

Please sign in to comment.