Skip to content

Commit f7919e9

Browse files
committed
Record password registrations
1 parent 41f8974 commit f7919e9

File tree

1 file changed

+15
-2
lines changed
  • crates/handlers/src/views/register/steps

1 file changed

+15
-2
lines changed

crates/handlers/src/views/register/steps/finish.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// SPDX-License-Identifier: AGPL-3.0-only
44
// Please see LICENSE in the repository root for full details.
55

6-
use std::sync::Arc;
6+
use std::sync::{Arc, LazyLock};
77

88
use anyhow::Context as _;
99
use axum::{
@@ -22,10 +22,21 @@ use mas_storage::{
2222
user::UserEmailFilter,
2323
};
2424
use mas_templates::{RegisterStepsEmailInUseContext, TemplateContext as _, Templates};
25+
use opentelemetry::metrics::Counter;
2526
use ulid::Ulid;
2627

2728
use super::super::cookie::UserRegistrationSessions;
28-
use crate::{BoundActivityTracker, PreferredLanguage, views::shared::OptionalPostAuthAction};
29+
use crate::{
30+
BoundActivityTracker, METER, PreferredLanguage, views::shared::OptionalPostAuthAction,
31+
};
32+
33+
static PASSWORD_REGISTER_COUNTER: LazyLock<Counter<u64>> = LazyLock::new(|| {
34+
METER
35+
.u64_counter("mas.user.password_registration")
36+
.with_description("Number of password registrations")
37+
.with_unit("{registration}")
38+
.build()
39+
});
2940

3041
#[tracing::instrument(
3142
name = "handlers.views.register.steps.finish.get",
@@ -203,6 +214,8 @@ pub(crate) async fn get(
203214
repo.browser_session()
204215
.authenticate_with_password(&mut rng, &clock, &user_session, &user_password)
205216
.await?;
217+
218+
PASSWORD_REGISTER_COUNTER.add(1, &[]);
206219
}
207220

208221
if let Some(terms_url) = registration.terms_url {

0 commit comments

Comments
 (0)