metrics

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FieldScopeReport        FieldScope = "report"
	FieldScopeVulnerability FieldScope = "vulnerability"
	DefaultLabels           string     = "" /* 233-byte string literal not displayed */
)
View Source
const (
	LabelGroupAll = "all"
)

Variables

View Source
var ImageVulnerability *prometheus.GaugeVec
View Source
var VulnerabilityLabels []VulnerabilityLabel

Functions

func GetLabelNames

func GetLabelNames(list []VulnerabilityLabel) []string

func RegisterVulnerabilityCollector

func RegisterVulnerabilityCollector(registry *prometheus.Registry, l string)

RegisterVulnerabilityCollector registers a prometheus type for image vulnerabilities

Types

type Exporter

type Exporter struct {
	Container   *v1.Container
	Namespace   string
	TrivyResult *types.Result
	Image       *parser.Reference
	ImageDigest string
}

Exporter represents a type which can publish prometheus metrics for scan results

func NewExporter

func NewExporter(container *v1.Container, namespace string, trivyResult *types.Result, image *parser.Reference, imageDigest string) Exporter

NewExporter returns an Exporter type

func (Exporter) PublishReportMetrics

func (e Exporter) PublishReportMetrics()

PublishReportMetrics publishes the trivy scan results for each vulnerability

type FieldScope

type FieldScope string

type VulnerabilityLabel

type VulnerabilityLabel struct {
	Name   string
	Groups []string
	Scope  FieldScope
}

func GetMetricsLabels

func GetMetricsLabels(l string) []VulnerabilityLabel

GetMetricsLabels returns a slice of VulnerabilityLabels from the labels string supplied in the config l = "image_digest, report_name, image_namespace.. etc"

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL