matrix

package
v2.0.0-...-ee50c0a Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrInvalidDtype         = matrixError("invalid data type")
	ErrInvalidMetricKey     = matrixError("invalid metric key")
	ErrInvalidInstanceKey   = matrixError("invalid instance key")
	ErrDuplicateMetricKey   = matrixError("duplicate metric key")
	ErrDuplicateInstanceKey = matrixError("duplicate instance key")
	ErrUnequalVectors       = matrixError("unequal vectors")
)

Variables

This section is empty.

Functions

func CreateMetric

func CreateMetric(key string, data *Matrix) error

func DefaultExportOptions

func DefaultExportOptions() *node.Node

Types

type Instance

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

func NewInstance

func NewInstance(index int) *Instance

func (*Instance) ClearLabels

func (i *Instance) ClearLabels()

func (*Instance) Clone

func (i *Instance) Clone(isExportable bool, labels ...string) *Instance

func (*Instance) CompareDiffs

func (i *Instance) CompareDiffs(prev *Instance, compareKeys []string) (map[string]string, map[string]string)

CompareDiffs iterates through each key in compareKeys, checking if the receiver and prev have the same value for that key. When the values are different, return a new Map with the current and previous value

func (*Instance) Copy

func (i *Instance) Copy(labels ...string) map[string]string

func (*Instance) GetIndex

func (i *Instance) GetIndex() int

func (*Instance) GetLabel

func (i *Instance) GetLabel(key string) string

func (*Instance) GetLabels

func (i *Instance) GetLabels() map[string]string

func (*Instance) IsExportable

func (i *Instance) IsExportable() bool

func (*Instance) IsPartial

func (i *Instance) IsPartial() bool

func (*Instance) SetExportable

func (i *Instance) SetExportable(b bool)

func (*Instance) SetLabel

func (i *Instance) SetLabel(key, value string)

func (*Instance) SetLabels

func (i *Instance) SetLabels(labels map[string]string)

func (*Instance) SetPartial

func (i *Instance) SetPartial(b bool)

type Matrix

type Matrix struct {
	UUID       string
	Object     string
	Identifier string
	// contains filtered or unexported fields
}

func New

func New(uuid, object string, identifier string) *Matrix

func (*Matrix) Clone

func (m *Matrix) Clone(with With) *Matrix

func (*Matrix) Delta

func (m *Matrix) Delta(metricKey string, prevMat *Matrix, logger *logging.Logger) (int, error)

Delta vector arithmetics

func (*Matrix) DisplayMetric

func (m *Matrix) DisplayMetric(name string) *Metric

func (*Matrix) Divide

func (m *Matrix) Divide(metricKey string, baseKey string) (int, error)

func (*Matrix) DivideWithThreshold

func (m *Matrix) DivideWithThreshold(metricKey string, baseKey string, threshold int, curRawMat *Matrix, prevRawMat *Matrix, logger *logging.Logger) (int, error)

DivideWithThreshold applicable for latency counters

func (*Matrix) GetExportOptions

func (m *Matrix) GetExportOptions() *node.Node

func (*Matrix) GetGlobalLabels

func (m *Matrix) GetGlobalLabels() map[string]string

func (*Matrix) GetInstance

func (m *Matrix) GetInstance(key string) *Instance

func (*Matrix) GetInstanceKeys

func (m *Matrix) GetInstanceKeys() []string

func (*Matrix) GetInstances

func (m *Matrix) GetInstances() map[string]*Instance

func (*Matrix) GetInstancesBySuffix

func (m *Matrix) GetInstancesBySuffix(subKey string) []*Instance

func (*Matrix) GetMetric

func (m *Matrix) GetMetric(key string) *Metric

func (*Matrix) GetMetrics

func (m *Matrix) GetMetrics() map[string]*Metric

func (*Matrix) InstanceWiseAdditionUint64

func (m *Matrix) InstanceWiseAdditionUint64(toInstance, fromInstance *Instance, fromData *Matrix)

