diff options
| author | Ellie Huxtable <ellie@elliehuxtable.com> | 2023-11-18 18:07:23 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-18 18:07:23 +0000 |
| commit | 7575a83fa7ad16860d2c5c7e56ae6ea949e38aa8 (patch) | |
| tree | abed6c74f43bcd4288f02437b517c3ea20ba88f8 /atuin-server/src/handlers/record.rs | |
| parent | feat: add metrics server and http metrics (#1394) (diff) | |
| download | atuin-7575a83fa7ad16860d2c5c7e56ae6ea949e38aa8.zip | |
feat: add some metrics related to Atuin as an app (#1399)
Diffstat (limited to 'atuin-server/src/handlers/record.rs')
| -rw-r--r-- | atuin-server/src/handlers/record.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/atuin-server/src/handlers/record.rs b/atuin-server/src/handlers/record.rs index 0100c693..91b937b3 100644 --- a/atuin-server/src/handlers/record.rs +++ b/atuin-server/src/handlers/record.rs @@ -1,5 +1,6 @@ use axum::{extract::Query, extract::State, Json}; use http::StatusCode; +use metrics::counter; use serde::Deserialize; use tracing::{error, instrument}; @@ -23,11 +24,15 @@ pub async fn post<DB: Database>( "request to add records" ); + counter!("atuin_record_uploaded", records.len() as u64); + let too_big = records .iter() .any(|r| r.data.data.len() >= settings.max_record_size || settings.max_record_size == 0); if too_big { + counter!("atuin_record_too_large", 1); + return Err( ErrorResponse::reply("could not add records; record too large") .with_status(StatusCode::BAD_REQUEST), |
