getmetricdata

package
v0.60.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	GetMetricData(ctx context.Context, getMetricData []*model.CloudwatchData, namespace string, startTime time.Time, endTime time.Time) []cloudwatch.MetricDataResult
}

type Clock added in v0.59.0

type Clock interface {
	Now() time.Time
}

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

type Iterator added in v0.60.0

type Iterator interface {
	// Next returns the next batch of CloudWatch data be used when calling GetMetricData and the start + end time for
	// the GetMetricData call
	// If called when there are no more batches default values will be returned
	Next() ([]*model.CloudwatchData, *model.GetMetricDataProcessingParams)

	// HasMore returns true if there are more batches to iterate otherwise false. Should be used in a loop
	// to govern calls to Next()
	HasMore() bool
}

func NewSimpleBatchIterator added in v0.60.0

func NewSimpleBatchIterator(metricsPerQuery int, data []*model.CloudwatchData, jobMetricLength, jobMetricDelay int64, jobRoundingPeriod *int64) Iterator

NewSimpleBatchIterator returns an iterator which slices the data in place based on the metricsPerQuery.

type IteratorFactory added in v0.60.0

type IteratorFactory interface {
	// Build returns an ideal batch iterator based on the provided CloudwatchData
	Build(requests []*model.CloudwatchData, jobMetricLength, jobMetricDelay int64, jobRoundingPeriod *int64) Iterator
}

type MetricWindowCalculator added in v0.59.0

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

func (MetricWindowCalculator) Calculate added in v0.59.0

func (m MetricWindowCalculator) Calculate(period time.Duration, length time.Duration, delay time.Duration) (time.Time, time.Time)

Calculate 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.

type Processor

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

func NewDefaultProcessor added in v0.59.0

func NewDefaultProcessor(logger logging.Logger, client Client, metricsPerQuery int, concurrency int) Processor

func NewProcessor

func NewProcessor(logger logging.Logger, client Client, concurrency int, windowCalculator MetricWindowCalculator, factory IteratorFactory) Processor

func (Processor) Run

func (p Processor) Run(ctx context.Context, namespace string, jobMetricLength, jobMetricDelay int64, jobRoundingPeriod *int64, requests []*model.CloudwatchData) ([]*model.CloudwatchData, error)

type TimeClock added in v0.59.0

type TimeClock struct{}

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

func (TimeClock) Now added in v0.59.0

func (tc TimeClock) Now() time.Time

Jump to

Keyboard shortcuts

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