Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Meter ¶
type Meter struct {
ID string `json:"id" yaml:"id"`
Name string `json:"name" yaml:"name"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
Type string `json:"type" yaml:"type"`
Aggregation MeterAggregation `json:"aggregation" yaml:"aggregation"`
ValueProperty string `json:"valueProperty,omitempty" yaml:"valueProperty,omitempty"`
GroupBy []string `json:"groupBy,omitempty" yaml:"groupBy,omitempty"`
WindowSize WindowSize `json:"windowSize,omitempty" yaml:"windowSize,omitempty"`
}
func NewMeter ¶
func NewMeter(id, name, meterType, valueProperty string, aggregation MeterAggregation, options *MeterOptions) (*Meter, error)
func (*Meter) AggregateMeterValues ¶
func (m *Meter) AggregateMeterValues(values []*MeterValue, windowSize *WindowSize) ([]*MeterValue, error)
type MeterAggregation ¶
type MeterAggregation string
const ( MeterAggregationSum MeterAggregation = "SUM" MeterAggregationCount MeterAggregation = "COUNT" MeterAggregationAvg MeterAggregation = "AVG" MeterAggregationMin MeterAggregation = "MIN" MeterAggregationMax MeterAggregation = "MAX" MeterAggregationLatest MeterAggregation = "LATEST_BY_OFFSET" // these types can not be used for further aggregations MeterAggregationCountDistinct MeterAggregation = "COUNT_DISTINCT" )
type MeterFilter ¶
type MeterFilter struct {
Property string `json:"property" yaml:"property"`
Operator MeterFilterOperator `json:"operator" yaml:"operator"`
Value string `json:"value" yaml:"value"`
}
type MeterFilterOperator ¶
type MeterFilterOperator string
const ( // MeterFilterOperatorIn MeterFilterOperator = "IN" // MeterFilterOperatorNotIn MeterFilterOperator = "NOT IN" MeterFilterOperatorEquals MeterFilterOperator = "EQ" MeterFilterOperatorNot MeterFilterOperator = "NEQ" MeterFilterLowerThan MeterFilterOperator = "LT" MeterFilterLowerThanOrEq MeterFilterOperator = "LTE" MeterFilterGreaterThan MeterFilterOperator = "GT" MeterFilterGreaterThanOrEq MeterFilterOperator = "GTE" MeterFilterOperatorIsNull MeterFilterOperator = "IS NULL" MeterFilterOperatorIsNotNull MeterFilterOperator = "IS NOT NULL" )
type MeterOptions ¶
type MeterOptions struct {
Description string
Labels map[string]string
GroupBy []string
WindowSize *WindowSize
}
type MeterValue ¶
type MeterValue struct {
Subject string `json:"subject"`
WindowStart time.Time `json:"windowStart"`
WindowEnd time.Time `json:"windowEnd"`
Value float64 `json:"value"`
GroupBy map[string]string `json:"groupBy"`
}
func (*MeterValue) Render ¶
func (m *MeterValue) Render(w http.ResponseWriter, r *http.Request) error
type WindowSize ¶
type WindowSize string
const ( WindowSizeMinute WindowSize = "MINUTE" WindowSizeHour WindowSize = "HOUR" WindowSizeDay WindowSize = "DAY" )
func (WindowSize) Duration ¶
func (w WindowSize) Duration() time.Duration
Duration returns the duration of the window size
Click to show internal directories.
Click to hide internal directories.