metricsmanager

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2026 License: Apache-2.0 Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB handles updating metrics

func NewDB

func NewDB(ctx context.Context, db *sql.DB) (*DB, error)

NewDB creates a new DB.

func (*DB) Name

func (db *DB) Name() string

Name returns the name of the module.

func (*DB) UpdateAlertMetrics

func (db *DB) UpdateAlertMetrics(ctx context.Context) error

UpdateAlertMetrics will update the alert metrics table

Theory of Operation:

1. Acquire processing lock
2. Get batch of oldest alert IDs after cursor (use LastLogID as a tie breaker)
3. Insert metrics for these alerts
4. Set cursor to last inserted
5. If none inserted, set cursor to upper time bound

func (*DB) UpdateAll

func (db *DB) UpdateAll(ctx context.Context) error

type State

type State struct {
	V2 struct {
		// LastLogTime is a cursor for processed alert_logs
		LastLogTime time.Time

		// LastLogID breaks ties for the LastLogTime cursor
		LastLogID int

		// LastMetricsDate is a cursor for processed alert_metrics
		LastMetricsDate time.Time
	}
}

Jump to

Keyboard shortcuts

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