metricsreader

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LabelNameInstance = "instance"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultMetricsReader

type DefaultMetricsReader struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewDefaultMetricsReader

func NewDefaultMetricsReader(lg *zap.Logger, promFetcher PromInfoFetcher, cfg *config.HealthCheck) *DefaultMetricsReader

func (*DefaultMetricsReader) AddQueryExpr

func (dmr *DefaultMetricsReader) AddQueryExpr(queryExpr QueryExpr) uint64

func (*DefaultMetricsReader) Close

func (dmr *DefaultMetricsReader) Close()

func (*DefaultMetricsReader) GetQueryResult

func (dmr *DefaultMetricsReader) GetQueryResult(id uint64) QueryResult

func (*DefaultMetricsReader) RemoveQueryExpr

func (dmr *DefaultMetricsReader) RemoveQueryExpr(id uint64)

func (*DefaultMetricsReader) Start

func (dmr *DefaultMetricsReader) Start(ctx context.Context)

type MetricsReader

type MetricsReader interface {
	Start(ctx context.Context)
	AddQueryExpr(queryExpr QueryExpr) uint64
	RemoveQueryExpr(id uint64)
	GetQueryResult(id uint64) QueryResult
	Close()
}

type PromInfoFetcher

type PromInfoFetcher interface {
	GetPromInfo(ctx context.Context) (*infosync.PrometheusInfo, error)
}

type QueryExpr

type QueryExpr struct {
	PromQL   string
	Range    time.Duration
	HasLabel bool
}

func (QueryExpr) PromRange

func (qe QueryExpr) PromRange(curTime time.Time) promv1.Range

type QueryResult

type QueryResult struct {
	Value      model.Value
	Err        error
	UpdateTime monotime.Time
}

func (QueryResult) Empty

func (qr QueryResult) Empty() bool

func (QueryResult) GetSample4Backend

func (qr QueryResult) GetSample4Backend(backend policy.BackendCtx) *model.Sample

GetSample4Backend returns metric of a backend from a vector.

func (QueryResult) GetSamplePair4Backend

func (qr QueryResult) GetSamplePair4Backend(backend policy.BackendCtx) []model.SamplePair

GetSamplePair4Backend returns metric of a backend from a matrix.

Jump to

Keyboard shortcuts

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