diff options
author | Ellie Huxtable <ellie@elliehuxtable.com> | 2024-01-23 20:01:20 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-23 20:01:20 +0000 |
commit | bdc533d2bc615df614e24fb4055bf68349e6cf88 (patch) | |
tree | 0d2e2493216982da0a241110d08661f21b59a9f4 /atuin-server | |
parent | 067bda66e261fcc739eb235d390df1501e4209da (diff) |
feat: add registered and deleted metrics (#1622)
Diffstat (limited to 'atuin-server')
-rw-r--r-- | atuin-server/src/handlers/user.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/atuin-server/src/handlers/user.rs b/atuin-server/src/handlers/user.rs index 4f2ad891f..535c740f1 100644 --- a/atuin-server/src/handlers/user.rs +++ b/atuin-server/src/handlers/user.rs @@ -11,6 +11,7 @@ use axum::{ Json, }; use http::StatusCode; +use metrics::counter; use rand::rngs::OsRng; use tracing::{debug, error, info, instrument}; use uuid::Uuid; @@ -142,6 +143,8 @@ pub async fn register<DB: Database>( .await; } + counter!("atuin_users_registered", 1); + match db.add_session(&new_session).await { Ok(_) => Ok(Json(RegisterResponse { session: token })), Err(e) => { @@ -166,6 +169,9 @@ pub async fn delete<DB: Database>( return Err(ErrorResponse::reply("failed to delete user") .with_status(StatusCode::INTERNAL_SERVER_ERROR)); }; + + counter!("atuin_users_deleted", 1); + Ok(Json(DeleteUserResponse {})) } |