Skip to content

Commit

Permalink
feat: add user to client query report
Browse files Browse the repository at this point in the history
  • Loading branch information
Theodus committed Nov 13, 2024
1 parent 8be12e5 commit 5357d19
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/client_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ async fn run_indexer_queries(
response_time_ms,
result,
api_key: auth.key,
user: auth.user,
grt_per_usd,
indexer_requests,
request_bytes: client_request_bytes,
Expand Down Expand Up @@ -854,6 +855,7 @@ pub async fn handle_indexer_query(
response_time_ms,
result: report_result,
api_key: auth.key,
user: auth.user,
grt_per_usd,
request_bytes: indexer_request.request.len() as u32,
response_bytes: result.as_ref().map(|r| r.client_response.len() as u32).ok(),
Expand Down
4 changes: 4 additions & 0 deletions src/reports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub struct ClientRequest {
pub response_time_ms: u16,
pub result: Result<(), errors::Error>,
pub api_key: String,
pub user: String,
pub grt_per_usd: NotNan<f64>,
pub indexer_requests: Vec<IndexerRequest>,
pub request_bytes: u32,
Expand Down Expand Up @@ -125,6 +126,7 @@ impl Reporter {
receipt_signer: self.tap_signer.to_vec(),
query_id: client_request.id,
api_key: client_request.api_key,
user_id: client_request.user,
result: client_request
.result
.map(|()| "success".to_string())
Expand Down Expand Up @@ -196,6 +198,8 @@ pub struct ClientQueryProtobuf {
query_id: String,
#[prost(string, tag = "4")]
api_key: String,
#[prost(string, tag = "11")]
user_id: String,
#[prost(string, tag = "5")]
result: String,
#[prost(uint32, tag = "6")]
Expand Down

0 comments on commit 5357d19

Please sign in to comment.