func (*Matrix) IsExportable

func (m *Matrix) IsExportable() bool

IsExportable indicates whether this matrix is meant to be exported or not (some data is only collected to be aggregated by plugins)

func (*Matrix) LazyAddValueInt64

func (m *Matrix) LazyAddValueInt64(key, i string, v int64) error

func (*Matrix) LazyAddValueUint64

func (m *Matrix) LazyAddValueUint64(key, i string, v uint64) error

func (*Matrix) LazyGetValueFloat64

func (m *Matrix) LazyGetValueFloat64(key, i string) (float64, bool)

func (*Matrix) LazyGetValueInt64

func (m *Matrix) LazyGetValueInt64(key, i string) (int64, bool)

func (*Matrix) LazySetValueFloat64

func (m *Matrix) LazySetValueFloat64(mkey, ikey string, v float64) error

func (*Matrix) LazySetValueInt64

func (m *Matrix) LazySetValueInt64(mkey, ikey string, v int64) error

func (*Matrix) LazySetValueUint64

func (m *Matrix) LazySetValueUint64(mkey, ikey string, v uint64) error

func (*Matrix) LazySetValueUint8

func (m *Matrix) LazySetValueUint8(mkey, ikey string, v uint8) error

func (*Matrix) LazyValueFloat64

func (m *Matrix) LazyValueFloat64(key, i string) float64

func (*Matrix) LazyValueInt64

func (m *Matrix) LazyValueInt64(key, i string) int64

func (*Matrix) MultiplyByScalar

func (m *Matrix) MultiplyByScalar(metricKey string, s uint) (int, error)

func (*Matrix) NewInstance

func (m *Matrix) NewInstance(key string) (*Instance, error)

func (*Matrix) NewMetricFloat64

func (m *Matrix) NewMetricFloat64(key string, display ...string) (*Metric, error)

func (*Matrix) NewMetricInt64

func (m *Matrix) NewMetricInt64(key string, display ...string) (*Metric, error)

func (*Matrix) NewMetricType

func (m *Matrix) NewMetricType(key string, dataType string, display ...string) (*Metric, error)

func (*Matrix) NewMetricUint64

func (m *Matrix) NewMetricUint64(key string, display ...string) (*Metric, error)

func (*Matrix) NewMetricUint8

func (m *Matrix) NewMetricUint8(key string, display ...string) (*Metric, error)

func (*Matrix) Print

func (m *Matrix) Print()

Print is only for debugging

func (*Matrix) PurgeInstances

func (m *Matrix) PurgeInstances()

func (*Matrix) PurgeMetrics

func (m *Matrix) PurgeMetrics()

func (*Matrix) RemoveExceptMetric

func (m *Matrix) RemoveExceptMetric(key string)

func (*Matrix) RemoveInstance

func (m *Matrix) RemoveInstance(key string)

func (*Matrix) RemoveMetric

func (m *Matrix) RemoveMetric(key string)

func (*Matrix) Reset

func (m *Matrix) Reset()

Reset all data

func (*Matrix) ResetInstance

func (m *Matrix) ResetInstance(key string)

func (*Matrix) SetExportOptions

func (m *Matrix) SetExportOptions(e *node.Node)

func (*Matrix) SetExportable

func (m *Matrix) SetExportable(b bool)

func (*Matrix) SetGlobalLabel

func (m *Matrix) SetGlobalLabel(label, value string)

func (*Matrix) SetGlobalLabels

func (m *Matrix) SetGlobalLabels(allLabels map[string]string)

SetGlobalLabels copies allLabels to globalLabels when the label does not exist in globalLabels

type Metric

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

func (*Metric) AddValueFloat64

func (m *Metric) AddValueFloat64(i *Instance, n float64) error

func (*Metric) AddValueInt64

func (m *Metric) AddValueInt64(i *Instance, n int64) error

func (*Metric) AddValueString

