metricsmanager

package
v0.30.1 Latest Latest
Warning

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

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

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. Aquire 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