mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-06 21:12:55 +00:00
proxy: expose session_id to clients and proxy latency to probes (#12656)
Implements #8728
This commit is contained in:
@@ -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")]
|
||||
|
||||
Reference in New Issue
Block a user