Documentation ¶
Index ¶
- func EpochPrecisionToMs(value float64) float64
- func FormatDuration(inter time.Duration) string
- func GetIntervalFrom(dsInfo *backend.DataSourceInstanceSettings, queryModel *simplejson.Json, ...) (time.Duration, error)
- func NewIntervalCalculator(opt *IntervalOptions) *intervalCalculator
- type DataFrames
- type Interval
- type IntervalCalculator
- type IntervalOptions
- type Query
- type QueryResult
- type Response
- type RowValues
- type Table
- type TableColumn
- type TimePoint
- type TimeRange
- func (tr *TimeRange) GetFromAsMsEpoch() int64
- func (tr *TimeRange) GetFromAsSecondsEpoch() int64
- func (tr *TimeRange) GetFromAsTimeUTC() time.Time
- func (tr *TimeRange) GetToAsMsEpoch() int64
- func (tr *TimeRange) GetToAsSecondsEpoch() int64
- func (tr *TimeRange) GetToAsTimeUTC() time.Time
- func (tr *TimeRange) MustGetFrom() time.Time
- func (tr *TimeRange) MustGetTo() time.Time
- func (tr *TimeRange) ParseFrom() (time.Time, error)
- func (tr *TimeRange) ParseFromWithLocation(location *time.Location) (time.Time, error)
- func (tr *TimeRange) ParseTo() (time.Time, error)
- func (tr *TimeRange) ParseToWithLocation(location *time.Location) (time.Time, error)
- type TimeSeries
- type TimeSeriesPoints
- type TimeSeriesSlice
- type TsdbQuery
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EpochPrecisionToMs ¶
EpochPrecisionToMs converts epoch precision to millisecond, if needed. Only seconds to milliseconds supported right now
func FormatDuration ¶
FormatDuration converts a duration into the kbn format e.g. 1m 2h or 3d
func GetIntervalFrom ¶
func NewIntervalCalculator ¶
func NewIntervalCalculator(opt *IntervalOptions) *intervalCalculator
Types ¶
type DataFrames ¶
type DataFrames interface { // Encoded encodes Frames into a slice of []byte. // If an error occurs [][]byte will be nil. // The encoded result, if any, will be cached and returned next time Encoded is called. Encoded() ([][]byte, error) // Decoded decodes a slice of Arrow encoded frames to data.Frames ([]*data.Frame). // If an error occurs Frames will be nil. // The decoded result, if any, will be cached and returned next time Decoded is called. Decoded() (data.Frames, error) }
DataFrames is an interface for retrieving encoded and decoded data frames.
See NewDecodedDataFrames and NewEncodedDataFrames for more information.
func NewDecodedDataFrames ¶
func NewDecodedDataFrames(decodedFrames data.Frames) DataFrames
NewDecodedDataFrames instantiates DataFrames from decoded frames.
This should be the primary function for creating DataFrames if you're implementing a plugin. In a Grafana alerting scenario it needs to operate on decoded frames, which is why this function is preferrable. When encoded data frames are needed, e.g. returned from Grafana HTTP API, it will happen automatically when MarshalJSON() is called.
func NewEncodedDataFrames ¶
func NewEncodedDataFrames(encodedFrames [][]byte) DataFrames
NewEncodedDataFrames instantiates DataFrames from encoded frames.
This one is primarily used for creating DataFrames when receiving encoded data frames from an external plugin or similar. This may allow the encoded data frames to be returned to Grafana UI without any additional decoding/encoding required. In Grafana alerting scenario it needs to operate on decoded data frames why encoded frames needs to be decoded before usage.
type Interval ¶
func (*Interval) Milliseconds ¶
type IntervalCalculator ¶
type IntervalOptions ¶
type QueryResult ¶
type QueryResult struct { Error error `json:"-"` ErrorString string `json:"error,omitempty"` RefId string `json:"refId"` Meta *simplejson.Json `json:"meta,omitempty"` Series TimeSeriesSlice `json:"series"` Tables []*Table `json:"tables"` Dataframes DataFrames `json:"dataframes"` }
func NewQueryResult ¶
func NewQueryResult() *QueryResult
type Response ¶
type Response struct { Results map[string]*QueryResult `json:"results"` Message string `json:"message,omitempty"` }
type Table ¶
type Table struct { Columns []TableColumn `json:"columns"` Rows []RowValues `json:"rows"` }
type TableColumn ¶
type TableColumn struct {
Text string `json:"text"`
}
type TimeRange ¶
func NewTimeRange ¶
func (*TimeRange) GetFromAsMsEpoch ¶
func (*TimeRange) GetFromAsSecondsEpoch ¶
func (*TimeRange) GetFromAsTimeUTC ¶
func (*TimeRange) GetToAsMsEpoch ¶
func (*TimeRange) GetToAsSecondsEpoch ¶
func (*TimeRange) GetToAsTimeUTC ¶
func (*TimeRange) MustGetFrom ¶
func (*TimeRange) ParseFromWithLocation ¶
type TimeSeries ¶
type TimeSeries struct { Name string `json:"name"` Points TimeSeriesPoints `json:"points"` Tags map[string]string `json:"tags,omitempty"` }
type TimeSeriesPoints ¶
type TimeSeriesPoints []TimePoint
type TimeSeriesSlice ¶
type TimeSeriesSlice []*TimeSeries