tsdb

package
v4.2.0-beta1+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2017 License: Apache-2.0 Imports: 9 Imported by: 1,718

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterExecutor

func RegisterExecutor(pluginId string, fn GetExecutorFn)

Types

type Batch

type Batch struct {
	DataSourceId int64
	Queries      QuerySlice
	Depends      map[string]bool
	Done         bool
	Started      bool
}

type BatchResult

type BatchResult struct {
	Error        error
	QueryResults map[string]*QueryResult
	Timings      *BatchTiming
}

func (*BatchResult) WithError

func (br *BatchResult) WithError(err error) *BatchResult

type BatchSlice

type BatchSlice []*Batch

type BatchTiming

type BatchTiming struct {
	TimeElapsed int64
}

type Executor

type Executor interface {
	Execute(ctx context.Context, queries QuerySlice, query *QueryContext) *BatchResult
}

type GetExecutorFn

type GetExecutorFn func(dsInfo *models.DataSource) (Executor, error)

type HandleRequestFunc

type HandleRequestFunc func(ctx context.Context, req *Request) (*Response, error)

type Interval

type Interval struct {
	Text  string
	Value time.Duration
}

func CalculateInterval

func CalculateInterval(timerange *TimeRange) Interval

type Query

type Query struct {
	RefId         string
	Model         *simplejson.Json
	Depends       []string
	DataSource    *models.DataSource
	Results       []*TimeSeries
	Exclude       bool
	MaxDataPoints int64
	IntervalMs    int64
}

type QueryContext

type QueryContext struct {
	TimeRange   *TimeRange
	Queries     QuerySlice
	Results     map[string]*QueryResult
	ResultsChan chan *BatchResult
	Lock        sync.RWMutex
	BatchWaits  sync.WaitGroup
}

func NewQueryContext

func NewQueryContext(queries QuerySlice, timeRange *TimeRange) *QueryContext

type QueryResult

type QueryResult struct {
	Error  error           `json:"error"`
	RefId  string          `json:"refId"`
	Series TimeSeriesSlice `json:"series"`
}

func NewQueryResult

func NewQueryResult() *QueryResult

type QuerySlice

type QuerySlice []*Query

type Request

type Request struct {
	TimeRange *TimeRange
	Queries   QuerySlice
}

type Response

type Response struct {
	BatchTimings []*BatchTiming          `json:"timings"`
	Results      map[string]*QueryResult `json:"results"`
}

func HandleRequest

func HandleRequest(ctx context.Context, req *Request) (*Response, error)

type TimePoint

type TimePoint [2]null.Float

func NewTimePoint

func NewTimePoint(value null.Float, timestamp float64) TimePoint

type TimeRange

type TimeRange struct {
	From string
	To   string
	Now  time.Time
}

func NewTimeRange

func NewTimeRange(from, to string) *TimeRange

func (*TimeRange) GetFromAsMsEpoch

func (tr *TimeRange) GetFromAsMsEpoch() int64

func (*TimeRange) GetToAsMsEpoch

func (tr *TimeRange) GetToAsMsEpoch() int64

func (*TimeRange) MustGetFrom

func (tr *TimeRange) MustGetFrom() time.Time

func (*TimeRange) MustGetTo

func (tr *TimeRange) MustGetTo() time.Time

func (*TimeRange) ParseFrom

func (tr *TimeRange) ParseFrom() (time.Time, error)

func (*TimeRange) ParseTo

func (tr *TimeRange) ParseTo() (time.Time, error)

type TimeSeries

type TimeSeries struct {
	Name   string            `json:"name"`
	Points TimeSeriesPoints  `json:"points"`
	Tags   map[string]string `json:"tags"`
}

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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