Skip to content

Commit

Permalink
Fixes to new type of telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
amigin committed Sep 14, 2023
1 parent 8846af7 commit 7586909
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/grpc_server_telemetry_context.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#[cfg(feature = "with-telemetry")]
use my_telemetry::MyTelemetryContext;
use my_telemetry::TelemetryEventTag;
use rust_extensions::date_time::DateTimeAsMicroseconds;
use std::net::SocketAddr;

Expand Down Expand Up @@ -34,8 +35,12 @@ impl Drop for GrpcServerTelemetryContext {
return;
}

let addr = if let Some(addr) = self.addr {
addr.to_string().into()
let tags = if let Some(addr) = self.addr {
vec![TelemetryEventTag {
key: "ip".to_string(),
value: addr.ip().to_string(),
}]
.into()
} else {
None
};
Expand All @@ -53,7 +58,7 @@ impl Drop for GrpcServerTelemetryContext {
started,
format!("GRPC: {}", method),
"done".to_string(),
addr,
tags,
)
.await;
});
Expand Down

0 comments on commit 7586909

Please sign in to comment.