From 49f52357044b532f4b759c2d09036b2b2d88cfe7 Mon Sep 17 00:00:00 2001 From: Will Donnelly Date: Tue, 25 Feb 2025 10:40:32 -0600 Subject: [PATCH] source-postgres: Set application_name param This means we show up like this in pg_stat_replication: postgres=> SELECT * FROM pg_stat_replication; -[ RECORD 1 ]----+------------------------------ pid | 36917 usesysid | 16540 usename | flow_capture application_name | estuary_flow client_addr | 99.27.226.225 client_hostname | client_port | 40560 backend_start | 2025-02-25 16:40:03.981342+00 [...] Currently the `application_name` field is entirely blank, so it seems like having anything at all there is a clear win. We might consider making it customizable or filing in the capture task name in the future, but for now this is better than nothing. --- source-postgres/.snapshots/TestConfigURI-Basic | 2 +- source-postgres/.snapshots/TestConfigURI-IncorrectSSL | 2 +- source-postgres/.snapshots/TestConfigURI-RequireSSL | 2 +- source-postgres/main.go | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/source-postgres/.snapshots/TestConfigURI-Basic b/source-postgres/.snapshots/TestConfigURI-Basic index 916d2f44ec..6035dc435b 100644 --- a/source-postgres/.snapshots/TestConfigURI-Basic +++ b/source-postgres/.snapshots/TestConfigURI-Basic @@ -1,2 +1,2 @@ -postgres://will:secret1234@example.com:5432/somedb +postgres://will:secret1234@example.com:5432/somedb?application_name=estuary_flow config valid diff --git a/source-postgres/.snapshots/TestConfigURI-IncorrectSSL b/source-postgres/.snapshots/TestConfigURI-IncorrectSSL index 21d5381a60..2668daa1c1 100644 --- a/source-postgres/.snapshots/TestConfigURI-IncorrectSSL +++ b/source-postgres/.snapshots/TestConfigURI-IncorrectSSL @@ -1,2 +1,2 @@ -postgres://will:secret1234@example.com:5432/somedb?sslmode=whoops-this-isnt-right +postgres://will:secret1234@example.com:5432/somedb?application_name=estuary_flow&sslmode=whoops-this-isnt-right invalid 'sslmode' configuration: unknown setting "whoops-this-isnt-right" diff --git a/source-postgres/.snapshots/TestConfigURI-RequireSSL b/source-postgres/.snapshots/TestConfigURI-RequireSSL index 45ce8b198a..b181ea86e2 100644 --- a/source-postgres/.snapshots/TestConfigURI-RequireSSL +++ b/source-postgres/.snapshots/TestConfigURI-RequireSSL @@ -1,2 +1,2 @@ -postgres://will:secret1234@example.com:5432/somedb?sslmode=verify-full +postgres://will:secret1234@example.com:5432/somedb?application_name=estuary_flow&sslmode=verify-full config valid diff --git a/source-postgres/main.go b/source-postgres/main.go index 9502758025..6dad8cf025 100644 --- a/source-postgres/main.go +++ b/source-postgres/main.go @@ -227,6 +227,7 @@ func (c *Config) ToURI() string { uri.Path = "/" + c.Database } var params = make(url.Values) + params.Set("application_name", "estuary_flow") if c.Advanced.SSLMode != "" { params.Set("sslmode", c.Advanced.SSLMode) }