Skip to content

Commit

Permalink
feat: add registered and deleted metrics (atuinsh#1622)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellie authored Jan 23, 2024
1 parent 067bda6 commit bdc533d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions atuin-server/src/handlers/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) => {
Expand All @@ -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 {}))
}

Expand Down

0 comments on commit bdc533d

Please sign in to comment.