cloudwatch

package
v0.55.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const TimeFormat = "2006-01-02T15:04:05.999999-07:00"

Variables

This section is empty.

Functions

func DetermineGetMetricDataWindow

func DetermineGetMetricDataWindow(clock Clock, roundingPeriod time.Duration, length time.Duration, delay time.Duration) (time.Time, time.Time)

determineGetMetricDataWindow computes the start and end time for the GetMetricData request to AWS Always uses the wall clock time as starting point for calculations to ensure that a variety of exporter configurations will work reliably.

Types

type Client

type Client interface {
	// ListMetrics returns the list of metrics and dimensions for a given namespace
	// and metric name. Results pagination is handled automatically: the caller can
	// optionally pass a non-nil func in order to handle results pages.
	ListMetrics(ctx context.Context, namespace string, metric *config.Metric, recentlyActiveOnly bool, fn func(page []*model.Metric)) ([]*model.Metric, error)

	// GetMetricData returns the output of the GetMetricData CloudWatch API.
	// Results pagination is handled automatically.
	GetMetricData(ctx context.Context, logger logging.Logger, getMetricData []*model.CloudwatchData, namespace string, length int64, delay int64, configuredRoundingPeriod *int64) []MetricDataResult

	// GetMetricStatistics returns the output of the GetMetricStatistics CloudWatch API.
	GetMetricStatistics(ctx context.Context, logger logging.Logger, dimensions []*model.Dimension, namespace string, metric *config.Metric) []*model.Datapoint
}

func NewLimitedConcurrencyClient

func NewLimitedConcurrencyClient(client Client, maxConcurrency int) Client

type Clock

type Clock interface {
	Now() time.Time
}

Clock small interface which allows for stubbing the time.Now() function for unit testing

type MetricDataResult

type MetricDataResult struct {
	ID        string
	Datapoint float64
	Timestamp time.Time
}

type TimeClock

type TimeClock struct{}

TimeClock implementation of Clock interface which delegates to Go's Time package

func (TimeClock) Now

func (tc TimeClock) Now() time.Time

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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