From 705f7e7a03c945d817e2808f99fbd0dd9a5986c6 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Mon, 5 Aug 2024 12:24:47 -0400 Subject: [PATCH] collab: Include `geoip_country_code` in initial span (#15819) This PR changes how we report the `geoip_country_code` in the tracing spans. I wasn't seeing it come through in the logs, and I think it was because we didn't declare the field on the initial span. Release Notes: - N/A --- crates/collab/src/rpc.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/collab/src/rpc.rs b/crates/collab/src/rpc.rs index ed836571de..a75d132b57 100644 --- a/crates/collab/src/rpc.rs +++ b/crates/collab/src/rpc.rs @@ -998,9 +998,13 @@ impl Server { user_id=field::Empty, login=field::Empty, impersonator=field::Empty, - dev_server_id=field::Empty + dev_server_id=field::Empty, + geoip_country_code=field::Empty ); principal.update_span(&span); + if let Some(country_code) = geoip_country_code.as_ref() { + span.record("geoip_country_code", country_code); + } let mut teardown = self.teardown.subscribe(); async move { @@ -1014,9 +1018,7 @@ impl Server { let executor = executor.clone(); move |duration| executor.sleep(duration) }); - tracing::Span::current() - .record("connection_id", format!("{}", connection_id)) - .record("geoip_country_code", geoip_country_code.clone()); + tracing::Span::current().record("connection_id", format!("{}", connection_id)); tracing::info!("connection opened");