pgcat
pgcat copied to clipboard
Duplicate metrics HELP and TYPE lines
Describe the bug The Prometheus endpoint might return duplicate HELP and TYPE lines when configured with multiple pools. This causes issues with telegraf accessing those metrics:
[inputs.prometheus] Error in plugin: error reading metrics for "http://localhost:9930/metrics": reading text format failed: text format parsing error in line 61: second HELP line for metric name "pgcat_stats_total_xact_count"
To Reproduce Steps to reproduce the behavior:
- Configure pgcat with two pools
- Enable prometheus exported
- Access the metrics endpoint
- Verify that HELP and TYPE lines are only shown once per metric.
Current behavior
# HELP pgcat_stats_total_xact_count Total number of transactions started by the client
# TYPE pgcat_stats_total_xact_count counter
pgcat_stats_total_xact_count{role="primary",host="localhost",database="db1",pool="db1",shard="0"} 500
[...]
# HELP pgcat_stats_total_xact_count Total number of transactions started by the client
# TYPE pgcat_stats_total_xact_count counter
pgcat_stats_total_xact_count{role="primary",host="localhost",database="db2",pool="db2",shard="0"} 250
Expected behavior
# HELP pgcat_stats_total_xact_count Total number of transactions started by the client
# TYPE pgcat_stats_total_xact_count counter
pgcat_stats_total_xact_count{role="primary",host="localhost",database="db1",pool="db1",shard="0"} 500
[...]
pgcat_stats_total_xact_count{role="primary",host="localhost",database="db2",pool="db2",shard="0"} 250
Environment os: Ubuntu 22.04.3 LTS pgcat: 1.1.2-dev postgresql: 15.4