RA: Count new registrations with contacts (#7984)

Adding a temporary metric to estimate the rate of new contacts for
accounts.

Part of #7966
This commit is contained in:
Samantha Frank 2025-02-03 11:50:43 -05:00 committed by GitHub
parent f11475ccc3
commit 1d2601515b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 24 additions and 0 deletions

View File

@ -125,6 +125,9 @@ type RegistrationAuthorityImpl struct {
certCSRMismatch prometheus.Counter
pauseCounter *prometheus.CounterVec
mustStapleRequestsCounter *prometheus.CounterVec
// TODO(#7966): Remove once the rate of registrations with contacts has been
// determined.
newOrUpdatedContactCounter *prometheus.CounterVec
}
var _ rapb.RegistrationAuthorityServer = (*RegistrationAuthorityImpl)(nil)
@ -245,6 +248,14 @@ func NewRegistrationAuthorityImpl(
}, []string{"allowlist"})
stats.MustRegister(mustStapleRequestsCounter)
// TODO(#7966): Remove once the rate of registrations with contacts has been
// determined.
newOrUpdatedContactCounter := prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "new_or_updated_contact",
Help: "A counter of new or updated contacts, labeled by new=[bool]",
}, []string{"new"})
stats.MustRegister(newOrUpdatedContactCounter)
issuersByNameID := make(map[issuance.NameID]*issuance.Certificate)
for _, issuer := range issuers {
issuersByNameID[issuer.NameID()] = issuer
@ -280,6 +291,7 @@ func NewRegistrationAuthorityImpl(
certCSRMismatch: certCSRMismatch,
pauseCounter: pauseCounter,
mustStapleRequestsCounter: mustStapleRequestsCounter,
newOrUpdatedContactCounter: newOrUpdatedContactCounter,
}
return ra
}
@ -415,6 +427,12 @@ func (ra *RegistrationAuthorityImpl) NewRegistration(ctx context.Context, reques
return nil, err
}
// TODO(#7966): Remove once the rate of registrations with contacts has been
// determined.
for range request.Contact {
ra.newOrUpdatedContactCounter.With(prometheus.Labels{"new": "true"}).Inc()
}
ra.newRegCounter.Inc()
return res, nil
}
@ -1282,6 +1300,12 @@ func (ra *RegistrationAuthorityImpl) UpdateRegistrationContact(ctx context.Conte
return nil, fmt.Errorf("failed to update registration contact: %w", err)
}
// TODO(#7966): Remove once the rate of registrations with contacts has
// been determined.
for range req.Contacts {
ra.newOrUpdatedContactCounter.With(prometheus.Labels{"new": "false"}).Inc()
}
return update, nil
}