tsdb

package
v4.5.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

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:"-"`
	ErrorString string           `json:"error,omitempty"`
	RefId       string           `json:"refId"`
	Meta        *simplejson.Json `json:"meta,omitempty"`
	Series      TimeSeriesSlice  `json:"series"`
	Tables      []*Table         `json:"tables"`
}

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"`
	Message      string                  `json:"message,omitempty"`
}

func HandleRequest

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

type RowValues

type RowValues []interface{}

type Table

type Table struct {
	Columns []TableColumn `json:"columns"`
	Rows    []RowValues   `json:"rows"`
}

type TableColumn

type TableColumn struct {
	Text string `json:"text"`
}

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,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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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