Skip to content

Commit

Permalink
dekaf: Break out dekaf_request_time by request API key
Browse files Browse the repository at this point in the history
  • Loading branch information
jshearer committed Oct 4, 2024
1 parent 7eb18e4 commit b9c1f2c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crates/dekaf/src/api_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b9c1f2c

Please sign in to comment.