Add some timing histogram stats (#2482)

Previously our gRPC client code called the wrong function, enabling server-side instead of client-side histograms.

Also, add a timing stat for the generate / store combination in OCSP Updater.
This commit is contained in:
Jacob Hoffman-Andrews 2017-01-10 11:02:41 -08:00 committed by Roland Bracewell Shoemaker
parent 5aa78a578c
commit d6ba7fcba9
2 changed files with 5 additions and 4 deletions

View File

@ -488,19 +488,20 @@ func (updater *OCSPUpdater) generateOCSPResponses(ctx context.Context, statuses
wait := func() {
sem <- 1 // Block until there's capacity.
}
done := func() {
done := func(start time.Time) {
<-sem // Indicate there's more capacity.
stats.TimingDuration("GenerateAndStore", time.Since(start))
}
work := func(status core.CertificateStatus) {
defer done()
defer done(updater.clk.Now())
meta, err := updater.generateResponse(ctx, status)
if err != nil {
updater.log.AuditErr(fmt.Sprintf("Failed to generate OCSP response: %s", err))
stats.Inc("Errors.ResponseGeneration", 1)
return
}
updater.stats.Inc("GeneratedResponses", 1)
stats.Inc("GeneratedResponses", 1)
err = updater.storeResponse(meta)
if err != nil {
updater.log.AuditErr(fmt.Sprintf("Failed to store OCSP response: %s", err))

View File

@ -28,7 +28,7 @@ func ClientSetup(c *cmd.GRPCClientConfig, tls *tls.Config, stats metrics.Scope)
return nil, errNilTLS
}
grpc_prometheus.EnableHandlingTimeHistogram()
grpc_prometheus.EnableClientHandlingTimeHistogram()
ci := clientInterceptor{stats.NewScope("gRPCClient"), clock.Default(), c.Timeout.Duration}
creds := bcreds.NewClientCredentials(tls.RootCAs, tls.Certificates)