Skip to content

Commit

Permalink
Apply suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
VianneyRuhlmann committed Feb 18, 2025
1 parent 3b5fba7 commit cb79af0
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
28 changes: 28 additions & 0 deletions data-pipeline/src/telemetry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,34 @@ mod tests {
)
}

#[test]
fn telemetry_from_send_data_result_test() {
let result = SendDataResult {
requests_count: 10,
responses_count_per_code: HashMap::from([(200, 3)]),
errors_timeout: 1,
errors_network: 2,
errors_status_code: 3,
bytes_sent: 4,
chunks_sent: 5,
chunks_dropped: 6,
..Default::default()
};

let expected_telemetry = SendPayloadTelemetry {
requests_count: 10,
errors_network: 2,
errors_timeout: 1,
errors_status_code: 3,
bytes_sent: 4,
chunks_sent: 5,
chunks_dropped: 6,
responses_count_per_code: HashMap::from([(200, 3)]),
};

assert_eq!(SendPayloadTelemetry::from(&result), expected_telemetry)
}

#[cfg_attr(miri, ignore)]
#[tokio::test]
async fn runtime_id_test() {
Expand Down
4 changes: 2 additions & 2 deletions data-pipeline/src/trace_exporter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -657,8 +657,8 @@ impl TraceExporter {
if let Some(telemetry) = &self.telemetry {
if let Err(e) = telemetry.send(&SendPayloadTelemetry::from_retry_result(
&result,
payload_len.try_into().unwrap_or(0),
chunks.try_into().unwrap_or(0),
payload_len as u64,
chunks as u64,
)) {
error!("Error sending telemetry: {}", e.to_string());
}
Expand Down

0 comments on commit cb79af0

Please sign in to comment.