Skip to content

Commit

Permalink
proxy: fix bug with populating the data (#7023)
Browse files Browse the repository at this point in the history
## Problem

Branch/project and coldStart were not populated to data events.

## Summary of changes

Populate it. Also added logging for the coldstart info.
  • Loading branch information
khanova committed Mar 5, 2024
1 parent e69a255 commit 15b3665
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions proxy/src/auth/backend/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ pub(super) async fn authenticate(

ctx.set_user(db_info.user.into());
ctx.set_project(db_info.aux.clone());
let cold_start_info = db_info.aux.cold_start_info.clone().unwrap_or_default();
info!(?cold_start_info, "woken up a compute node");

// Backwards compatibility. pg_sni_proxy uses "--" in domain names
// while direct connections do not. Once we migrate to pg_sni_proxy
Expand Down
3 changes: 2 additions & 1 deletion proxy/src/console/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,10 @@ pub struct MetricsAuxInfo {
pub cold_start_info: Option<ColdStartInfo>,
}

#[derive(Debug, Serialize, Deserialize, Clone)]
#[derive(Debug, Default, Serialize, Deserialize, Clone)]
#[serde(rename_all = "snake_case")]
pub enum ColdStartInfo {
#[default]
Unknown = 0,
Warm = 1,
PoolHit = 2,
Expand Down
3 changes: 3 additions & 0 deletions proxy/src/console/provider/neon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,9 @@ impl super::Api for Api {
}

let node = self.do_wake_compute(ctx, user_info).await?;
ctx.set_project(node.aux.clone());
let cold_start_info = node.aux.cold_start_info.clone().unwrap_or_default();
info!(?cold_start_info, "woken up a compute node");
let (_, cached) = self.caches.node_info.insert(key.clone(), node);
info!(key = &*key, "created a cache entry for compute node info");

Expand Down

1 comment on commit 15b3665

@github-actions
Copy link

Choose a reason for hiding this comment

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

2567 tests run: 2433 passed, 1 failed, 133 skipped (full report)


Failures on Postgres 14

  • test_basebackup_with_high_slru_count[github-actions-selfhosted-vectored-10-13-30]: release
# Run all failed tests locally:
scripts/pytest -vv -n $(nproc) -k "test_basebackup_with_high_slru_count[release-pg14-github-actions-selfhosted-vectored-10-13-30]"
Flaky tests (1)

Postgres 15

  • test_timeline_deletion_with_files_stuck_in_upload_queue: release

Code coverage* (full report)

  • functions: 28.8% (6981 of 24255 functions)
  • lines: 47.4% (42878 of 90535 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
15b3665 at 2024-03-05T16:57:09.054Z :recycle:

Please sign in to comment.