metal-stack / helm-charts

Contains metal-stack Helm charts
MIT License
2 stars 10 forks source link

pg_stat_statements generates non-unique metrics #86

Open TLINDEN opened 6 months ago

TLINDEN commented 6 months ago

The last update on the query results in some rare cases in this error when trying to get metrics from postgres_exporter:

An error has occurred while serving metrics:

3 error(s) occurred:
* collected metric "pg_stat_statements_calls" { label:<name:"datname" value:"foo_bar" > label:<name:"postgres_partition" value:"foo-s1-q01-k40" > label:<name:"query" value:"select k1_0.blah_id,k1_0.account_id,k1_0.account_status,k1_0.account_zusatztext,k1_0.accountnummer from foo_bar.account_blah_view k1_0 where k1_0.blah_id=$1" > label:<name:"server" value:"pgfoo-scsablageapp9c2598d7-0" > label:<name:"user" value:"foo_bar_java" > counter:<value:2370 > } was collected before with the same name and label values
* collected metric "pg_stat_statements_time_milliseconds" { label:<name:"datname" value:"foo_bar" > label:<name:"postgres_partition" value:"foo-s1-q01-k40" > label:<name:"query" value:"select k1_0.blah_id,k1_0.account_id,k1_0.account_status,k1_0.account_zusatztext,k1_0.accountnummer from foo_bar.account_blah_view k1_0 where k1_0.blah_id=$1" > label:<name:"server" value:"pgfoo-scsablageapp9c2598d7-0" > label:<name:"user" value:"foo_bar_java" > counter:<value:30.109292000000032 > } was collected before with the same name and label values
* collected metric "pg_stat_statements_rows" { label:<name:"datname" value:"foo_bar" > label:<name:"postgres_partition" value:"foo-s1-q01-k40" > label:<name:"query" value:"select k1_0.blah_id,k1_0.account_id,k1_0.account_status,k1_0.account_zusatztext,k1_0.accountnummer from foo_bar.account_blah_view k1_0 where k1_0.blah_id=$1" > label:<name:"server" value:"pgfoo-scsablageapp9c2598d7-0" > label:<name:"user" value:"foo_bary_java" > counter:<value:23 > } was collected before with the same name and label values
TLINDEN commented 6 months ago

The problem is, that we have removed the queryid, so the rows are not uniq anymore, which causes this error.