metrics

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterScan

func RegisterScan(metric *Metric)

RegisterScan fetches a metric handler and enqueues a metric

Types

type Metric

type Metric struct {
	Scanned int
	Updated int
	Failed  int
}

Metric is the data points of a single scan

func NewMetric

func NewMetric(report types.Report) *Metric

NewMetric returns a Metric with the counts taken from the appropriate types.Report fields

type Metrics

type Metrics struct {
	// contains filtered or unexported fields
}

Metrics is the handler processing all individual scan metrics

func Default

func Default() *Metrics

Default creates a new metrics handler if none exists, otherwise returns the existing one.

The cron goroutine and a finishing scan's goroutine both reach this, so a plain nil check let both build the singleton: the second promauto call then panics the daemon with "duplicate metrics collector registration attempted", and two HandleUpdate goroutines end up racing for the same channel.

func (*Metrics) HandleUpdate

func (metrics *Metrics) HandleUpdate(channel <-chan *Metric)

HandleUpdate dequeue the metric channel and processes it

func (*Metrics) QueueIsEmpty

func (metrics *Metrics) QueueIsEmpty() bool

QueueIsEmpty checks whether any messages are enqueued in the channel

func (*Metrics) Register

func (metrics *Metrics) Register(metric *Metric)

Register registers metrics for an executed scan

Jump to

Keyboard shortcuts

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