-
Problem report
-
Resolution: Fixed
-
Major
-
6.0.28, 6.4.13, 7.0.0beta3
-
S24-W18/19
-
0.5
Hi.
The PostgreSQL plugin has a metric pgsql.autovacuum.count which uses a simple query
SELECT count(*) FROM pg_catalog.pg_stat_activity WHERE query like '%%autovacuum%%' AND state <> 'idle' AND pid <> pg_catalog.pg_backend_pid()
With such query, the metric may return incorrect result, because any process can execute a request, incl. any user whose text contains the word "autovacuum" (a simple example of "select 'autovacuum'") and the agent will count it, but it will be incorrect.
To fix it need to add an additional condition:
"WHERE backend_type = 'autovacuum worker'"
to make sure that the query is being executed by the worker process autovacuum and not by the user.
The backend_type column appeared in version 10