Documentation
¶
Overview ¶
Package digest contains metrics handling model.
Index ¶
- func EventTypeStrings() []string
- func LevelStrings() []string
- func MetricTypeStrings() []string
- func StateStrings() []string
- func Unit(value float64) (int, int)
- func ValueTypeStrings() []string
- type Aggregate
- type Aggregates
- type ConfigData
- type Digest
- func (d *Digest) Duration() time.Duration
- func (d *Digest) FindMetric(metric string) (*Metric, bool)
- func (d *Digest) GetMetric(metric string) (*Metric, bool)
- func (d *Digest) GetState() State
- func (d *Digest) Period() time.Duration
- func (d *Digest) ProgressLabel() string
- func (d *Digest) ProgressPercent() float64
- func (d *Digest) Time() time.Time
- func (d *Digest) TimeLeft() time.Duration
- func (d *Digest) TimePassed() time.Duration
- type Digester
- type Event
- type EventType
- type Failure
- type Level
- type Metric
- type MetricType
- func (md MetricType) Aggregates() []string
- func (i MetricType) IsAMetricType() bool
- func (i MetricType) MarshalJSON() ([]byte, error)
- func (i MetricType) MarshalText() ([]byte, error)
- func (i MetricType) String() string
- func (i *MetricType) UnmarshalJSON(data []byte) error
- func (i *MetricType) UnmarshalText(text []byte) error
- type Metrics
- type ParamData
- type Peaks
- type State
- type Thresholds
- type ValueType
- func (vt ValueType) Format(value float64) string
- func (i ValueType) IsAValueType() bool
- func (i ValueType) MarshalJSON() ([]byte, error)
- func (i ValueType) MarshalText() ([]byte, error)
- func (i ValueType) String() string
- func (i *ValueType) UnmarshalJSON(data []byte) error
- func (i *ValueType) UnmarshalText(text []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EventTypeStrings ¶
func EventTypeStrings() []string
EventTypeStrings returns a slice of all String values of the enum
func LevelStrings ¶
func LevelStrings() []string
LevelStrings returns a slice of all String values of the enum
func MetricTypeStrings ¶
func MetricTypeStrings() []string
MetricTypeStrings returns a slice of all String values of the enum
func StateStrings ¶
func StateStrings() []string
StateStrings returns a slice of all String values of the enum
func ValueTypeStrings ¶
func ValueTypeStrings() []string
ValueTypeStrings returns a slice of all String values of the enum
Types ¶
type Aggregates ¶
Aggregates contains aggregetes by metric name.
func (Aggregates) Time ¶
func (a Aggregates) Time() time.Time
Time returns "value" aggregate for "time" metric.
type Digest ¶
type Digest struct { Config map[string]interface{} Param ParamData Metrics Metrics Cumulative Aggregates Snapshot Aggregates Start time.Time Stop time.Time Thresholds *Thresholds EventType EventType State State Playback bool }
Digest is the metrics digest data model.
func (*Digest) FindMetric ¶
FindMetric finds parent metric's metadata by metric name.
func (*Digest) ProgressLabel ¶
ProgressLabel return elapsed / total value as string.
func (*Digest) ProgressPercent ¶
ProgressPercent return percent value of elapsed time.
func (*Digest) TimePassed ¶
TimePassed returns elapsed time as duration.
type Digester ¶
type Digester struct {
// contains filtered or unexported fields
}
Digester is the metrics handling model.
type Event ¶
type Event struct { Type EventType `json:"event,omitempty"` Data interface{} `json:"data,omitempty"` }
Event describes an SSE event.
type EventType ¶
type EventType int
EventType defines the type of the SSE event.
const ( EventTypeConfig EventType = iota // EventTypeConfig mean "config" SSE event. EventTypeParam // EventTypeParam mean "param" SSE event. EventTypeMetric // EventTypeMetric mean "metric" SSE event. EventTypeSnapshot // EventTypeSnapshot mean "snapshot" SSE event. EventTypeCumulative // EventTypeCumulative mean "cumulative" SSE event. EventTypeStart // EventTypeStart mean "start" SSE event. EventTypeStop // EventTypeStop mean "stop" SSE event. EventTypeThreshold // EventTypeThreshold mean "threshold" SSE event. EventTypeConnect // EventTypeConnect mean SSE channel connected. EventTypeDisconnect // EventTypeDisconnect mean SSE channel disconnected. )
func EventTypeString ¶
EventTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func EventTypeValues ¶
func EventTypeValues() []EventType
EventTypeValues returns all values of the enum
func (EventType) IsAEventType ¶
IsAEventType returns "true" if the value is listed in the enum definition. "false" otherwise
func (EventType) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface for EventType
func (EventType) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface for EventType
func (*EventType) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface for EventType
func (*EventType) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface for EventType
type Level ¶
type Level int
Level defines log and alert levels.
func LevelString ¶
LevelString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func (Level) IsALevel ¶
IsALevel returns "true" if the value is listed in the enum definition. "false" otherwise
func (Level) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface for Level
func (*Level) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface for Level
type Metric ¶
type Metric struct { Name string `json:"name,omitempty"` Type MetricType `json:"type,omitempty"` Contains ValueType `json:"contains,omitempty"` Tainted bool `json:"tainted,omitempty"` }
Metric holds metric metadata.
type MetricType ¶
type MetricType int
A MetricType specifies the type of a metric.
const ( MetricTypeCounter MetricType = iota // A counter that sums its data points MetricTypeGauge // A gauge that displays the latest value MetricTypeTrend // A trend, min/max/avg/med are interesting MetricTypeRate // A rate, displays % of values that aren't 0 )
Possible values for MetricType.
func MetricTypeString ¶
func MetricTypeString(s string) (MetricType, error)
MetricTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func MetricTypeValues ¶
func MetricTypeValues() []MetricType
MetricTypeValues returns all values of the enum
func (MetricType) Aggregates ¶
func (md MetricType) Aggregates() []string
Aggregates returns aggregate names for a given metric type.
func (MetricType) IsAMetricType ¶
func (i MetricType) IsAMetricType() bool
IsAMetricType returns "true" if the value is listed in the enum definition. "false" otherwise
func (MetricType) MarshalJSON ¶
func (i MetricType) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface for MetricType
func (MetricType) MarshalText ¶
func (i MetricType) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface for MetricType
func (MetricType) String ¶
func (i MetricType) String() string
func (*MetricType) UnmarshalJSON ¶
func (i *MetricType) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface for MetricType
func (*MetricType) UnmarshalText ¶
func (i *MetricType) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface for MetricType
type ParamData ¶
type ParamData struct { Thresholds map[string][]string `json:"thresholds,omitempty"` Scenarios []string `json:"scenarios,omitempty"` EndOffset int64 `json:"endOffset,omitempty"` Period int64 `json:"period,omitempty"` Tags []string `json:"tags,omitempty"` }
ParamData holds "param" event data.
type State ¶
type State int
State defines the SSE stream/connection states.
const ( StateWaiting State = iota // StateWaiting means waiting for data. StateConnected // StateConnected means SSE stream connected. StatePreparing // StatePreparing means parems event received but test not stasrted yet. StateStarting // StateStarting means test started but no data available yet. StateDetached // StateDetached means SSE stream disconnected. StateRunning // StateRunning means test is running. StateFinished // StateFinished means test execution is finished. )
func StateString ¶
StateString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func (State) IsAState ¶
IsAState returns "true" if the value is listed in the enum definition. "false" otherwise
func (State) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface for State
func (State) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface for State
func (*State) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface for State
func (*State) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface for State
type Thresholds ¶
type Thresholds struct { Result Level Details map[string]map[string]Level Brief map[string]Level Source map[string][]string Failures []*Failure }
Thresholds holds all the result of the thresholds checks.
type ValueType ¶
type ValueType int
ValueType holds the type of values a metric contains.
const ( ValueTypeDefault ValueType = iota // Values are presented as-is ValueTypeTime // Values are time durations (milliseconds) ValueTypeData // Values are data amounts (bytes) )
Possible values for ValueType.
func ValueTypeString ¶
ValueTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func ValueTypeValues ¶
func ValueTypeValues() []ValueType
ValueTypeValues returns all values of the enum
func (ValueType) IsAValueType ¶
IsAValueType returns "true" if the value is listed in the enum definition. "false" otherwise
func (ValueType) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface for ValueType
func (ValueType) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface for ValueType
func (*ValueType) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface for ValueType
func (*ValueType) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface for ValueType