diff --git a/crl/storer/storer.go b/crl/storer/storer.go index a669019d3f5..41c1624e25a 100644 --- a/crl/storer/storer.go +++ b/crl/storer/storer.go @@ -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 @@ -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", @@ -85,7 +78,6 @@ func New( s3Client: s3Client, s3Bucket: s3Bucket, uploadCount: uploadCount, - sizeHistogram: sizeHistogram, latencyHistogram: latencyHistogram, log: log, clk: clk, @@ -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) diff --git a/crl/updater/updater.go b/crl/updater/updater.go index 796590ddfea..ede6c19cb40 100644 --- a/crl/updater/updater.go +++ b/crl/updater/updater.go @@ -5,6 +5,7 @@ import ( "crypto/sha256" "fmt" "io" + "strconv" "time" "github.com/jmhodges/clock" @@ -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 @@ -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, @@ -120,6 +133,8 @@ func NewUpdater( cs, tickHistogram, updatedCounter, + sizeBytesGauge, + sizeEntriesGauge, log, clk, }, nil @@ -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 }