ng_metric

package
v1.0.5-0...-0e34edc Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2016 License: GPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMetricString

func GetMetricString(metric Metric) string

Types

type CollectdMetric

type CollectdMetric struct {
	api.Identifier
	DSName   string
	DataType MetricDataType
	Interval time.Duration
}

func (CollectdMetric) GetAppName

func (metric CollectdMetric) GetAppName() string

func (CollectdMetric) GetCriterias

func (metric CollectdMetric) GetCriterias() map[string]string

func (CollectdMetric) GetDuration

func (metric CollectdMetric) GetDuration() time.Duration

func (CollectdMetric) GetHost

func (metric CollectdMetric) GetHost() string

func (CollectdMetric) GetMeasurementName

func (metric CollectdMetric) GetMeasurementName() string

func (CollectdMetric) GetType

func (metric CollectdMetric) GetType() MetricDataType

type CollectdMetricSource

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

func NewCollectdMetricSource

func NewCollectdMetricSource(listen_host string, listen_port uint16, filter_enable bool, filter_types []string) *CollectdMetricSource

func (*CollectdMetricSource) AddStorage

func (self *CollectdMetricSource) AddStorage(store MetricStorage) bool

func (*CollectdMetricSource) Collect

func (self *CollectdMetricSource) Collect() error

func (*CollectdMetricSource) FlushToStorage

func (self *CollectdMetricSource) FlushToStorage() bool

type CollectdMetricWriter

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

func (CollectdMetricWriter) Write

type MemoryMetricRing

type MemoryMetricRing struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

type MemoryMetricStorage

type MemoryMetricStorage struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewMemoryStorage

func NewMemoryStorage(capacity int) *MemoryMetricStorage

func (*MemoryMetricStorage) AddMetricValue

func (self *MemoryMetricStorage) AddMetricValue(m Metric, val MetricValue) error

func (*MemoryMetricStorage) CountMetrics

func (self *MemoryMetricStorage) CountMetrics() int32

func (*MemoryMetricStorage) CountValues

func (self *MemoryMetricStorage) CountValues(m Metric) (int64, error)

func (*MemoryMetricStorage) DeleteMetricValue

func (self *MemoryMetricStorage) DeleteMetricValue(val MetricValue) bool

func (*MemoryMetricStorage) Flush

func (self *MemoryMetricStorage) Flush() bool

func (*MemoryMetricStorage) GetAllMetrics

func (self *MemoryMetricStorage) GetAllMetrics() ([]Metric, error)

func (*MemoryMetricStorage) GetFullName

func (self *MemoryMetricStorage) GetFullName() string

func (*MemoryMetricStorage) GetLastMetricValue

func (self *MemoryMetricStorage) GetLastMetricValue(m Metric) (MetricValue, error)

func (*MemoryMetricStorage) GetLastMetricValues

func (self *MemoryMetricStorage) GetLastMetricValues(m Metric, n_skip int, n_get int) ([]MetricValue, error)

func (*MemoryMetricStorage) GetMetricByName

func (self *MemoryMetricStorage) GetMetricByName(name string) (Metric, error)

func (*MemoryMetricStorage) GetMetricValueByTimeRange

func (self *MemoryMetricStorage) GetMetricValueByTimeRange(m Metric, since time.Time, duration time.Duration) ([]MetricValue, error)

func (*MemoryMetricStorage) GetMetricsByHost

func (self *MemoryMetricStorage) GetMetricsByHost(host_name string) ([]Metric, error)

func (*MemoryMetricStorage) GetName

func (self *MemoryMetricStorage) GetName() string

func (*MemoryMetricStorage) IsLimited

func (self *MemoryMetricStorage) IsLimited() bool

func (*MemoryMetricStorage) IsMemory

func (self *MemoryMetricStorage) IsMemory() bool

type Metric

type Metric interface {
	//Returns metric application name
	GetAppName() string
	//Returns host metric belnogs to
	GetHost() string
	//Returns map of string measurement criterias parameters
	GetCriterias() map[string]string
	//Returns measurement series name
	//In most cases it measurement series name which describes source of information
	GetMeasurementName() string
	//Returns metric data type
	GetType() MetricDataType
	//Get metric duraiton
	GetDuration() time.Duration
}

Metric data interface

func ParseCollectdMetric

func ParseCollectdMetric(str string, dsname string) (Metric, error)

type MetricDataType

type MetricDataType int16
const (
	METRIC_GAUGE    MetricDataType = 0
	METRIC_DERIVE   MetricDataType = 1
	METRIC_COUNTER  MetricDataType = 2
	METRIC_ABSOLUTE MetricDataType = 3
)

type MetricSource

type MetricSource interface {
	AddStorage(store MetricStorage) bool
	FlushToStorage() bool
	Collect() error
}

type MetricStorage

type MetricStorage interface {
	AddMetricValue(m Metric, val MetricValue) error
	DeleteMetricValue(val MetricValue) bool
	GetLastMetricValue(m Metric) (MetricValue, error)
	GetLastMetricValues(m Metric, n_skip int, n_get int) ([]MetricValue, error)
	GetMetricValueByTimeRange(m Metric, since time.Time, duration time.Duration) ([]MetricValue, error)
	GetAllMetrics() ([]Metric, error)
	GetMetricByName(name string) (Metric, error)
	GetMetricsByHost(host_name string) ([]Metric, error)

	CountValues(m Metric) (int64, error)
	CountMetrics() int32
	GetName() string
	GetFullName() string
	IsMemory() bool
	IsLimited() bool
	Flush() bool
}

type MetricValue

type MetricValue struct {
	Name      string
	Time      time.Time
	Kind      MetricDataType
	ValueType reflect.Type
	Value     interface{}
}

func DeriveMetricValues

func DeriveMetricValues(values []MetricValue, non_negative bool) ([]MetricValue, error)

Jump to

Keyboard shortcuts

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