Skip to content

Commit 9502887

Browse files
committed
chore: switch back to supabase_admin for metrics collection
Instead of using a separate user, disable stats tracking for statements executed by the exporter.
1 parent 3e5db65 commit 9502887

File tree

4 files changed

+3
-7
lines changed

4 files changed

+3
-7
lines changed

ansible/files/postgres_exporter.service.j2

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ StandardOutput=append:/var/log/postgres_exporter.stdout
99
StandardError=append:/var/log/postgres_exporter.error
1010
Restart=always
1111
RestartSec=3
12-
Environment="DATA_SOURCE_URI=localhost/postgres?sslmode=disable"
13-
Environment="DATA_SOURCE_USER=supabase_metrics"
12+
Environment="DATA_SOURCE_NAME=host=localhost dbname=postgres sslmode=disable user=supabase_admin pg_stat_statements.track=none"
1413

1514
[Install]
1615
WantedBy=multi-user.target

ansible/files/queries.yml.j2

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,7 @@ supabase_usage_metrics:
201201
query: |
202202
select sum(calls) as user_queries_total
203203
from extensions.pg_stat_statements
204-
join pg_roles on userid = oid
205-
where rolname <> 'supabase_metrics'
206-
and query not like 'SELECT%FROM net.http_request_queue%'
204+
where query not like 'SELECT%FROM net.http_request_queue%'
207205
and query not like 'DELETE FROM net.http_request_queue%'
208206
and query <> 'SELECT version()'
209207
-- the rest of these would get removed once we implement a more minimal healthcheck endpoint for postgrest

ansible/tasks/internal/supautils.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
lineinfile:
2929
path: /etc/postgresql/postgresql.conf
3030
state: present
31-
line: supautils.reserved_roles = 'supabase_admin, supabase_metrics, supabase_auth_admin, supabase_storage_admin, dashboard_user, pgbouncer, service_role, authenticator, authenticated, anon'
31+
line: supautils.reserved_roles = 'supabase_admin, supabase_auth_admin, supabase_storage_admin, dashboard_user, pgbouncer, service_role, authenticator, authenticated, anon'
3232

3333
- name: supautils - set supautils.reserved_memberships
3434
become: yes

ansible/tasks/setup-fail2ban.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
line: "{{ item.line }}"
2727
loop:
2828
- { line: ' ^.*,.*,.*,.*,"<HOST>:.*password authentication failed for user ""supabase_admin".*$' }
29-
- { line: ' ^.*,.*,.*,.*,"<HOST>:.*password authentication failed for user ""supabase_metrics".*$' }
3029
- { line: ' ^.*,.*,.*,.*,"<HOST>:.*password authentication failed for user ""supabase_auth_admin".*$' }
3130
- { line: ' ^.*,.*,.*,.*,"<HOST>:.*password authentication failed for user ""supabase_storage_admin".*$' }
3231
- { line: ' ^.*,.*,.*,.*,"<HOST>:.*password authentication failed for user ""authenticator".*$' }

0 commit comments

Comments
 (0)