Skip to content

Commit

Permalink
include some request data like api_key in the indexer attempts topic (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
goaaron authored Mar 17, 2022
1 parent 0f607a5 commit 5302f8e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/kafka_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ pub struct ClientQueryResult {

#[derive(Serialize)]
pub struct IndexerAttempt {
pub ray_id: String,
pub api_key: String,
pub deployment: String,
pub indexer: String,
pub url: String,
pub allocation: String,
Expand Down
6 changes: 5 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -546,12 +546,16 @@ fn timestamp() -> u64 {

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

let indexer_attempts = query
.indexer_attempts
.iter()
.map(|attempt| IndexerAttempt {
api_key: query_result.api_key.clone(),
deployment: query_result.deployment.clone(),
ray_id: query_result.ray_id.clone(),
indexer: attempt.indexer.to_string(),
url: attempt.score.url.to_string(),
allocation: attempt.allocation.to_string(),
Expand Down

0 comments on commit 5302f8e

Please sign in to comment.