Skip to content

Pint lint: fail on warnings #1415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test-mixins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:

- name: Check for unexpected changes in generated files
working-directory: ./${{ matrix.mixin }}
run: "make && git diff --exit-code || ( echo 'Error: Generated files are not up to date. Run make and commit the local diff'; exit 1; )"
run: "make dashboards_out prometheus_alerts.yaml prometheus_rules.yaml && git diff --exit-code || ( echo 'Error: Generated files are not up to date. Run make and commit the local diff'; exit 1; )"

- name: Wait for Grafana and validate dashboards
working-directory: ./${{ matrix.mixin }}
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ lint-mixins:
fi; \
if [ -d "$$d/prometheus_rules_out" ]; then \
echo "Running pint..."; \
pint lint "$$d/prometheus_rules_out/"; \
pint lint --min-severity=info --fail-on=warning "$$d/prometheus_rules_out/"; \
if [ $$? -ne 0 ]; then \
RESULT=1; \
fi; \
Expand Down
11 changes: 6 additions & 5 deletions Makefile_mixin
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
JSONNET_FMT := jsonnetfmt -n 2 --max-blank-lines 1 --string-style s --comment-style s
JSONNET_FMT := jsonnetfmt -n 2 --max-blank-lines 2 --string-style s --comment-style s

.PHONY: all
all: build dashboards_out prometheus_alerts.yaml prometheus_rules.yaml test
Expand All @@ -18,15 +18,16 @@ fmt:

.PHONY: lint
lint: build lint-pint
@find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | \
@set -e; \
find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | \
while read f; do \
$(JSONNET_FMT) "$$f" | diff -u "$$f" -; \
done
$(JSONNET_FMT) "$$f" | diff -u "$$f" - || exit 1; \
done; \
mixtool lint mixin.libsonnet

.PHONY: lint-pint
lint-pint: prometheus_alerts.yaml prometheus_rules.yaml
pint lint prometheus_rules_out/
pint lint --min-severity=info --fail-on=warning prometheus_rules_out/

