trufflehog/pkg/sources/docker/metrics.go
James Telfer 0024b6ce77
feat: support docker image history scanning (#2882)
* feat: support docker image history scanning

* refactor: collapse error handling into return

Style suggestion from review feedback.

* fix: associate layers with history entries

Where possible, add the associated layer to the history entry record. This may help tracing any issues discovered.

This also changes the entry reference format to `image-metadata:history:%d:created-by` which _may_ be more self-explanatory.
2024-05-28 14:07:43 -07:00

34 lines
1 KiB
Go

package docker
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/trufflesecurity/trufflehog/v3/pkg/common"
)
var (
dockerLayersScanned = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: common.MetricsNamespace,
Subsystem: common.MetricsSubsystem,
Name: "docker_layers_scanned",
Help: "Total number of Docker layers scanned.",
},
[]string{"source_name"})
dockerHistoryEntriesScanned = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: common.MetricsNamespace,
Subsystem: common.MetricsSubsystem,
Name: "docker_history_entries_scanned",
Help: "Total number of Docker image history entries scanned.",
},
[]string{"source_name"})
dockerImagesScanned = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: common.MetricsNamespace,
Subsystem: common.MetricsSubsystem,
Name: "docker_images_scanned",
Help: "Total number of Docker images scanned.",
},
[]string{"source_name"})
)