Commit 099774a
committed
fix: limit pg_stat_statements to top 50 queries by exec time
Instead of removing pg_stat_statements from the Prometheus sink entirely,
keep the collection but cap cardinality at 50 queryids (ranked by total
exec time). This gives 50 × 16 = 800 series max instead of 30K+.
The previous weak filter (calls >= 5 OR exec_time >= 1000) let through
thousands of queries on busy databases. ORDER BY + LIMIT 50 is a hard cap.
https://claude.ai/code/session_01SzJxzZNQjDQphaHyaX3RU71 parent 820d253 commit 099774a
2 files changed
Lines changed: 7 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1014 | 1014 | | |
1015 | 1015 | | |
1016 | 1016 | | |
| 1017 | + | |
| 1018 | + | |
1017 | 1019 | | |
1018 | 1020 | | |
1019 | 1021 | | |
| |||
1035 | 1037 | | |
1036 | 1038 | | |
1037 | 1039 | | |
1038 | | - | |
1039 | 1040 | | |
1040 | 1041 | | |
1041 | 1042 | | |
| |||
1061 | 1062 | | |
1062 | 1063 | | |
1063 | 1064 | | |
| 1065 | + | |
| 1066 | + | |
1064 | 1067 | | |
1065 | 1068 | | |
1066 | 1069 | | |
| |||
1082 | 1085 | | |
1083 | 1086 | | |
1084 | 1087 | | |
1085 | | - | |
1086 | 1088 | | |
1087 | 1089 | | |
1088 | 1090 | | |
| |||
2532 | 2534 | | |
2533 | 2535 | | |
2534 | 2536 | | |
2535 | | - | |
2536 | | - | |
| 2537 | + | |
2537 | 2538 | | |
2538 | 2539 | | |
2539 | 2540 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | | - | |
| 5 | + | |
| 6 | + | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
| |||
0 commit comments