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:
parent
f11475ccc3
commit
1d2601515b
24
ra/ra.go
24
ra/ra.go
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue