Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
bump: patch
type: add
---

Show helpful error message for incorrect API key usage.

When users encounter unauthorized errors, it will be easy for them to know they are using the wrong key.
20 changes: 15 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -754,11 +754,21 @@ async fn send_batch(

let response = client.post(url.clone()).body(batch_bytes).send().await?;

info!(
"Batch of {} metrics sent: {:?}",
batch.get_metrics().len(),
response.status()
);
let status = response.status();

if status == 401 {
warn!(
"Batch of {} metrics failed to send: {:?} - Make sure you're using an app-level key",
batch.get_metrics().len(),
status
);
} else {
info!(
"Batch of {} metrics sent: {:?}",
batch.get_metrics().len(),
status
);
}

Ok(response)
}
Expand Down
Loading