tsdb

package
v4.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2016 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateInterval

func CalculateInterval(timerange *TimeRange) string

func GetDefaultClient

func GetDefaultClient() *http.Client

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 DataSourceInfo

type DataSourceInfo struct {
	Id                int64
	Name              string
	PluginId          string
	Url               string
	Password          string
	User              string
	Database          string
	BasicAuth         bool
	BasicAuthUser     string
	BasicAuthPassword string
	JsonData          *simplejson.Json
}

type Executor

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

type GetExecutorFn

type GetExecutorFn func(dsInfo *DataSourceInfo) Executor

type HandleRequestFunc

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

type Query

type Query struct {
	RefId         string
	Model         *simplejson.Json
	Depends       []string
	DataSource    *DataSourceInfo
	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"`
}

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