Skip to content

Commit

Permalink
Add an application_name to more Neon connections
Browse files Browse the repository at this point in the history
Helps identify connections in the logs.
  • Loading branch information
tristan957 committed Jul 9, 2024
1 parent 6d3cb22 commit abc330e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion compute_tools/src/compute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,11 @@ impl ComputeNode {
// In this case we need to connect with old `zenith_admin` name
// and create new user. We cannot simply rename connected user,
// but we can create a new one and grant it all privileges.
let connstr = self.connstr.clone();
let mut connstr = self.connstr.clone();
connstr
.query_pairs_mut()
.append_pair("application_name", "apply_config");

let mut client = match Client::connect(connstr.as_str(), NoTls) {
Err(e) => match e.code() {
Some(&SqlState::INVALID_PASSWORD)
Expand Down Expand Up @@ -867,6 +871,11 @@ impl ComputeNode {

// Run migrations separately to not hold up cold starts
thread::spawn(move || {
let mut connstr = connstr.clone();
connstr
.query_pairs_mut()
.append_pair("application_name", "migrations");

let mut client = Client::connect(connstr.as_str(), NoTls)?;
handle_migrations(&mut client).context("apply_config handle_migrations")
});
Expand Down

1 comment on commit abc330e

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3129 tests run: 3001 passed, 1 failed, 127 skipped (full report)


Failures on Postgres 14

  • test_storage_controller_compute_hook: debug
# Run all failed tests locally:
scripts/pytest -vv -n $(nproc) -k "test_storage_controller_compute_hook[debug-pg14]"

Test coverage report is not available

The comment gets automatically updated with the latest test results
abc330e at 2024-07-09T19:06:34.524Z :recycle:

Please sign in to comment.