models

package
v0.0.0-...-fb7f86c Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlignTimeRange

func AlignTimeRange(t time.Time, step time.Duration, offset int64) time.Time

Types

type Exemplar

type Exemplar struct {
	SeriesLabels map[string]string
	Fields       []*data.Field
	RowIdx       int
	Value        float64
	Timestamp    time.Time
}

type Query

type Query struct {
	Expr          string
	Step          time.Duration
	LegendFormat  string
	Start         time.Time
	End           time.Time
	RefId         string
	InstantQuery  bool
	RangeQuery    bool
	ExemplarQuery bool
	UtcOffsetSec  int64
}

func Parse

func Parse(query backend.DataQuery, timeInterval string, intervalCalculator intervalv2.Calculator, fromAlert bool) (*Query, error)

func (*Query) TimeRange

func (query *Query) TimeRange() TimeRange

func (*Query) Type

func (query *Query) Type() TimeSeriesQueryType

type QueryModel

type QueryModel struct {
	dataquery.PrometheusDataQuery
	// The following properties may be part of the request payload, however they are not saved in panel JSON
	// Timezone offset to align start & end time on backend
	UtcOffsetSec   int64  `json:"utcOffsetSec,omitempty"`
	LegendFormat   string `json:"legendFormat,omitempty"`
	Interval       string `json:"interval,omitempty"`
	IntervalMs     int64  `json:"intervalMs,omitempty"`
	IntervalFactor int64  `json:"intervalFactor,omitempty"`
}

type ResultType

type ResultType string
const (
	ResultTypeMatrix   ResultType = "matrix"
	ResultTypeExemplar ResultType = "exemplar"
	ResultTypeVector   ResultType = "vector"
	ResultTypeUnknown  ResultType = ""
)

func ResultTypeFromFrame

func ResultTypeFromFrame(frame *data.Frame) ResultType

func (ResultType) String

func (r ResultType) String() string

type TimeRange

type TimeRange struct {
	Start time.Time
	End   time.Time
	Step  time.Duration
}

type TimeSeriesQueryType

type TimeSeriesQueryType string
const (
	RangeQueryType    TimeSeriesQueryType = "range"
	InstantQueryType  TimeSeriesQueryType = "instant"
	ExemplarQueryType TimeSeriesQueryType = "exemplar"
	UnknownQueryType  TimeSeriesQueryType = "unknown"
)

Jump to

Keyboard shortcuts

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