Skip to content

Commit

Permalink
Add some timing histogram stats (#2482)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jsha authored and Roland Bracewell Shoemaker committed Jan 10, 2017
1 parent 5aa78a5 commit d6ba7fc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions cmd/ocsp-updater/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion grpc/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d6ba7fc

Please sign in to comment.