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