metrics

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

type Collector struct {
	// contains filtered or unexported fields
}

Collector is an utility to collect metrics from a PrometheusServer

func NewCollector

func NewCollector(cfg *config.MeasurementConfiguration, evtCfg *govel.EventConfiguration, namingCodes map[string]string) (*Collector, error)

NewCollector creates a new Prometheus Metrics collector from provided configuration

func NewCollectorWithState

func NewCollectorWithState(cfg *config.MeasurementConfiguration, evtCfg *govel.EventConfiguration, namingCodes map[string]string, state CollectorState) (*Collector, error)

NewCollectorWithState creates a new Prometheus Metrics collector from provided configuration

func (*Collector) CollectMetrics

func (col *Collector) CollectMetrics(from, to time.Time, interval time.Duration) (EventMeasurementSet, error)

CollectMetrics perform the metric collection, providing it timing information on which range to query

func (*Collector) Run

func (col *Collector) Run(from, to time.Time, interval time.Duration) (interface{}, error)

Run the metric collection, providing it timing information oin which range to query

type CollectorState

type CollectorState interface {
	// NextMeasurementIndex return the next event index and increments it
	NextMeasurementIndex() (int64, error)
}

CollectorState handles the collector internal state

type EventMeasurementSet

type EventMeasurementSet []*govel.EventMeasurements

EventMeasurementSet is a list of VES Measurements events

func (EventMeasurementSet) Batch

func (set EventMeasurementSet) Batch() govel.Batch

Batch converts the measurement set into a batch of events

type EventMeasurementSetBuilder

type EventMeasurementSetBuilder struct {
	// contains filtered or unexported fields
}

EventMeasurementSetBuilder is an utility to construct a set of measurement events

func NewEventMeasurementSetBuilder

func NewEventMeasurementSetBuilder(fact MeasurementFactory) EventMeasurementSetBuilder

NewEventMeasurementSetBuilder creates a new EventMeasurementSetBuilder using the provided measurement factory. If an error occurs during value insertion, the full set will be invalidated, and trying to use the EventMeasurementSetBuilder after that will cause a panic

func (*EventMeasurementSetBuilder) Measurements

func (bld *EventMeasurementSetBuilder) Measurements() EventMeasurementSet

Measurements returns the built EventMeasurementSet

func (*EventMeasurementSetBuilder) Set

func (bld *EventMeasurementSetBuilder) Set(fields string, vmID string, timestamp time.Time, value float64, keys MeasKeys) error

Set sets the metric given by "fields" for VM with ID "vmID" at time "timestamp" with value "values". "keys" are used when and array is encountered to select the entry (or set the entry when missing)

Returns an error or nil. If an error occurs, the EventMeasurementSetBuilder must not be used anymore Panics if an error occurred in the previous call

func (*EventMeasurementSetBuilder) SetAdditionalObject

func (bld *EventMeasurementSetBuilder) SetAdditionalObject(vmID, objectName, objectInstance string, timestamp time.Time, value float64, keys MeasKeys) error

SetAdditionalObject insert a metric value in a AdditionalObjects field of a Measurement event

type MeasKeys

type MeasKeys map[string]string

MeasKeys is a map of keys / values fore metrics structure used in filtering. Some kind of composite key

func (MeasKeys) JSONObjectKeys

func (keys MeasKeys) JSONObjectKeys() []govel.Key

JSONObjectKeys transform this set of key/values pairs into a list of `govel.Key`

func (MeasKeys) MatchJSONObjectKeys

func (keys MeasKeys) MatchJSONObjectKeys(jKeys []govel.Key) bool

MatchJSONObjectKeys checks if this set of key/value pairs match exactly with the given list of `govel.Key`

func (MeasKeys) String

func (keys MeasKeys) String() string

type MeasurementFactory

type MeasurementFactory interface {
	Create(vmID string, timestamp time.Time) (*govel.EventMeasurements, error)
}

MeasurementFactory is used to create new measurement events

type MeasurementFactoryFunc

type MeasurementFactoryFunc func(vmID string, timestamp time.Time) (*govel.EventMeasurements, error)

MeasurementFactoryFunc is a function which can be used as a MeasurementFactory

func (MeasurementFactoryFunc) Create

func (f MeasurementFactoryFunc) Create(vmID string, timestamp time.Time) (*govel.EventMeasurements, error)

Create is called to create a new `govel.EventMeasurements`

Jump to

Keyboard shortcuts

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