incoming

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseByte

func ParseByte(dataItem MetricDataFormat, data []byte) error

ParseByte parse incoming data

Types

type CeilometerMetric

type CeilometerMetric struct {
	WithDataSource
	Publisher string                 `json:"publisher_id"`
	Payload   map[string]interface{} `json:"payload"`
	// analogy to collectd metric
	Plugin         string
	PluginInstance string
	Type           string
	TypeInstance   string
	Values         []float64
	// contains filtered or unexported fields
}

CeilometerMetric struct represents metric data formated and sent by Ceilometer

func (*CeilometerMetric) GetInterval

func (c *CeilometerMetric) GetInterval() float64

GetInterval returns hardcoded defaultCeilometerInterval, because Ceilometer metricDesc does not contain interval information (are not periodically sent at all) and any reasonable interval might be needed for expiry setting for Prometheus TODO: Make this configurable

func (*CeilometerMetric) GetItemKey

func (c *CeilometerMetric) GetItemKey() string

GetItemKey returns name cache key analogically to CollectdMetric implementation

func (CeilometerMetric) GetKey

func (c CeilometerMetric) GetKey() string

GetKey ...

func (*CeilometerMetric) GetLabels

func (c *CeilometerMetric) GetLabels() map[string]string

GetLabels ...

func (*CeilometerMetric) GetMetricDesc

func (c *CeilometerMetric) GetMetricDesc(index int) string

GetMetricDesc ...

func (*CeilometerMetric) GetMetricName

func (c *CeilometerMetric) GetMetricName(index int) string

GetMetricName ...

func (*CeilometerMetric) GetName

func (c *CeilometerMetric) GetName() string

GetName returns name of Ceilometer "plugin" (analogically to CollectdMetric implementation)

func (*CeilometerMetric) GetValues

func (c *CeilometerMetric) GetValues() []float64

GetValues returns Values. The purpose of this method is to be able to get metric Values from the interface object itself

func (*CeilometerMetric) ISNew

func (c *CeilometerMetric) ISNew() bool

ISNew ...

func (*CeilometerMetric) ParseInputByte

func (c *CeilometerMetric) ParseInputByte(data []byte) error

ParseInputByte is not really used. It is here just to implement MetricDataFormat TODO: Remove this method from here and also CollectdMetric

func (*CeilometerMetric) ParseInputJSON

func (c *CeilometerMetric) ParseInputJSON(data string) ([]MetricDataFormat, error)

ParseInputJSON ...

func (*CeilometerMetric) SetData

func (c *CeilometerMetric) SetData(data MetricDataFormat)

SetData generates naming and value data analogicaly to CollectdMetric from counter data and resource_id

func (*CeilometerMetric) SetNew

func (c *CeilometerMetric) SetNew(new bool)

SetNew ...

type CollectdMetric

type CollectdMetric struct {
	WithDataSource
	Values         []float64   `json:"values"`
	Dstypes        []string    `json:"dstypes"`
	Dsnames        []string    `json:"dsnames"`
	Time           cdtime.Time `json:"time"`
	Interval       float64     `json:"interval"`
	Host           string      `json:"host"`
	Plugin         string      `json:"plugin"`
	PluginInstance string      `json:"plugin_instance"`
	Type           string      `json:"type"`
	TypeInstance   string      `json:"type_instance"`
	// contains filtered or unexported fields
}

CollectdMetric struct represents metric data formated and sent by collectd

func (*CollectdMetric) DSName

func (c *CollectdMetric) DSName(index int) string

DSName newName converts one data source of a value list to a string representation.

func (*CollectdMetric) GetInterval

func (c *CollectdMetric) GetInterval() float64

GetInterval ...

func (CollectdMetric) GetItemKey

func (c CollectdMetric) GetItemKey() string

GetItemKey ...

func (CollectdMetric) GetKey

func (c CollectdMetric) GetKey() string

GetKey ...

func (CollectdMetric) GetLabels

func (c CollectdMetric) GetLabels() map[string]string

GetLabels ...

func (CollectdMetric) GetMetricDesc

func (c CollectdMetric) GetMetricDesc(index int) string

GetMetricDesc newDesc converts one data source of a value list to a Prometheus description.

func (CollectdMetric) GetMetricName

func (c CollectdMetric) GetMetricName(index int) string

GetMetricName ...

func (CollectdMetric) GetName

func (c CollectdMetric) GetName() string

GetName implement interface

func (CollectdMetric) GetValues

func (c CollectdMetric) GetValues() []float64

GetValues returns Values. The purpose of this method is to be able to get metric Values from the interface object itself

func (*CollectdMetric) ISNew

func (c *CollectdMetric) ISNew() bool

ISNew ..

func (*CollectdMetric) ParseInputByte

func (c *CollectdMetric) ParseInputByte(data []byte) error

ParseInputByte ... TODO(mmagr): probably unify interface with ParseInputJSON

func (*CollectdMetric) ParseInputJSON

func (c *CollectdMetric) ParseInputJSON(jsonString string) ([]MetricDataFormat, error)

ParseInputJSON ...

func (*CollectdMetric) SetData

func (c *CollectdMetric) SetData(data MetricDataFormat)

SetData ...

func (*CollectdMetric) SetNew

func (c *CollectdMetric) SetNew(new bool)

SetNew ...

type MetricDataFormat

type MetricDataFormat interface {
	GetName() string
	SetData(data MetricDataFormat)
	ParseInputJSON(json string) ([]MetricDataFormat, error)
	GetKey() string
	GetItemKey() string
	ParseInputByte(data []byte) error
	GetInterval() float64
	SetNew(new bool)
	ISNew() bool
	GetValues() []float64
	GetDataSourceName() string
}

MetricDataFormat ...

func NewFromDataSource

func NewFromDataSource(source saconfig.DataSource) MetricDataFormat

NewFromDataSource creates empty DataType according to given DataSource

func NewFromDataSourceName

func NewFromDataSourceName(source string) MetricDataFormat

NewFromDataSourceName creates empty DataType according to given name of DataSource

type WithDataSource

type WithDataSource struct {
	DataSource saconfig.DataSource
}

WithDataSource is composition struct for adding DataSource parameter

func (WithDataSource) GetDataSourceName

func (ds WithDataSource) GetDataSourceName() string

GetDataSourceName returns string representation of DataSource

Jump to

Keyboard shortcuts

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