forked from grafana/jsonnet-libs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update
mixtool
to the latest version (grafana#1053)
* Update mixtool and fix initial non-Grafana errors * Write a base .lint file and apply it to all mixins. This will ignore new failing checks * Remove all no-op exclusions, this targets both new rules that were added as part of the previous commit + old exclusions that were already in place * oops. Remove results file * Move scripts
- Loading branch information
1 parent
f86bea0
commit 9e995a9
Showing
78 changed files
with
928 additions
and
521 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# This script merges the content of .lint.base.yaml file into all mixin dirs (as a .lint) file. | ||
|
||
# Search for directories containing mixin.libsonnet files | ||
directories=$(find . -type f -name 'mixin.libsonnet' -exec dirname {} \;) | ||
|
||
# Iterate through the found directories | ||
for dir in $directories; do | ||
lint_file="$dir/.lint" | ||
lint_base_file=".lint.base.yaml" | ||
|
||
# Check if a .lint file exists in the directory | ||
if [ -f "$lint_file" ]; then | ||
# Merge .lint and .lint.base.yaml using yq | ||
yq eval-all 'select(fileIndex == 0) * select(fileIndex == 1)' "$lint_base_file" "$lint_file" > "$lint_file.tmp" | ||
|
||
# Replace the original .lint file with the merged content | ||
mv "$lint_file.tmp" "$lint_file" | ||
echo "Merged $lint_file with $lint_base_file" | ||
else | ||
# If .lint file doesn't exist, create it with the content of .lint.base.yaml | ||
cp "$lint_base_file" "$lint_file" | ||
echo "Created $lint_file from $lint_base_file" | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
exclusions: | ||
panel-title-description-rule: | ||
reason: "mixtool upgrade made this rule stricter. TODO: Fix errors and remove the warning exclusion" | ||
panel-units-rule: | ||
reason: "mixtool upgrade made this rule stricter. TODO: Fix errors and remove the warning exclusion" | ||
template-datasource-rule: | ||
reason: "mixtool upgrade made this rule stricter. TODO: Fix errors and remove the warning exclusion" | ||
template-instance-rule: | ||
reason: "mixtool upgrade made this rule stricter. TODO: Fix errors and remove the warning exclusion" | ||
template-job-rule: | ||
reason: "mixtool upgrade made this rule stricter. TODO: Fix errors and remove the warning exclusion" | ||
template-on-time-change-reload-rule: | ||
reason: "mixtool upgrade made this rule stricter. TODO: Fix errors and remove the warning exclusion" | ||
target-instance-rule: | ||
reason: "mixtool upgrade made this rule stricter. TODO: Fix errors and remove the warning exclusion" | ||
target-job-rule: | ||
reason: "mixtool upgrade made this rule stricter. TODO: Fix errors and remove the warning exclusion" | ||
target-promql-rule: | ||
reason: "mixtool upgrade made this rule stricter. TODO: Fix errors and remove the warning exclusion" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# This script iterates over all .lint files and remove all no-op exclusions (that don't affect the linting result) | ||
|
||
# Find all directories containing .lint files | ||
lint_dirs=$(find . -type f -name '.lint' -exec dirname {} \;) | ||
|
||
for dir in $lint_dirs; do | ||
lint_file="$dir/.lint" | ||
lint_backup="$dir/.lint.bak" | ||
|
||
# Get the keys of the "exclusions" map using yq | ||
exclusions_keys=$(yq eval '.exclusions | keys | .[]' "$lint_file") | ||
|
||
for key in $exclusions_keys; do | ||
# Create a backup of the .lint file | ||
cp "$lint_file" "$lint_backup" | ||
|
||
# Remove the current key from the "exclusions" map using yq | ||
yq eval "del(.exclusions.$key)" "$lint_file" -i | ||
|
||
# Check if the mixtool lint command still works | ||
if mixtool lint -J "$dir/vendor" "$dir/mixin.libsonnet" &> /dev/null; then | ||
echo "Key '$key' removed successfully from $lint_file" | ||
else | ||
# Revert the .lint file to its original state | ||
cp "$lint_backup" "$lint_file" | ||
echo "Reverted $lint_file to its original state due to removal of key '$key'" | ||
fi | ||
|
||
# Remove the backup file | ||
rm "$lint_backup" | ||
done | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Scripts | ||
|
||
Collection of bash scripts that may be useful (or have been in the past) when managing this repository |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ install-ci-deps: | |
go install github.com/google/go-jsonnet/cmd/[email protected] | ||
go install github.com/google/go-jsonnet/cmd/[email protected] | ||
go install github.com/google/go-jsonnet/cmd/[email protected] | ||
go install github.com/monitoring-mixins/mixtool/cmd/mixtool@ae18e31161ea | ||
go install github.com/monitoring-mixins/mixtool/cmd/mixtool@a9e78b0942a4186162bf170efde7b4b3167d31a4 | ||
go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/[email protected] | ||
|
||
fmt: | ||
|
@@ -42,4 +42,4 @@ lint-mixins: | |
drone: | ||
drone jsonnet --stream --source .drone/drone.jsonnet --target .drone/drone.yml --format yaml | ||
drone lint .drone/drone.yml | ||
drone sign --save grafana/jsonnet-libs .drone/drone.yml || echo "You must set DRONE_SERVER and DRONE_TOKEN" | ||
drone sign --save grafana/jsonnet-libs .drone/drone.yml || echo "You must set DRONE_SERVER and DRONE_TOKEN" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1 @@ | ||
exclusions: | ||
template-job-rule: | ||
reason: "Prometheus datasource variable is being named as prometheus_datasource now while linter expects 'datasource'" | ||
panel-datasource-rule: | ||
reason: "Loki datasource variable is being named as loki_datasource now while linter expects 'datasource'" | ||
template-datasource-rule: | ||
reason: "Based on new convention we are using variable names prometheus_datasource and loki_datasource where as linter expects 'datasource'" | ||
template-instance-rule: | ||
reason: "Based on new convention we are using variable names prometheus_datasource and loki_datasource where as linter expects 'datasource'" | ||
panel-units-rule: | ||
reason: "Custom units are used for better user experience in these panels" | ||
entries: | ||
- panel: "DAG file parsing errors" | ||
- panel: "SLA misses" | ||
- panel: "Task failures" | ||
- panel: "Task counts" | ||
- panel: "Scheduler tasks" | ||
- panel: "Executor tasks" | ||
- panel: "Pool task slots" | ||
exclusions: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
exclusions: | ||
panel-title-description-rule: | ||
reason: "mixtool upgrade made this rule stricter. TODO: Fix errors and remove the warning exclusion" | ||
panel-units-rule: | ||
reason: "mixtool upgrade made this rule stricter. TODO: Fix errors and remove the warning exclusion" | ||
template-datasource-rule: | ||
reason: "mixtool upgrade made this rule stricter. TODO: Fix errors and remove the warning exclusion" | ||
template-instance-rule: | ||
reason: "mixtool upgrade made this rule stricter. TODO: Fix errors and remove the warning exclusion" | ||
template-job-rule: | ||
reason: "mixtool upgrade made this rule stricter. TODO: Fix errors and remove the warning exclusion" | ||
template-on-time-change-reload-rule: | ||
reason: "mixtool upgrade made this rule stricter. TODO: Fix errors and remove the warning exclusion" | ||
target-instance-rule: | ||
reason: "mixtool upgrade made this rule stricter. TODO: Fix errors and remove the warning exclusion" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
exclusions: | ||
template-job-rule: | ||
reason: "Prometheus datasource variable is being named as prometheus_datasource now while linter expects 'datasource'" | ||
panel-datasource-rule: | ||
reason: "Loki datasource variable is being named as loki_datasource now while linter expects 'datasource'" | ||
panel-units-rule: | ||
reason: "Custom units are used for better user experience in these panels" | ||
entries: | ||
- panel: "Number of clusters" | ||
- panel: "Number of nodes" | ||
- panel: "Number of down nodes" | ||
- panel: "Connection timeouts" | ||
- panel: "Tasks" | ||
- panel: "Writes" | ||
- panel: "Reads" | ||
- panel: "Keyspace pending compactions" | ||
- panel: "Garbage collections" | ||
- panel: "Hint messages" | ||
- panel: "Pending compaction tasks" | ||
- panel: "Blocked compaction tasks" | ||
- panel: "Keyspaces count" | ||
- panel: "Repair jobs started" | ||
- panel: "Repair jobs completed" | ||
template-datasource-rule: | ||
reason: "Based on new convention we are using variable names prometheus_datasource and loki_datasource where as linter expects 'datasource'" | ||
template-instance-rule: | ||
reason: "Based on new convention we are using variable names prometheus_datasource and loki_datasource where as linter expects 'datasource'" | ||
template-job-rule: | ||
reason: "Prometheus datasource variable is being named as prometheus_datasource now while linter expects 'datasource'" | ||
template-on-time-change-reload-rule: | ||
reason: "mixtool upgrade made this rule stricter. TODO: Fix errors and remove the warning exclusion" | ||
target-instance-rule: | ||
reason: "The dashboard is a 'cluster' dashboard where the instance refers to nodes, this dashboard focuses only on the cluster view." | ||
entries: | ||
- dashboard: "Apache Cassandra overview" | ||
panel-units-rule: | ||
reason: "Custom units are used for better user experience in these panels" | ||
entries: | ||
- panel: "Number of clusters" | ||
- panel: "Number of nodes" | ||
- panel: "Number of down nodes" | ||
- panel: "Connection timeouts" | ||
- panel: "Tasks" | ||
- panel: "Writes" | ||
- panel: "Reads" | ||
- panel: "Keyspace pending compactions" | ||
- panel: "Garbage collections" | ||
- panel: "Hint messages" | ||
- panel: "Pending compaction tasks" | ||
- panel: "Blocked compaction tasks" | ||
- panel: "Keyspaces count" | ||
- panel: "Repair jobs started" | ||
- panel: "Repair jobs completed" | ||
- dashboard: "Apache Cassandra overview" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
exclusions: | ||
template-job-rule: | ||
reason: "Prometheus datasource variable is being named as prometheus_datasource now while linter expects 'datasource'" | ||
panel-datasource-rule: | ||
reason: "Loki datasource variable is being named as loki_datasource now while linter expects 'datasource'" | ||
panel-units-rule: | ||
reason: "Custom units are used for better user experience in these panels" | ||
entries: | ||
- panel: "Number of clusters" | ||
- panel: "Number of nodes" | ||
- panel: "Cluster health" | ||
- panel: "Open OS files" | ||
- panel: "Open databases" | ||
- panel: "Replicator changes manager deaths" | ||
- panel: "Replicator changes queue deaths" | ||
- panel: "Replicator changes reader deaths" | ||
- panel: "Replicator connection owner crashes" | ||
- panel: "Replicator connection worker crashes" | ||
- panel: "Replicator job crashes" | ||
- panel: "Replicator jobs pending" | ||
- panel: "Log types" | ||
template-datasource-rule: | ||
reason: "Based on new convention we are using variable names prometheus_datasource and loki_datasource where as linter expects 'datasource'" | ||
template-instance-rule: | ||
reason: "Based on new convention we are using variable names prometheus_datasource and loki_datasource where as linter expects 'datasource'" | ||
template-job-rule: | ||
reason: "Prometheus datasource variable is being named as prometheus_datasource now while linter expects 'datasource'" | ||
template-on-time-change-reload-rule: | ||
reason: "mixtool upgrade made this rule stricter. TODO: Fix errors and remove the warning exclusion" | ||
target-instance-rule: | ||
reason: "The dashboard is a 'cluster' dashboard where the instance refers to nodes, this dashboard focuses only on the cluster view." | ||
entries: | ||
- dashboard: "Apache CouchDB overview" | ||
panel-units-rule: | ||
reason: "Custom units are used for better user experience in these panels" | ||
entries: | ||
- panel: "Number of clusters" | ||
- panel: "Number of nodes" | ||
- panel: "Cluster health" | ||
- panel: "Open OS files" | ||
- panel: "Open databases" | ||
- panel: "Replicator changes manager deaths" | ||
- panel: "Replicator changes queue deaths" | ||
- panel: "Replicator changes reader deaths" | ||
- panel: "Replicator connection owner crashes" | ||
- panel: "Replicator connection worker crashes" | ||
- panel: "Replicator job crashes" | ||
- panel: "Replicator jobs pending" | ||
- panel: "Log types" | ||
- dashboard: "Apache CouchDB overview" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,24 @@ | ||
exclusions: | ||
template-job-rule: | ||
reason: "Prometheus datasource variable is being named as prometheus_datasource now while linter expects 'datasource'" | ||
panel-datasource-rule: | ||
reason: "Loki datasource variable is being named as loki_datasource now while linter expects 'datasource'" | ||
template-datasource-rule: | ||
reason: "Based on new convention we are using variable names prometheus_datasource and loki_datasource where as linter expects 'datasource'" | ||
template-instance-rule: | ||
reason: "Based on new convention we are using variable names prometheus_datasource and loki_datasource where as linter expects 'datasource'" | ||
panel-units-rule: | ||
reason: "Custom units are used for better user experience in these panels" | ||
entries: | ||
- panel: "Unread blocks evicted" | ||
- panel: "Blocks removed" | ||
- panel: "Volume failures" | ||
- panel: "Total blocks" | ||
- panel: "Missing blocks" | ||
- panel: "Under-replicated blocks" | ||
- panel: "Transactions since last checkpoint" | ||
- panel: "Volume failures" | ||
- panel: "Total files" | ||
- panel: "Total load" | ||
- panel: "Applications running" | ||
- panel: "Allocated containers" | ||
- panel: "Garbage collection count" | ||
- panel: "Containers state" | ||
- panel: "Containers available virtual cores" | ||
- panel: "Applications state" | ||
- panel: "Available virtual cores" | ||
- panel: "Garbage collection count" | ||
- panel: "Unread blocks evicted" | ||
- panel: "Blocks removed" | ||
- panel: "Volume failures" | ||
- panel: "Total blocks" | ||
- panel: "Missing blocks" | ||
- panel: "Under-replicated blocks" | ||
- panel: "Transactions since last checkpoint" | ||
- panel: "Volume failures" | ||
- panel: "Total files" | ||
- panel: "Total load" | ||
- panel: "Applications running" | ||
- panel: "Allocated containers" | ||
- panel: "Garbage collection count" | ||
- panel: "Containers state" | ||
- panel: "Containers available virtual cores" | ||
- panel: "Applications state" | ||
- panel: "Available virtual cores" | ||
- panel: "Garbage collection count" | ||
template-datasource-rule: | ||
reason: "Based on new convention we are using variable names prometheus_datasource and loki_datasource where as linter expects 'datasource'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
exclusions: | ||
panel-title-description-rule: | ||
reason: "mixtool upgrade made this rule stricter. TODO: Fix errors and remove the warning exclusion" | ||
template-instance-rule: | ||
reason: "mixtool upgrade made this rule stricter. TODO: Fix errors and remove the warning exclusion" | ||
template-job-rule: | ||
reason: "mixtool upgrade made this rule stricter. TODO: Fix errors and remove the warning exclusion" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,11 @@ | ||
exclusions: | ||
template-job-rule: | ||
reason: "Prometheus datasource variable is being named as prometheus_datasource now while linter expects 'datasource'" | ||
panel-datasource-rule: | ||
reason: "Loki datasource variable is being named as loki_datasource now while linter expects 'datasource'" | ||
template-datasource-rule: | ||
reason: "Based on new convention we are using variable names prometheus_datasource and loki_datasource where as linter expects 'datasource'" | ||
template-instance-rule: | ||
reason: "Based on new convention we are using variable names prometheus_datasource and loki_datasource where as linter expects 'datasource'" | ||
panel-units-rule: | ||
reason: "Custom units are used for better user experience in these panels" | ||
entries: | ||
- panel: "CPUs available" | ||
- panel: "GPUs available" | ||
- panel: "Events in queue" | ||
- panel: "Messages" | ||
- panel: "Registrar log recovered" | ||
- panel: "Allocation runs" | ||
- panel: "Event queue dispatches" | ||
- panel: "CPUs available" | ||
- panel: "GPUs available" | ||
- panel: "Events in queue" | ||
- panel: "Messages" | ||
- panel: "Registrar log recovered" | ||
- panel: "Allocation runs" | ||
- panel: "Event queue dispatches" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
exclusions: | ||
template-job-rule: | ||
reason: "Prometheus datasource variable is being named as prometheus_datasource now while linter expects 'datasource'" | ||
panel-datasource-rule: | ||
reason: "Loki datasource variable is being named as loki_datasource now while linter expects 'datasource'" | ||
panel-units-rule: | ||
reason: "Custom units are used for better user experience in these panels" | ||
entries: | ||
- panel: "Memory usage" | ||
- panel: "CPU usage" | ||
- panel: "Traffic sent" | ||
- panel: "Traffic received" | ||
- panel: "Requests" | ||
- panel: "Servlet requests" | ||
- panel: "Sessions" | ||
- panel: "Threads" | ||
template-datasource-rule: | ||
reason: "Based on new convention we are using variable names prometheus_datasource and loki_datasource where as linter expects 'datasource'" | ||
template-instance-rule: | ||
reason: "Based on new convention we are using variable names prometheus_datasource and loki_datasource where as linter expects 'datasource'" | ||
panel-units-rule: | ||
reason: "Custom units are used for better user experience in these panels" | ||
entries: | ||
- panel: "Memory usage" | ||
- panel: "CPU usage" | ||
- panel: "Traffic sent" | ||
- panel: "Traffic received" | ||
- panel: "Requests" | ||
- panel: "Servlet requests" | ||
- panel: "Sessions" | ||
- panel: "Threads" | ||
template-job-rule: | ||
reason: "Prometheus datasource variable is being named as prometheus_datasource now while linter expects 'datasource'" | ||
template-on-time-change-reload-rule: | ||
reason: "mixtool upgrade made this rule stricter. TODO: Fix errors and remove the warning exclusion" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
exclusions: | ||
alert-description-templating: | ||
reason: ArgoAppMissing will not have any labels to template into the description, as it is checking for the absense of data | ||
template-datasource-rule: | ||
reason: "mixtool upgrade made this rule stricter. TODO: Fix errors and remove the warning exclusion" | ||
template-instance-rule: | ||
reason: ArgoCD instance filtering is accomplished by the namespace and grouping template variables | ||
reason: "ArgoCD instance filtering is accomplished by the namespace and grouping template variables" | ||
template-job-rule: | ||
reason: ArgoCD instance filtering is accomplished by the namespace and grouping template variables | ||
reason: "ArgoCD instance filtering is accomplished by the namespace and grouping template variables" | ||
target-instance-rule: | ||
reason: ArgoCD instance filtering is accomplished by the namespace and grouping template variables | ||
reason: "ArgoCD instance filtering is accomplished by the namespace and grouping template variables" | ||
target-job-rule: | ||
reason: ArgoCD instance filtering is accomplished by the namespace and grouping template variables | ||
panel-units-rule: | ||
reason: Panel units are self descriptive | ||
reason: "ArgoCD instance filtering is accomplished by the namespace and grouping template variables" | ||
alert-description-templating: | ||
reason: ArgoAppMissing will not have any labels to template into the description, as it is checking for the absense of data |
Oops, something went wrong.