From b9c1f2c2ae0139d350f561d416fda3982165716f Mon Sep 17 00:00:00 2001 From: Joseph Shearer Date: Fri, 4 Oct 2024 15:23:19 -0400 Subject: [PATCH] dekaf: Break out `dekaf_request_time` by request API key --- crates/dekaf/src/api_client.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/dekaf/src/api_client.rs b/crates/dekaf/src/api_client.rs index 9aeb045e1c..65d3cb7593 100644 --- a/crates/dekaf/src/api_client.rs +++ b/crates/dekaf/src/api_client.rs @@ -3,7 +3,7 @@ use bytes::{Bytes, BytesMut}; use futures::{SinkExt, TryStreamExt}; use kafka_protocol::{ error::ParseResponseErrorCode, - messages, + messages::{self, ApiKey}, protocol::{self, Decodable, Encodable, Request}, }; use rsasl::{config::SASLConfig, mechname::Mechname, prelude::SASLClient}; @@ -447,9 +447,11 @@ impl KafkaApiClient { metrics::histogram!("dekaf_pool_wait_time", "upstream_broker" => self.url.to_owned()) .record(SystemTime::now().duration_since(start_time)?); + let api_key = ApiKey::try_from(Req::KEY).expect("should be valid api key"); + let start_time = SystemTime::now(); let resp = send_request(conn.as_mut(), req, header).await; - metrics::histogram!("dekaf_request_time", "upstream_broker" => self.url.to_owned()) + metrics::histogram!("dekaf_request_time", "api_key" => format!("{:?}",api_key), "upstream_broker" => self.url.to_owned()) .record(SystemTime::now().duration_since(start_time)?); resp