prom

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2021 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllPostingsKey

func AllPostingsKey() (name, value string)

AllPostingsKey returns the label key that is used to store the postings list of all existing IDs.

func DefaultEngineOptions

func DefaultEngineOptions(timeout time.Duration, maxSamples int) promql.EngineOpts

func NewRangeStorage

func NewRangeStorage() *rangeStorage

func NewUnorderedmemPostings

func NewUnorderedmemPostings() *memPostings

NewUnorderedmemPostings returns a memPostings that is not safe to be read from until ensureOrder was called once.

func NewmemPostings

func NewmemPostings() *memPostings

NewmemPostings returns a memPostings that's ready for reads and writes.

func PlainMarshal

func PlainMarshal(value promql.Value) ([]byte, error)

func PromTimestamp

func PromTimestamp(normalTime time.Time) int64

func ToPlain

func ToPlain(result *promql.Result) (*string, error)

func ToPrettyColoredJson

func ToPrettyColoredJson(result *promql.Result) (*string, error)

func ToPrettyFormat

func ToPrettyFormat(res *promql.Result, outputType string, colorized bool) (*string, error)

func ToPrettyJson

func ToPrettyJson(result *promql.Result) (*string, error)

func ToYaml

func ToYaml(result *promql.Result) (*string, error)

Types

type DataSource

type DataSource interface {
	ScrapePrometheusEndpoint(ctx context.Context, nowish time.Time) ([]ParsedSeries, error)
}

type Indexer

type Indexer interface {
	UpdateMetric(m ParsedSeries)
	GetMetricNames() sets.String
	GetStoredDimensionsForMetric(string) sets.String
	GetStoredValuesForMetricAndDimension(string, string) sets.String
}

func NewIndex

func NewIndex() Indexer

type ParsedSeries

type ParsedSeries struct {
	Labels    labels.Labels
	Value     float64
	Timestamp int64
}

func ParseTextData

func ParseTextData(data []byte, nowish time.Time) ([]ParsedSeries, error)

func ParseTextDataWithAdditionalLabels

func ParseTextDataWithAdditionalLabels(data []byte, nowish time.Time, ls map[string]string) ([]ParsedSeries, error)

type PeriodicData

type PeriodicData struct {
	Callback ResultsCallback
	Query    string
	Times    Range
	// contains filtered or unexported fields
}

func NewPeriodicData

func NewPeriodicData(source DataSource, opts promql.EngineOpts) *PeriodicData

func (*PeriodicData) GetIndex

func (q *PeriodicData) GetIndex() Indexer

func (*PeriodicData) ManuallyExecuteQuery

func (q *PeriodicData) ManuallyExecuteQuery(ctx context.Context, cb ResultsCallback) error

func (*PeriodicData) Scrape

func (q *PeriodicData) Scrape(ctx context.Context) error

func (*PeriodicData) SetQuery

func (q *PeriodicData) SetQuery(ctx context.Context, query string) error

type Range

type Range struct {
	Window   time.Duration
	Interval time.Duration
	Instant  bool
}

type ResultsCallback

type ResultsCallback func(*promql.Result) error

ResultsCallback is a function that processes the results of a prometheus query The given results are *only* valid for the life of the query, and must be deep-copied if they are kept around.

Jump to

Keyboard shortcuts

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