mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-15 17:32:56 +00:00
update logging
This commit is contained in:
@@ -175,7 +175,7 @@ async fn task_main(
|
||||
.context("failed to set socket option")?;
|
||||
|
||||
info!(%peer_addr, "serving");
|
||||
let ctx = RequestMonitoring::new(session_id, peer_addr.ip(), "sni_router", "sni");
|
||||
let ctx = RequestMonitoring::new(session_id, peer_addr, "sni_router", "sni");
|
||||
handle_client(ctx, dest_suffix, tls_config, tls_server_end_point, socket).await
|
||||
}
|
||||
.unwrap_or_else(|e| {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
use chrono::Utc;
|
||||
use once_cell::sync::OnceCell;
|
||||
use smol_str::SmolStr;
|
||||
use std::net::IpAddr;
|
||||
use std::net::{IpAddr, SocketAddr};
|
||||
use tokio::sync::mpsc;
|
||||
use tracing::{field::display, info_span, Span};
|
||||
use uuid::Uuid;
|
||||
@@ -62,7 +62,7 @@ pub enum AuthMethod {
|
||||
impl RequestMonitoring {
|
||||
pub fn new(
|
||||
session_id: Uuid,
|
||||
peer_addr: IpAddr,
|
||||
peer_addr: SocketAddr,
|
||||
protocol: &'static str,
|
||||
region: &'static str,
|
||||
) -> Self {
|
||||
@@ -75,7 +75,7 @@ impl RequestMonitoring {
|
||||
);
|
||||
|
||||
Self {
|
||||
peer_addr,
|
||||
peer_addr: peer_addr.ip(),
|
||||
session_id,
|
||||
protocol,
|
||||
first_packet: Utc::now(),
|
||||
@@ -100,7 +100,12 @@ impl RequestMonitoring {
|
||||
|
||||
#[cfg(test)]
|
||||
pub fn test() -> Self {
|
||||
RequestMonitoring::new(Uuid::now_v7(), [127, 0, 0, 1].into(), "test", "test")
|
||||
RequestMonitoring::new(
|
||||
Uuid::now_v7(),
|
||||
([127, 0, 0, 1], 5432).into(),
|
||||
"test",
|
||||
"test",
|
||||
)
|
||||
}
|
||||
|
||||
pub fn console_application_name(&self) -> String {
|
||||
|
||||
@@ -92,7 +92,7 @@ pub async fn task_main(
|
||||
connections.spawn(async move {
|
||||
let mut socket = WithClientIp::new(socket);
|
||||
let peer_addr = match socket.wait_for_addr().await {
|
||||
Ok(Some(addr)) => addr.ip(),
|
||||
Ok(Some(addr)) => addr,
|
||||
Err(e) => {
|
||||
error!("per-client task finished with an error: {e:#}");
|
||||
return;
|
||||
@@ -101,7 +101,7 @@ pub async fn task_main(
|
||||
error!("missing required client IP");
|
||||
return;
|
||||
}
|
||||
Ok(None) => peer_addr.ip()
|
||||
Ok(None) => peer_addr
|
||||
};
|
||||
|
||||
match socket.inner.set_nodelay(true) {
|
||||
|
||||
@@ -33,7 +33,7 @@ use crate::serverless::backend::PoolingBackend;
|
||||
use crate::{cancellation::CancellationHandler, config::ProxyConfig};
|
||||
|
||||
use std::convert::Infallible;
|
||||
use std::net::IpAddr;
|
||||
use std::net::SocketAddr;
|
||||
use std::pin::pin;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
@@ -140,6 +140,7 @@ pub async fn task_main(
|
||||
if let Some(peer) = peer {
|
||||
peer_addr = peer;
|
||||
}
|
||||
info!(%peer_addr, protocol = "http", "accepted new TCP connection");
|
||||
|
||||
let accept = tls.accept(conn);
|
||||
let conn = match timeout(Duration::from_secs(10), accept).await {
|
||||
@@ -177,7 +178,7 @@ pub async fn task_main(
|
||||
backend,
|
||||
ws_connections,
|
||||
cancellation_handler,
|
||||
peer_addr.ip(),
|
||||
peer_addr,
|
||||
endpoint_rate_limiter,
|
||||
)
|
||||
.await
|
||||
@@ -281,7 +282,7 @@ async fn request_handler(
|
||||
backend: Arc<PoolingBackend>,
|
||||
ws_connections: TaskTracker,
|
||||
cancellation_handler: Arc<CancellationHandler>,
|
||||
peer_addr: IpAddr,
|
||||
peer_addr: SocketAddr,
|
||||
endpoint_rate_limiter: Arc<EndpointRateLimiter>,
|
||||
) -> Result<Response<Full<Bytes>>, ApiError> {
|
||||
let session_id = uuid::Uuid::new_v4();
|
||||
|
||||
Reference in New Issue
Block a user