metametrics

package
v1.300001.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Listener

type Listener struct {
	Shutdown chan struct{}
	// contains filtered or unexported fields
}

Listener will listen for Metrics.

var MetricListener Listener

MetricListener is a singleton that handles metrics about the agent during API calls to the sdk metrics dataplane and controlplane.

func NewListenerAndStart

func NewListenerAndStart(writer MetricWriter, size int, interval time.Duration) Listener

NewListenerAndStart will return a new listener and instantiate all necessary fields. In addition, this will call the Listen method in a separate go routine.

func (*Listener) Close

func (l *Listener) Close()

Close will close the Shutdown channel shutting down the Listen method.

func (*Listener) Count

func (l *Listener) Count(name string, value float64, timestamp time.Time, endpoint string)

Count will construct a new Metric and send that in the metric channel.

func (*Listener) CountSuccess

func (l *Listener) CountSuccess(name string, success bool, timestamp time.Time, endpoint string)

Convenience function for success rate metrics since there's no ternary operator to do it inline

func (*Listener) Listen

func (l *Listener) Listen(interval time.Duration)

Listen will run a loop until the Shutdown channel is closed. The loop will tick at every interval and publish any metrics in the container.

The l.ch channel will wait until metrics are sent down the pipe and add to the metrics container.

type Metric

type Metric struct {
	Key   MetricKey
	Stats awscsmmetrics.StatisticSet
}

Metric represents a statistic set based distribution corresponding to agent api call performance

func (*Metric) Combine

func (m *Metric) Combine(other Metric)

Combines two metric distributions

type MetricKey

type MetricKey struct {
	Name      string
	Timestamp time.Time
	Endpoint  string
}

func NewMetricKeyForApiCall

func NewMetricKeyForApiCall(name string, timestamp time.Time, endpoint string) MetricKey

type MetricWriter

type MetricWriter interface {
	Write(Metrics) error
}

MetricWriter interface that is used to write a set of metrics

type Metrics

type Metrics map[MetricKey]Metric

Metrics is a map of metrics

Jump to

Keyboard shortcuts

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