Documentation ¶
Index ¶
- func EpochPrecisionToMs(value float64) float64
- func FormatDuration(inter time.Duration) string
- func GetIntervalFrom(dsInfo *models.DataSource, queryModel *simplejson.Json, ...) (time.Duration, error)
- func NewIntervalCalculator(opt *IntervalOptions) *intervalCalculator
- func RegisterTsdbQueryEndpoint(pluginId string, fn GetTsdbQueryEndpointFn)
- func SeriesToFrame(series *TimeSeries) (*data.Frame, error)
- type DataFrames
- type GetTsdbQueryEndpointFn
- type HandleRequestFunc
- 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
- type TsdbQueryEndpoint
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 GetIntervalFrom(dsInfo *models.DataSource, queryModel *simplejson.Json, defaultInterval time.Duration) (time.Duration, error)
func NewIntervalCalculator ¶
func NewIntervalCalculator(opt *IntervalOptions) *intervalCalculator
func RegisterTsdbQueryEndpoint ¶
func RegisterTsdbQueryEndpoint(pluginId string, fn GetTsdbQueryEndpointFn)
func SeriesToFrame ¶
func SeriesToFrame(series *TimeSeries) (*data.Frame, error)
SeriesToFrame converts a TimeSeries to a sdk Frame
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 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 GetTsdbQueryEndpointFn ¶
type GetTsdbQueryEndpointFn func(dsInfo *models.DataSource) (TsdbQueryEndpoint, error)
type HandleRequestFunc ¶
type Interval ¶
func (*Interval) Milliseconds ¶
type IntervalCalculator ¶
type IntervalOptions ¶
type Query ¶
type Query struct { RefId string Model *simplejson.Json DataSource *models.DataSource MaxDataPoints int64 IntervalMs int64 QueryType string }
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"` }
func HandleRequest ¶
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"` }
func NewTimeSeries ¶
func NewTimeSeries(name string, points TimeSeriesPoints) *TimeSeries
type TimeSeriesPoints ¶
type TimeSeriesPoints []TimePoint
func NewTimeSeriesPointsFromArgs ¶
func NewTimeSeriesPointsFromArgs(values ...float64) TimeSeriesPoints
type TimeSeriesSlice ¶
type TimeSeriesSlice []*TimeSeries
func FrameToSeriesSlice ¶
func FrameToSeriesSlice(frame *data.Frame) (TimeSeriesSlice, error)
FrameToSeriesSlice converts a frame that is a valid time series as per data.TimeSeriesSchema() to a TimeSeriesSlice.
type TsdbQuery ¶
type TsdbQuery struct { TimeRange *TimeRange Queries []*Query Headers map[string]string Debug bool User *models.SignedInUser }
TsdbQuery contains all information about a query request.
type TsdbQueryEndpoint ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
mock_stsiface
Package mock_stsiface is a generated GoMock package.
|
Package mock_stsiface is a generated GoMock package. |