proxy: expose session_id to clients and proxy latency to probes (#12656)

Implements #8728
This commit is contained in:
Ivan Efremov
2025-07-21 23:27:15 +03:00
committed by GitHub
parent 0dbe551802
commit 050c9f704f
7 changed files with 82 additions and 10 deletions

View File

@@ -1,4 +1,3 @@
#[cfg(any(test, feature = "testing"))]
use std::env;
use std::net::SocketAddr;
use std::path::PathBuf;
@@ -21,7 +20,7 @@ use tokio::net::TcpListener;
use tokio::sync::Notify;
use tokio::task::JoinSet;
use tokio_util::sync::CancellationToken;
use tracing::{error, info, warn};
use tracing::{debug, error, info, warn};
use utils::sentry_init::init_sentry;
use utils::{project_build_tag, project_git_version};
@@ -730,6 +729,25 @@ fn build_config(args: &ProxyCliArgs) -> anyhow::Result<&'static ProxyConfig> {
}
};
let mut greetings = env::var_os("NEON_MOTD").map_or(String::new(), |s| match s.into_string() {
Ok(s) => s,
Err(_) => {
debug!("NEON_MOTD environment variable is not valid UTF-8");
String::new()
}
});
match &args.auth_backend {
AuthBackendType::ControlPlane => {}
#[cfg(any(test, feature = "testing"))]
AuthBackendType::Postgres => {}
#[cfg(any(test, feature = "testing"))]
AuthBackendType::Local => {}
AuthBackendType::ConsoleRedirect => {
greetings = "Connected to database".to_string();
}
}
let config = ProxyConfig {
tls_config,
metric_collection,
@@ -740,6 +758,7 @@ fn build_config(args: &ProxyCliArgs) -> anyhow::Result<&'static ProxyConfig> {
wake_compute_retry_config: config::RetryConfig::parse(&args.wake_compute_retry)?,
connect_compute_locks,
connect_to_compute: compute_config,
greetings,
#[cfg(feature = "testing")]
disable_pg_session_jwt: false,
#[cfg(feature = "rest_broker")]