Skip to content

Find, verify, and analyze leaked credentials

Add source type label to chunk size metric (#4543)

Cody Rosef15cb8b37b9b
diff --git a/pkg/engine/engine.go b/pkg/engine/engine.go
index f5de6cb3b..ffc69e91b 100644
--- a/pkg/engine/engine.go
+++ b/pkg/engine/engine.go
@@ -832,7 +832,7 @@ func (e *Engine) scannerWorker(ctx context.Context) {
dataSize := float64(len(chunk.Data))
- scanBytesPerChunk.Observe(dataSize)
+ scanBytesPerChunk.WithLabelValues(chunk.SourceType.String()).Observe(dataSize)
jobBytesScanned.WithLabelValues(
chunk.SourceType.String(),
chunk.SourceName,
diff --git a/pkg/engine/metrics.go b/pkg/engine/metrics.go
index 8cded174c..212061ca9 100644
--- a/pkg/engine/metrics.go
+++ b/pkg/engine/metrics.go
@@ -55,13 +55,15 @@ var (
[]string{"source_type", "source_name"},
)
- scanBytesPerChunk = promauto.NewHistogram(prometheus.HistogramOpts{
+ scanBytesPerChunk = promauto.NewHistogramVec(prometheus.HistogramOpts{
Namespace: common.MetricsNamespace,
Subsystem: common.MetricsSubsystem,
Name: "scan_bytes_per_chunk",
Help: "Total number of bytes in a chunk.",
Buckets: prometheus.ExponentialBuckets(1, 2, 18),
- })
+ },
+ []string{"source_type"},
+ )
jobChunksScanned = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: common.MetricsNamespace,