types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2019 License: BSD-2-Clause Imports: 11 Imported by: 93

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrWildcardNotAllowed is an eval error returned when a wildcard/glob argument is found where a single series is required.
	ErrWildcardNotAllowed = errors.New("found wildcard where series expected")
	// ErrTooManyArguments is an eval error returned when too many arguments are provided.
	ErrTooManyArguments = errors.New("too many arguments")
)

Functions

func AggFirst

func AggFirst(v []float64, absent []bool) (float64, bool)

AggFirst returns first point

func AggLast

func AggLast(v []float64, absent []bool) (float64, bool)

AggLast returns last point

func AggMax

func AggMax(v []float64, absent []bool) (float64, bool)

AggMax computes max of values

func AggMean

func AggMean(v []float64, absent []bool) (float64, bool)

AggMean computes mean (sum(v)/len(v), excluding NaN points) of values

func AggMin

func AggMin(v []float64, absent []bool) (float64, bool)

AggMin computes min of values

func AggSum

func AggSum(v []float64, absent []bool) (float64, bool)

AggSum computes sum of values

func ConsolidateJSON

func ConsolidateJSON(maxDataPoints int, results []*MetricData)

ConsolidateJSON consolidates values to maxDataPoints size

func MarshalCSV

func MarshalCSV(results []*MetricData, location *time.Location) []byte

MarshalCSV marshals metric data to CSV

func MarshalJSON

func MarshalJSON(results []*MetricData) []byte

MarshalJSON marshals metric data to JSON

func MarshalPickle

func MarshalPickle(results []*MetricData) []byte

MarshalPickle marshals metric data to pickle format

func MarshalProtobuf

func MarshalProtobuf(results []*MetricData) ([]byte, error)

MarshalProtobuf marshals metric data to protobuf

func MarshalRaw

func MarshalRaw(results []*MetricData) []byte

MarshalRaw marshals metric data to graphite's internal format, called 'raw'

Types

type FunctionDescription

type FunctionDescription struct {
	Description string          `json:"description"`
	Function    string          `json:"function"`
	Group       string          `json:"group"`
	Module      string          `json:"module"`
	Name        string          `json:"name"`
	Params      []FunctionParam `json:"params,omitempty"`

	Proxied bool `json:"proxied"`
}

FunctionDescription contains full function description.

type FunctionParam

type FunctionParam struct {
	Name        string        `json:"name"`
	Multiple    bool          `json:"multiple,omitempty"`
	Required    bool          `json:"required,omitempty"`
	Type        FunctionType  `json:"type,omitempty"`
	Options     []string      `json:"options,omitempty"`
	Suggestions []*Suggestion `json:"suggestions,omitempty"`
	Default     *Suggestion   `json:"default,omitempty"`
}

FunctionParam contains list of all available parameters of function

type FunctionType

type FunctionType int

FunctionType is a special type to handle parameter type in function description

const (
	// AggFunc is a constant for AggregationFunction type
	AggFunc FunctionType = iota
	// Boolean is a constant for Boolean type
	Boolean
	// Date is a constant for Date type
	Date
	// Float is a constant for Float type
	Float
	// IntOrInterval is a constant for Interval-Or-Integer type
	IntOrInterval
	// Integer is a constant for Integer type
	Integer
	// Interval is a constant for Interval type
	Interval
	// Node is a constant for Node type
	Node
	// NodeOrTag is a constant for Node-Or-Tag type
	NodeOrTag
	// SeriesList is a constant for SeriesList type
	SeriesList
	// SeriesLists is a constant for SeriesLists type
	SeriesLists
	// String is a constant for String type
	String
	// Tag is a constant for Tag type
	Tag
)

func (FunctionType) MarshalJSON

func (t FunctionType) MarshalJSON() ([]byte, error)

MarshalJSON marshals metric data to JSON

func (*FunctionType) UnmarshalJSON

func (t *FunctionType) UnmarshalJSON(d []byte) error

type GraphOptions

type GraphOptions struct {
}

type MetricData

type MetricData struct {
	types.Metric

	GraphOptions

	ValuesPerPoint int

	AggregateFunction func([]float64, []bool) (float64, bool)
	// contains filtered or unexported fields
}

MetricData contains necessary data to represent parsed metric (ready to be send out or drawn)

func MakeMetricData

func MakeMetricData(name string, values []float64, step, start int32) *MetricData

MakeMetricData creates new metrics data with given metric timeseries

func (*MetricData) AggregateValues

func (r *MetricData) AggregateValues()

AggregateValues aggregates values

func (*MetricData) AggregatedAbsent

func (r *MetricData) AggregatedAbsent() []bool

AggregatedAbsent aggregates absent values

func (*MetricData) AggregatedTimeStep

func (r *MetricData) AggregatedTimeStep() int32

AggregatedTimeStep aggregates time step

func (*MetricData) AggregatedValues

func (r *MetricData) AggregatedValues() []float64

AggregatedValues aggregates values (with cache)

func (*MetricData) SetValuesPerPoint

func (r *MetricData) SetValuesPerPoint(v int)

SetValuesPerPoint sets value per point coefficient.

type MetricHeap

type MetricHeap []MetricHeapElement

func (MetricHeap) Len

func (m MetricHeap) Len() int

func (MetricHeap) Less

func (m MetricHeap) Less(i, j int) bool

func (*MetricHeap) Pop

func (m *MetricHeap) Pop() interface{}

Pop pops out data from MetricHeap

func (*MetricHeap) Push

func (m *MetricHeap) Push(x interface{})

Push pushes data to MetricHeap

func (MetricHeap) Swap

func (m MetricHeap) Swap(i, j int)

type MetricHeapElement

type MetricHeapElement struct {
	Idx int
	Val float64
}

type Suggestion

type Suggestion struct {
	Type  SuggestionTypes
	Value interface{}
}

func NewSuggestion

func NewSuggestion(arg interface{}) *Suggestion

func NewSuggestions

func NewSuggestions(vaArgs ...interface{}) []*Suggestion

func (Suggestion) MarshalJSON

func (t Suggestion) MarshalJSON() ([]byte, error)

MarshalJSON marshals metric data to JSON

func (*Suggestion) UnmarshalJSON

func (t *Suggestion) UnmarshalJSON(d []byte) error

type SuggestionTypes

type SuggestionTypes int
const (
	SInt SuggestionTypes = iota
	SInt32
	SInt64
	SUint
	SUint32
	SUint64
	SFloat64
	SString
	SBool
	SNone
)

type Windowed

type Windowed struct {
	Data []float64
	// contains filtered or unexported fields
}

Windowed is a struct to compute simple windowed stats

func (*Windowed) Len

func (w *Windowed) Len() int

Len returns current len of data

func (*Windowed) Max

func (w *Windowed) Max() float64

Max returns max(values)

func (*Windowed) Mean

func (w *Windowed) Mean() float64

Mean returns mean value of data

func (*Windowed) Min

func (w *Windowed) Min() float64

Min returns min(values)

func (*Windowed) Push

func (w *Windowed) Push(n float64)

Push pushes data

func (*Windowed) Stdev

func (w *Windowed) Stdev() float64

Stdev computes standard deviation of data

func (*Windowed) Sum

func (w *Windowed) Sum() float64

Sum returns sum of data

func (*Windowed) SumSQ

func (w *Windowed) SumSQ() float64

SumSQ returns sum of squares

Jump to

Keyboard shortcuts

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