Skip to content

Conversation

ussrlongbow
Copy link

Same queries from Windows and Linux clients to PostgreSQL may appear as different texts in pg_stat_statements.query having same query ID, because of different line breaks, which blocks proper matching query text to metrics with queryid label in Prometheus.
Example:

# Series from two replicas, one used by Windows client, another by Linux
$ curl -s 'http://prometheus.local:9090/api/v1/series?match[]=pg_stat_statements_query_id%7Bqueryid=%220000000000%22%7D' | jq .data.[].query 
"SELECT\r\n    "Username"\r\nFROM\r\n    \"Users\"\r\nWHERE\r\n        \"UserID\" = $1"
"SELECT\n    "Username"\nFROM\n    \"Users\"\nWHERE\n        \"UserID\" = $1"

This pull request adds option --[no-]collector.stat_statements.strip_special to remove such symbols from query output.

Authors:
@ussrlongbow
@freehck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant