Skip to content

Commit

Permalink
RA: Count new registrations with contacts (#7984)
Browse files Browse the repository at this point in the history
Adding a temporary metric to estimate the rate of new contacts for
accounts.

Part of #7966
  • Loading branch information
beautifulentropy authored Feb 3, 2025
1 parent f11475c commit 1d26015
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions ra/ra.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -280,6 +291,7 @@ func NewRegistrationAuthorityImpl(
certCSRMismatch: certCSRMismatch,
pauseCounter: pauseCounter,
mustStapleRequestsCounter: mustStapleRequestsCounter,
newOrUpdatedContactCounter: newOrUpdatedContactCounter,
}
return ra
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 1d26015

Please sign in to comment.