func (m *Metric) AddValueString(i *Instance, v string) error

func (*Metric) AddValueUint64

func (m *Metric) AddValueUint64(i *Instance, n uint64) error

func (*Metric) AddValueUint8

func (m *Metric) AddValueUint8(i *Instance, n uint8) error

func (*Metric) Append

func (m *Metric) Append()

func (*Metric) Buckets

func (m *Metric) Buckets() *[]string

func (*Metric) Clone

func (m *Metric) Clone(deep bool) *Metric

func (*Metric) GetComment

func (m *Metric) GetComment() string

func (*Metric) GetLabel

func (m *Metric) GetLabel(key string) string

func (*Metric) GetLabels

func (m *Metric) GetLabels() map[string]string

func (*Metric) GetName

func (m *Metric) GetName() string

func (*Metric) GetProperty

func (m *Metric) GetProperty() string

func (*Metric) GetRecords

func (m *Metric) GetRecords() []bool

func (*Metric) GetType

func (m *Metric) GetType() string

func (*Metric) GetValueBytes

func (m *Metric) GetValueBytes(i *Instance) ([]byte, bool)

func (*Metric) GetValueFloat64

func (m *Metric) GetValueFloat64(i *Instance) (float64, bool)

func (*Metric) GetValueInt

func (m *Metric) GetValueInt(i *Instance) (int, bool)

func (*Metric) GetValueInt64

func (m *Metric) GetValueInt64(i *Instance) (int64, bool)

func (*Metric) GetValueString

func (m *Metric) GetValueString(i *Instance) (string, bool)

func (*Metric) GetValueUint64

func (m *Metric) GetValueUint64(i *Instance) (uint64, bool)

func (*Metric) GetValueUint8

func (m *Metric) GetValueUint8(i *Instance) (uint8, bool)

func (*Metric) HasLabels

func (m *Metric) HasLabels() bool

func (*Metric) IsArray

func (m *Metric) IsArray() bool

func (*Metric) IsExportable

func (m *Metric) IsExportable() bool

func (*Metric) IsHistogram

func (m *Metric) IsHistogram() bool

func (*Metric) Print

func (m *Metric) Print()

func (*Metric) Remove

func (m *Metric) Remove(index int)

Remove element at index, shift everything to the left

func (*Metric) Reset

func (m *Metric) Reset(size int)

func (*Metric) SetArray

func (m *Metric) SetArray(c bool)

func (*Metric) SetBuckets

func (m *Metric) SetBuckets(buckets *[]string)

func (*Metric) SetComment

func (m *Metric) SetComment(c string)

func (*Metric) SetExportable

func (m *Metric) SetExportable(b bool)

func (*Metric) SetHistogram

func (m *Metric) SetHistogram(b bool)

func (*Metric) SetLabel

func (m *Metric) SetLabel(key, value string)

func (*Metric) SetLabels

func (m *Metric) SetLabels(labels map[string]string)

func (*Metric) SetProperty

func (m *Metric) SetProperty(p string)

func (*Metric) SetValueBytes

func (m *Metric) SetValueBytes(i *Instance, v []byte) error

func (*Metric) SetValueFloat64

func (m *Metric) SetValueFloat64(i *Instance, v float64) error

func (*Metric) SetValueInt64

func (m *Metric) SetValueInt64(i *Instance, v int64) error

func (*Metric) SetValueNAN

func (m *Metric) SetValueNAN(i *Instance)

func (*Metric) SetValueString

func (m *Metric) SetValueString(i *Instance, v string) error

func (*Metric) SetValueUint64

func (m *Metric) SetValueUint64(i *Instance, v uint64) error

func (*Metric) SetValueUint8

func (m *Metric) SetValueUint8(i *Instance, v uint8) error

type With

type With struct {
	Data             bool
	Metrics          bool
	Instances        bool
	ExportInstances  bool
	PartialInstances bool
	Labels           []string
}

Jump to

Keyboard shortcuts

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