Pass custom application_name on connection
Is it possible to pass a custom application_name on connecting to supabase via typescript SDK? Reason being I am trying to differentiate connections from various sources (cron jobs, mobile app, etc) to see what is hogging a ton of connections.
2 Replies
The API Gateway logs have IP info and agent info that MIGHT be useful.
You can send custom headers with the REST API, but the logs will not save them for security reasons. SB recommends adding to the User-Agent header for that.
https://supabase.com/docs/guides/telemetry/logs#additional-request-metadata
But the REST API (supabase-js) is has its own pooler that then uses direct connections to the database in a shared fashion. They will all be authenticator role in the dashboard IF you are asking about DB connections and are shared amongst all DB REST requests.
This open issue in supavisor may be relevant : https://github.com/supabase/supavisor/issues/343
GitHub
Prepend application_name from client to application_name set by DbH...
When looking at connections in Postgres I should be able to see the application_name set by clients if connected via session mode through Supavisor. select usename, application_name from pg_stat_ac...