Skip to content

Commit

Permalink
Cover updates and range over contacts
Browse files Browse the repository at this point in the history
  • Loading branch information
beautifulentropy committed Jan 29, 2025
1 parent 26d8262 commit e3bcf95
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions ra/ra.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ type RegistrationAuthorityImpl struct {
mustStapleRequestsCounter *prometheus.CounterVec
// TODO(#7966): Remove once the rate of registrations with contacts has been
// determined.
newRegWithContactCounter prometheus.Counter
newRegWithContactCounter *prometheus.CounterVec
}

var _ rapb.RegistrationAuthorityServer = (*RegistrationAuthorityImpl)(nil)
Expand Down Expand Up @@ -250,10 +250,10 @@ func NewRegistrationAuthorityImpl(

// TODO(#7966): Remove once the rate of registrations with contacts has been
// determined.
newRegWithContactCounter := prometheus.NewCounter(prometheus.CounterOpts{
newRegWithContactCounter := prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "new_registrations_with_contacts",
Help: "A counter of new registrations with contacts",
})
Help: "A counter of new registrations with contacts, labeled by one of new=[bool], update=[bool]",
}, []string{"new", "update"})
stats.MustRegister(newRegWithContactCounter)

issuersByNameID := make(map[issuance.NameID]*issuance.Certificate)
Expand Down Expand Up @@ -427,12 +427,14 @@ func (ra *RegistrationAuthorityImpl) NewRegistration(ctx context.Context, reques
return nil, err
}

ra.newRegCounter.Inc()
// TODO(#7966): Remove once the rate of registrations with contacts has been
// determined.
if len(request.Contact) > 0 {
ra.newRegWithContactCounter.Inc()
for range request.Contact {
ra.newRegWithContactCounter.With(prometheus.Labels{"new": "true"}).Inc()
}

ra.newRegCounter.Inc()

return res, nil
}

Expand Down Expand Up @@ -1291,6 +1293,12 @@ func (ra *RegistrationAuthorityImpl) UpdateRegistrationContact(ctx context.Conte
return nil, fmt.Errorf("invalid contact: %w", err)
}

// TODO(#7966): Remove once the rate of registrations with contacts has
// been determined.
for range req.Contacts {
ra.newRegWithContactCounter.With(prometheus.Labels{"update": "true"}).Inc()
}

update, err := ra.SA.UpdateRegistrationContact(ctx, &sapb.UpdateRegistrationContactRequest{
RegistrationID: req.RegistrationID,
Contacts: req.Contacts,
Expand Down

0 comments on commit e3bcf95

Please sign in to comment.