dashboards_out: mixin.libsonnet $(wildcard **/*.libsonnet) $(wildcard **/*.jsonnet) $(wildcard panels/*) $(wildcard signals/*)
@mkdir -p dashboards_out
Expand Down
2 changes: 1 addition & 1 deletion apache-hbase-mixin/config.libsonnet
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
_config+:: {
filterSelector: 'job=~"integrations/apache-hbase"',
filterSelector: 'job="integrations/apache-hbase"',

dashboardTags: ['apache-hbase-mixin'],
dashboardPeriod: 'now-30m',
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions apache-tomcat-mixin/config.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
ApacheTomcatAlertsWarningProcessingTime: 300, //ms

// used in alerts:
filteringSelector: 'job=~"integrations/tomcat"',
filteringSelector: 'job="integrations/tomcat"',
groupLabels: if self.enableMultiCluster then ['job', 'cluster'] else ['job'],
instanceLabels: ['instance'],


enableLokiLogs: true,
enableMultiCluster: false,
multiclusterSelector: 'job=~"$job"',
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions pgbouncer-mixin/.pint.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

checks {
//using without() aggregation function
disabled = ["promql/fragile"]
}

14 changes: 7 additions & 7 deletions pgbouncer-mixin/dashboards_out/clusterOverview
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"type": "prometheus",
"uid": "${prometheus_datasource}"
},
"expr": "topk by(database, instance, pgbouncer_cluster)($top_database_count, pgbouncer_pools_client_active_connections{job=~\"$job\",pgbouncer_cluster=~\"$pgbouncer_cluster\",job=~\"integrations/pgbouncer\"})",
"expr": "topk by(database, instance, pgbouncer_cluster)($top_database_count, pgbouncer_pools_client_active_connections{job=~\"$job\",pgbouncer_cluster=~\"$pgbouncer_cluster\",job=\"integrations/pgbouncer\"})",
"legendFormat": "{{pgbouncer_cluster}} - {{instance}} - {{database}}"
}
],
Expand Down Expand Up @@ -124,7 +124,7 @@
"type": "prometheus",
"uid": "${prometheus_datasource}"
},
"expr": "topk by(database, instance, pgbouncer_cluster)($top_database_count, rate(pgbouncer_stats_queries_pooled_total{job=~\"$job\",pgbouncer_cluster=~\"$pgbouncer_cluster\",job=~\"integrations/pgbouncer\"}[$__rate_interval]))",
"expr": "topk by(database, instance, pgbouncer_cluster)($top_database_count, rate(pgbouncer_stats_queries_pooled_total{job=~\"$job\",pgbouncer_cluster=~\"$pgbouncer_cluster\",job=\"integrations/pgbouncer\"}[$__rate_interval]))",
"legendFormat": "{{pgbouncer_cluster}} - {{instance}} - {{database}}"
}
],
Expand Down Expand Up @@ -173,7 +173,7 @@
"type": "prometheus",
"uid": "${prometheus_datasource}"
},
"expr": "topk by(database, instance, pgbouncer_cluster)($top_database_count, 1000 * increase(pgbouncer_stats_queries_duration_seconds_total{job=~\"$job\",pgbouncer_cluster=~\"$pgbouncer_cluster\",job=~\"integrations/pgbouncer\"}[$__interval:]) / clamp_min(increase(pgbouncer_stats_queries_pooled_total{job=~\"$job\",pgbouncer_cluster=~\"$pgbouncer_cluster\",job=~\"integrations/pgbouncer\"}[$__interval:]), 1))",
"expr": "topk by(database, instance, pgbouncer_cluster)($top_database_count, 1000 * increase(pgbouncer_stats_queries_duration_seconds_total{job=~\"$job\",pgbouncer_cluster=~\"$pgbouncer_cluster\",job=\"integrations/pgbouncer\"}[$__interval:]) / clamp_min(increase(pgbouncer_stats_queries_pooled_total{job=~\"$job\",pgbouncer_cluster=~\"$pgbouncer_cluster\",job=\"integrations/pgbouncer\"}[$__interval:]), 1))",
"legendFormat": "{{pgbouncer_cluster}} - {{instance}} - {{database}}"
}
],
Expand Down Expand Up @@ -223,15 +223,15 @@
"type": "prometheus",
"uid": "${prometheus_datasource}"
},
"expr": "topk by(database, instance, pgbouncer_cluster)($top_database_count, rate(pgbouncer_stats_received_bytes_total{job=~\"$job\",pgbouncer_cluster=~\"$pgbouncer_cluster\",job=~\"integrations/pgbouncer\"}[$__rate_interval]))",
"expr": "topk by(database, instance, pgbouncer_cluster)($top_database_count, rate(pgbouncer_stats_received_bytes_total{job=~\"$job\",pgbouncer_cluster=~\"$pgbouncer_cluster\",job=\"integrations/pgbouncer\"}[$__rate_interval]))",
"legendFormat": "{{pgbouncer_cluster}} - {{instance}} - {{database}} - received"
},
{
"datasource": {
"type": "prometheus",
"uid": "${prometheus_datasource}"
},
"expr": "topk by(database, instance, pgbouncer_cluster)($top_database_count, rate(pgbouncer_stats_sent_bytes_total{job=~\"$job\",pgbouncer_cluster=~\"$pgbouncer_cluster\",job=~\"integrations/pgbouncer\"}[$__rate_interval]))",
"expr": "topk by(database, instance, pgbouncer_cluster)($top_database_count, rate(pgbouncer_stats_sent_bytes_total{job=~\"$job\",pgbouncer_cluster=~\"$pgbouncer_cluster\",job=\"integrations/pgbouncer\"}[$__rate_interval]))",
"legendFormat": "{{pgbouncer_cluster}} - {{instance}} - {{database}} - sent"
}
],
Expand Down Expand Up @@ -263,7 +263,7 @@
"label": "Job",
"multi": true,
"name": "job",
"query": "label_values(pgbouncer_databases_current_connections{job=~\"integrations/pgbouncer\"}, job)",
"query": "label_values(pgbouncer_databases_current_connections{job=\"integrations/pgbouncer\"}, job)",
"refresh": 2,
"sort": 1,
"type": "query"
Expand All @@ -278,7 +278,7 @@
"label": "Pgbouncer_cluster",
"multi": true,
"name": "pgbouncer_cluster",
"query": "label_values(pgbouncer_databases_current_connections{job=~\"integrations/pgbouncer\",job=~\"$job\"}, pgbouncer_cluster)",
"query": "label_values(pgbouncer_databases_current_connections{job=\"integrations/pgbouncer\",job=~\"$job\"}, pgbouncer_cluster)",
"refresh": 2,
"sort": 1,
"type": "query"
Expand Down
12 changes: 6 additions & 6 deletions pgbouncer-mixin/dashboards_out/logs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
"type": "loki",
"uid": "${loki_datasource}"
},
"expr": "sum by (level) (count_over_time({job=~\"integrations/pgbouncer\",job=~\"$job\",pgbouncer_cluster=~\"$pgbouncer_cluster\",instance=~\"$instance\",level=~\"$level\"}\n|~ \"$regex_search\"\n\n[$__auto]))\n",
"expr": "sum by (level) (count_over_time({job=\"integrations/pgbouncer\",job=~\"$job\",pgbouncer_cluster=~\"$pgbouncer_cluster\",instance=~\"$instance\",level=~\"$level\"}\n|~ \"$regex_search\"\n\n[$__auto]))\n",
"legendFormat": "{{ level }}"
}
],
Expand Down Expand Up @@ -202,7 +202,7 @@
"type": "loki",
"uid": "${loki_datasource}"
},
"expr": "{job=~\"integrations/pgbouncer\",job=~\"$job\",pgbouncer_cluster=~\"$pgbouncer_cluster\",instance=~\"$instance\",level=~\"$level\"} \n|~ \"$regex_search\"\n\n\n"
"expr": "{job=\"integrations/pgbouncer\",job=~\"$job\",pgbouncer_cluster=~\"$pgbouncer_cluster\",instance=~\"$instance\",level=~\"$level\"} \n|~ \"$regex_search\"\n\n\n"
}
],
"title": "Logs",
Expand Down Expand Up @@ -233,7 +233,7 @@
"label": "Job",
"multi": true,
"name": "job",
"query": "label_values({job=~\"integrations/pgbouncer\"}, job)",
"query": "label_values({job=\"integrations/pgbouncer\"}, job)",
"refresh": 2,
"sort": 1,
"type": "query"
Expand All @@ -248,7 +248,7 @@
"label": "Pgbouncer_cluster",
"multi": true,
"name": "pgbouncer_cluster",
"query": "label_values({job=~\"integrations/pgbouncer\",job=~\"$job\"}, pgbouncer_cluster)",
"query": "label_values({job=\"integrations/pgbouncer\",job=~\"$job\"}, pgbouncer_cluster)",
"refresh": 2,
"sort": 1,
"type": "query"
Expand All @@ -263,7 +263,7 @@
"label": "Instance",
"multi": true,
"name": "instance",
"query": "label_values({job=~\"integrations/pgbouncer\",job=~\"$job\",pgbouncer_cluster=~\"$pgbouncer_cluster\"}, instance)",
"query": "label_values({job=\"integrations/pgbouncer\",job=~\"$job\",pgbouncer_cluster=~\"$pgbouncer_cluster\"}, instance)",
"refresh": 2,
"sort": 1,
"type": "query"
Expand All @@ -278,7 +278,7 @@
"label": "Level",
"multi": true,
"name": "level",
"query": "label_values({job=~\"integrations/pgbouncer\",job=~\"$job\",pgbouncer_cluster=~\"$pgbouncer_cluster\",instance=~\"$instance\"}, level)",
"query": "label_values({job=\"integrations/pgbouncer\",job=~\"$job\",pgbouncer_cluster=~\"$pgbouncer_cluster\",instance=~\"$instance\"}, level)",
"refresh": 2,
"sort": 1,
"type": "query"
Expand Down
Loading
Loading