types

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateMetaTags

func GenerateMetaTags(m MetricMeta, d ObjectMeta) []metrics.MetricTag

GenerateMetaTags returns tag based on the given meta-info

func IsAggregatorMetric

func IsAggregatorMetric(metricName string) bool

IsAggregatorMetric return whether this metric is aggregator metric

func ParseAggregator

func ParseAggregator(metricName string) (string, string)

ParseAggregator parses the given metricName into aggregator-suffix and origin-metric, and the returned value represents `metric, aggregator`

Types

type AggregatedIdentity

type AggregatedIdentity struct {
	Count         int64 `json:"count,omitempty"`
	Timestamp     int64 `json:"timestamp,omitempty"`
	WindowSeconds int64 `json:"windowSeconds,omitempty"`
}

type AggregatedItem

type AggregatedItem struct {
	AggregatedIdentity `json:",inline"`

	Value float64 `json:"value,omitempty"`
}

func (*AggregatedItem) DeepCopy

func (a *AggregatedItem) DeepCopy() Item

func (*AggregatedItem) GetCount

func (a *AggregatedItem) GetCount() *int64

func (*AggregatedItem) GetQuantity

func (a *AggregatedItem) GetQuantity() resource.Quantity

func (*AggregatedItem) GetTimestamp

func (a *AggregatedItem) GetTimestamp() int64

func (*AggregatedItem) GetWindowSeconds

func (a *AggregatedItem) GetWindowSeconds() *int64

type AggregatedMetric

type AggregatedMetric struct {
	MetricMetaImp `json:",inline"`
	ObjectMetaImp `json:",inline"`
	BasicMetric   `json:",inline"`

	AggregatedIdentity `json:",inline"`
	Value              float64 `json:"values,omitempty"`
}

func NewAggregatedInternalMetric

func NewAggregatedInternalMetric(value float64, identity AggregatedIdentity) *AggregatedMetric

func (*AggregatedMetric) DeepCopy

func (as *AggregatedMetric) DeepCopy() Metric

func (*AggregatedMetric) GetBaseMetricMetaImp

func (as *AggregatedMetric) GetBaseMetricMetaImp() MetricMetaImp

func (*AggregatedMetric) GetItemList

func (as *AggregatedMetric) GetItemList() []Item

func (*AggregatedMetric) Len

func (as *AggregatedMetric) Len() int

func (*AggregatedMetric) String

func (as *AggregatedMetric) String() string

type BasicMetric

type BasicMetric struct {
	Labels map[string]string `json:"labels,omitempty"`
}

func (*BasicMetric) DeepCopy

func (m *BasicMetric) DeepCopy() BasicMetric

func (*BasicMetric) GetLabels

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

func (*BasicMetric) String

func (m *BasicMetric) String() string

type Item

type Item interface {
	DeepCopy() Item
	// GetQuantity returns the value for this metric
	GetQuantity() resource.Quantity
	// GetTimestamp returns the timestamp that this metric was generated
	GetTimestamp() int64
	// GetCount returns the total amount of raw metrics that generates this
	GetCount() *int64
	// GetWindowSeconds returns the time-window that this the raw metrics represent for
	GetWindowSeconds() *int64
}

Item represents the standard format of metric-item in local cache

type Metric

type Metric interface {
	MetricMeta
	ObjectMeta

	DeepCopy() Metric

	// String returns a standard format for this metricItem
	// GetLabels/SetLabels maintains the labels in Metric
	String() string
	GetLabels() map[string]string

	// Len returns length for Item
	// GetItemList returns a list for Item
	Len() int
	GetItemList() []Item
}

func DecodeMetricList

func DecodeMetricList(body io.ReadCloser, metricName string) (res []Metric, err error)

func UnmarshalMetricList

func UnmarshalMetricList(bytes []byte) (res []Metric, err error)

type MetricMeta

type MetricMeta interface {
	GetName() string
	GetNamespaced() bool
	GetObjectKind() string
}

func DecodeMetricMetaList

func DecodeMetricMetaList(body io.ReadCloser) (res []MetricMeta, err error)

func PackMetricMetaList

func PackMetricMetaList(metricMetaLists ...[]MetricMeta) []MetricMeta

PackMetricMetaList merges MetricMetaImp lists and removes duplicates

type MetricMetaImp

type MetricMetaImp struct {
	Name       string `json:"name,omitempty"`
	Namespaced bool   `json:"namespaced,omitempty"`
	ObjectKind string `json:"objectKind,omitempty"`
}

func AggregatorMetricMetaImp

func AggregatorMetricMetaImp(origin MetricMetaImp, aggName string) MetricMetaImp

func (MetricMetaImp) DeepCopy

func (m MetricMetaImp) DeepCopy() MetricMetaImp

func (MetricMetaImp) GetName

func (m MetricMetaImp) GetName() string

func (MetricMetaImp) GetNamespaced

func (m MetricMetaImp) GetNamespaced() bool

func (MetricMetaImp) GetObjectKind

func (m MetricMetaImp) GetObjectKind() string

type ObjectMeta

type ObjectMeta interface {
	GetObjectName() string
	GetObjectNamespace() string
}

type ObjectMetaImp

type ObjectMetaImp struct {
	ObjectNamespace string `json:"objectNamespace,omitempty"`
	ObjectName      string `json:"objectName,omitempty"`
}

func (ObjectMetaImp) DeepCopy

func (m ObjectMetaImp) DeepCopy() ObjectMetaImp

func (ObjectMetaImp) GetObjectName

func (m ObjectMetaImp) GetObjectName() string

func (ObjectMetaImp) GetObjectNamespace

func (m ObjectMetaImp) GetObjectNamespace() string

type SeriesItem

type SeriesItem struct {
	Value     float64 `json:"value,omitempty"`
	Timestamp int64   `json:"timestamp,omitempty"`
}

func NewInternalItem

func NewInternalItem(value float64, timestamp int64) *SeriesItem

func (*SeriesItem) DeepCopy

func (i *SeriesItem) DeepCopy() Item

func (*SeriesItem) GetCount

func (i *SeriesItem) GetCount() *int64

func (*SeriesItem) GetQuantity

func (i *SeriesItem) GetQuantity() resource.Quantity

func (*SeriesItem) GetTimestamp

func (i *SeriesItem) GetTimestamp() int64

func (*SeriesItem) GetWindowSeconds

func (i *SeriesItem) GetWindowSeconds() *int64

type SeriesMetric

type SeriesMetric struct {
	MetricMetaImp `json:",inline"`
	ObjectMetaImp `json:",inline"`
	BasicMetric   `json:",inline"`

	Values []*SeriesItem `json:"values,omitempty"`
}

func NewSeriesMetric

func NewSeriesMetric() *SeriesMetric

func (*SeriesMetric) AddMetric

func (is *SeriesMetric) AddMetric(item *SeriesItem)

func (*SeriesMetric) DeepCopy

func (is *SeriesMetric) DeepCopy() Metric

func (*SeriesMetric) GetItemList

func (is *SeriesMetric) GetItemList() []Item

func (*SeriesMetric) Len

func (is *SeriesMetric) Len() int

func (*SeriesMetric) String

func (is *SeriesMetric) String() string

Jump to

Keyboard shortcuts

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