Skip to content

Commit

Permalink
source-postgres: Set application_name param
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
willdonnelly committed Feb 25, 2025
1 parent d54473b commit 49f5235
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion source-postgres/.snapshots/TestConfigURI-Basic
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
postgres://will:secret1234@example.com:5432/somedb
postgres://will:secret1234@example.com:5432/somedb?application_name=estuary_flow
config valid
2 changes: 1 addition & 1 deletion source-postgres/.snapshots/TestConfigURI-IncorrectSSL
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 1 addition & 1 deletion source-postgres/.snapshots/TestConfigURI-RequireSSL
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions source-postgres/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 49f5235

Please sign in to comment.