metrics

package
v1.5.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

type Callback interface {
	// Name identifies the monitor test
	Name() string

	// StartSeries is invoked when the metrics analyzer discovers a new series
	StartSeries(metric prometheustypes.Metric)

	// NewInterval is invoked when the metrics analyzer discovers a new interval
	NewInterval(metric prometheustypes.Metric, from, to *prometheustypes.SamplePair)

	// EndSeries is invoked when the metrics reaches the end of the given series
	EndSeries()
}

type PrometheusQueryRunner

type PrometheusQueryRunner struct {
	Client      prometheusv1.API
	QueryString string
	Step        time.Duration
}

default prometheus query runner in use

func (*PrometheusQueryRunner) RunQuery

func (q *PrometheusQueryRunner) RunQuery(ctx context.Context, from, to time.Time) (prometheustypes.Value, error)

type QueryRunner

type QueryRunner interface {
	RunQuery(ctx context.Context, from, to time.Time) (prometheustypes.Value, error)
}

invokes a prometheus query and returns the results

type RateSeriesAnalyzer

type RateSeriesAnalyzer struct{}

RateSeriesAnalyzer analyzes a rate based time series, it scans a prometheus Matrix type time series, and for each sequence of non-zero values discovered, it publishes it as an interval of interest via the given Callback.

func (RateSeriesAnalyzer) Analyze

func (RateSeriesAnalyzer) Analyze(ctx context.Context, query QueryRunner, start, end time.Time, callback Callback) error

type SeriesAnalyzer

type SeriesAnalyzer interface {
	Analyze(ctx context.Context, query QueryRunner, start, end time.Time, callback Callback) error
}

Analyzes a prometheus series

Jump to

Keyboard shortcuts

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