diff --git a/proxy/src/auth/credentials.rs b/proxy/src/auth/credentials.rs index d7a8edca79..9fe9c26f0c 100644 --- a/proxy/src/auth/credentials.rs +++ b/proxy/src/auth/credentials.rs @@ -1,7 +1,9 @@ //! User credentials used in authentication. use crate::{ - auth::password_hack::parse_endpoint_param, error::UserFacingError, proxy::neon_options, + auth::password_hack::parse_endpoint_param, + error::UserFacingError, + proxy::{neon_options, NUM_CONNECTION_ACCEPTED_BY_SNI}, }; use itertools::Itertools; use pq_proto::StartupMessageParams; @@ -124,6 +126,22 @@ impl<'a> ClientCredentials<'a> { .transpose()?; info!(user, project = project.as_deref(), "credentials"); + if sni.is_some() { + info!("Connection with sni"); + NUM_CONNECTION_ACCEPTED_BY_SNI + .with_label_values(&["sni"]) + .inc(); + } else if project.is_some() { + NUM_CONNECTION_ACCEPTED_BY_SNI + .with_label_values(&["no_sni"]) + .inc(); + info!("Connection without sni"); + } else { + NUM_CONNECTION_ACCEPTED_BY_SNI + .with_label_values(&["password_hack"]) + .inc(); + info!("Connection with password hack"); + } let cache_key = format!( "{}{}", diff --git a/proxy/src/proxy.rs b/proxy/src/proxy.rs index 2d38acd05b..b03f95dc5f 100644 --- a/proxy/src/proxy.rs +++ b/proxy/src/proxy.rs @@ -129,6 +129,15 @@ pub static RATE_LIMITER_LIMIT: Lazy = Lazy::new(|| { .unwrap() }); +pub static NUM_CONNECTION_ACCEPTED_BY_SNI: Lazy = Lazy::new(|| { + register_int_counter_vec!( + "proxy_accepted_connections_by_sni", + "Number of connections (per sni).", + &["kind"], + ) + .unwrap() +}); + pub struct LatencyTimer { // time since the stopwatch was started start: Option,