Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions crl/storer/storer.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ type crlStorer struct {
s3Bucket string
issuers map[issuance.NameID]*issuance.Certificate
uploadCount *prometheus.CounterVec
sizeHistogram *prometheus.HistogramVec
latencyHistogram *prometheus.HistogramVec
log blog.Logger
clk clock.Clock
Expand All @@ -68,12 +67,6 @@ func New(
Help: "A counter of the number of CRLs uploaded by crl-storer",
}, []string{"issuer", "result"})

sizeHistogram := promauto.With(stats).NewHistogramVec(prometheus.HistogramOpts{
Name: "crl_storer_sizes",
Help: "A histogram of the sizes (in bytes) of CRLs uploaded by crl-storer",
Buckets: []float64{0, 256, 1024, 4096, 16384, 65536},
}, []string{"issuer"})

latencyHistogram := promauto.With(stats).NewHistogramVec(prometheus.HistogramOpts{
Name: "crl_storer_upload_times",
Help: "A histogram of the time (in seconds) it took crl-storer to upload CRLs",
Expand All @@ -85,7 +78,6 @@ func New(
s3Client: s3Client,
s3Bucket: s3Bucket,
uploadCount: uploadCount,
sizeHistogram: sizeHistogram,
latencyHistogram: latencyHistogram,
log: log,
clk: clk,
Expand Down Expand Up @@ -149,8 +141,6 @@ func (cs *crlStorer) UploadCRL(stream grpc.ClientStreamingServer[cspb.UploadCRLR

crlId := crl.Id(issuer.NameID(), int(shardIdx), crlNumber)

cs.sizeHistogram.WithLabelValues(issuer.Subject.CommonName).Observe(float64(len(crlBytes)))

crl, err := x509.ParseRevocationList(crlBytes)
if err != nil {
return fmt.Errorf("parsing CRL for %s: %w", crlId, err)
Expand Down
21 changes: 19 additions & 2 deletions crl/updater/updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"crypto/sha256"
"fmt"
"io"
"strconv"
"time"

"github.com/jmhodges/clock"
Expand Down Expand Up @@ -39,8 +40,10 @@ type crlUpdater struct {
ca capb.CRLGeneratorClient
cs cspb.CRLStorerClient

tickHistogram *prometheus.HistogramVec
updatedCounter *prometheus.CounterVec
tickHistogram *prometheus.HistogramVec
updatedCounter *prometheus.CounterVec
sizeBytesGauge *prometheus.GaugeVec
sizeEntriesGauge *prometheus.GaugeVec

log blog.Logger
clk clock.Clock
Expand Down Expand Up @@ -104,6 +107,16 @@ func NewUpdater(
Help: "A counter of CRL generation calls labeled by result",
}, []string{"issuer", "result"})

sizeBytesGauge := promauto.With(stats).NewGaugeVec(prometheus.GaugeOpts{
Name: "crl_updater_crl_size_bytes",
Help: "The size in bytes of each CRL, labeled by issuer and shard",
}, []string{"issuer", "shard"})

sizeEntriesGauge := promauto.With(stats).NewGaugeVec(prometheus.GaugeOpts{
Name: "crl_updater_crl_size_entries",
Help: "The number of entries in each CRL, labeled by issuer and shard",
}, []string{"issuer", "shard"})

return &crlUpdater{
issuersByNameID,
numShards,
Expand All @@ -120,6 +133,8 @@ func NewUpdater(
cs,
tickHistogram,
updatedCounter,
sizeBytesGauge,
sizeEntriesGauge,
log,
clk,
}, nil
Expand Down Expand Up @@ -324,6 +339,8 @@ func (cu *crlUpdater) updateShard(ctx context.Context, atTime time.Time, issuerN
cu.log.Infof(
"Generated CRL shard: id=[%s] size=[%d] hash=[%x]",
crlID, crlLen, crlHash.Sum(nil))
cu.sizeBytesGauge.WithLabelValues(cu.issuers[issuerNameID].Subject.CommonName, strconv.Itoa(shardIdx)).Set(float64(crlLen))
cu.sizeEntriesGauge.WithLabelValues(cu.issuers[issuerNameID].Subject.CommonName, strconv.Itoa(shardIdx)).Set(float64(len(crlEntries)))

return nil
}
Loading