stats

package
v0.12.3 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetStringValueFromMetadata

func GetStringValueFromMetadata(meta map[string]interface{}, key string) (string, error)

Types

type Key

type Key struct {
	NodeID       string
	ResourceType string
	Version      string
	PodID        string
	StatName     string
}

func NewKey

func NewKey(nodeID, rType, version, podID, statName string) *Key

func NewKeyFromString

func NewKeyFromString(key string) *Key

func (*Key) String

func (k *Key) String() string

type Stats

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

The format of the keys in the cache is

<node-id>:<version>:<resource-type>:<pod-id>:<stat-name>

func New

func New() *Stats

func NewWithItems

func NewWithItems(items map[string]kv.Item, now time.Time) *Stats

func (Stats) Collect added in v0.11.0

func (s Stats) Collect(ch chan<- prometheus.Metric)

Collect dumps all the keys in the stats cache. Then it creates constant metrics for each modeID/resourceType/pod on the fly based on the dumped returned data.

func (*Stats) DeleteKeysByFilter

func (s *Stats) DeleteKeysByFilter(filters ...string)

func (Stats) Describe added in v0.11.0

func (xmc Stats) Describe(ch chan<- *prometheus.Desc)

Describe is implemented with DescribeByCollect. That's possible because the Collect method will always return the same 4 metrics with the same 4 descriptors.

func (*Stats) DumpAll added in v0.11.0

func (s *Stats) DumpAll() map[string]kv.Item

func (*Stats) FilterKeys

func (s *Stats) FilterKeys(filters ...string) map[string]kv.Item

func (*Stats) GetCounter

func (s *Stats) GetCounter(nodeID, rtype, version, podID, statName string) (int64, error)

func (*Stats) GetPercentageFailing

func (s *Stats) GetPercentageFailing(nodeID, rType, version string) float64

func (*Stats) GetString

func (s *Stats) GetString(nodeID, rtype, version, podID, statName string) (string, error)

func (*Stats) GetSubscribedPods

func (s *Stats) GetSubscribedPods(nodeID, rType string) map[string]int8

func (*Stats) IncrementCounter

func (s *Stats) IncrementCounter(nodeID, rType, version, podID, statName string, increment int64)

IncrementCounter increments the counter if it already exists or creates it if it doesn't. IncrementCount removes any expiration that the cache item might had previously.

func (*Stats) ReportACK

func (s *Stats) ReportACK(nodeID, rType, version, podID string)

func (*Stats) ReportNACK

func (s *Stats) ReportNACK(nodeID, rType, podID, nonce string) (int64, error)

func (*Stats) ReportRequest

func (s *Stats) ReportRequest(nodeID, rType, podID string)

func (*Stats) RunGC added in v0.11.0

func (s *Stats) RunGC(client kubernetes.Interface, namespace string, stopCh <-chan struct{}) error

func (*Stats) SetInt64 added in v0.11.0

func (s *Stats) SetInt64(nodeID, rType, version, podID, statName string, value int64)

func (*Stats) SetString

func (s *Stats) SetString(nodeID, rType, version, podID, statName, value string)

func (*Stats) SetStringWithExpiration

func (s *Stats) SetStringWithExpiration(nodeID, rType, version, podID, statName, value string, expiration time.Duration)

func (*Stats) WriteResponseNonce

func (s *Stats) WriteResponseNonce(nodeID, rType, version, podID, nonce string)

Jump to

Keyboard shortcuts

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