Skip to content

Commit

Permalink
plugins/postgres_querylength_: do not treat replication as "long query"
Browse files Browse the repository at this point in the history
PostgreSQL 14 shows replication's slots in pg_stat_activity - like
`START_REPLICATION SLOT "readonly02" 6DA6/E9000000 TIMELINE 1`.
The state is active.
The column `backend_type = walsender` can be used for filtering
replication activity.

Thanks, Pavel Stehule!

Closes: munin-monitoring#1465
  • Loading branch information
sumpfralle committed Apr 7, 2022
1 parent a79ef74 commit 82b83f3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/node.d/postgres_querylength_.in
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ my $pg = Munin::Plugin::Pgsql->new(
info => 'Most long-running queries and transactions',
vlabel => 'Age (seconds)',
basequery => [
"SELECT 'query',COALESCE(max(extract(epoch FROM CURRENT_TIMESTAMP-query_start)),0) FROM pg_stat_activity WHERE (state NOT LIKE 'idle%' AND xact_start IS NOT NULL) %%FILTER%%
"SELECT 'query',COALESCE(max(extract(epoch FROM CURRENT_TIMESTAMP-query_start)),0) FROM pg_stat_activity WHERE (backend_type = 'client backend' AND state NOT LIKE 'idle%' AND xact_start IS NOT NULL) %%FILTER%%
UNION ALL
SELECT 'transaction',COALESCE(max(extract(epoch FROM CURRENT_TIMESTAMP-xact_start)),0) FROM pg_stat_activity WHERE 1=1 %%FILTER%%",
[
Expand Down

0 comments on commit 82b83f3

Please sign in to comment.