Skip to content

Commit 5302f8e

Browse files
authored
include some request data like api_key in the indexer attempts topic (#133)
1 parent 0f607a5 commit 5302f8e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/kafka_client.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ pub struct ClientQueryResult {
6868

6969
#[derive(Serialize)]
7070
pub struct IndexerAttempt {
71+
pub ray_id: String,
72+
pub api_key: String,
73+
pub deployment: String,
7174
pub indexer: String,
7275
pub url: String,
7376
pub allocation: String,

src/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,12 +546,16 @@ fn timestamp() -> u64 {
546546

547547
fn notify_query_result(kafka_client: &KafkaClient, query: &Query, result: Result<String, String>) {
548548
let ts = timestamp();
549-
kafka_client.send(&ClientQueryResult::new(&query, result.clone(), ts));
549+
let query_result = ClientQueryResult::new(&query, result.clone(), ts);
550+
kafka_client.send(&query_result);
550551

551552
let indexer_attempts = query
552553
.indexer_attempts
553554
.iter()
554555
.map(|attempt| IndexerAttempt {
556+
api_key: query_result.api_key.clone(),
557+
deployment: query_result.deployment.clone(),
558+
ray_id: query_result.ray_id.clone(),
555559
indexer: attempt.indexer.to_string(),
556560
url: attempt.score.url.to_string(),
557561
allocation: attempt.allocation.to_string(),

0 commit comments

Comments
 (0)