cloudwatch

package
v0.61.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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 *model.MetricConfig, recentlyActiveOnly bool, fn func(page []*model.Metric)) error

	// GetMetricData returns the output of the GetMetricData CloudWatch API.
	// Results pagination is handled automatically.
	GetMetricData(ctx context.Context, getMetricData []*model.CloudwatchData, namespace string, startTime time.Time, endTime time.Time) []MetricDataResult

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

func NewLimitedConcurrencyClient

func NewLimitedConcurrencyClient(client Client, limiter ConcurrencyLimiter) Client

type ConcurrencyConfig added in v0.56.0

type ConcurrencyConfig struct {
	// PerAPIEnabled configures whether to have a limit per API call.
	PerAPILimitEnabled bool

	// SingleLimit configures the concurrency limit when using a single limiter for api calls.
	SingleLimit int

	// ListMetrics limits the number for ListMetrics API concurrent API calls.
	ListMetrics int

	// GetMetricData limits the number for GetMetricData API concurrent API calls.
	GetMetricData int

	// GetMetricStatistics limits the number for GetMetricStatistics API concurrent API calls.
	GetMetricStatistics int
}

ConcurrencyConfig configures how concurrency should be limited in a Cloudwatch API client. It allows one to pick between different limiter implementations: a single limit limiter, or one with a different limit per API call.

func (ConcurrencyConfig) NewLimiter added in v0.56.0

func (cfg ConcurrencyConfig) NewLimiter() ConcurrencyLimiter

NewLimiter creates a new ConcurrencyLimiter, according to the ConcurrencyConfig.

type ConcurrencyLimiter added in v0.56.0

type ConcurrencyLimiter interface {
	// Acquire takes one "ticket" from the concurrency limiter for op. If there's none available, the caller
	// routine will be blocked until there's room available.
	Acquire(op string)

	// Release gives back one "ticket" to the concurrency limiter identified by op. If there's one or more
	// routines waiting for one, one will be woken up.
	Release(op string)
}

ConcurrencyLimiter limits the concurrency when calling AWS CloudWatch APIs. The functions implemented by this interface follow the same as a normal semaphore, but accept and operation identifier. Some implementations might use this to keep a different semaphore, with different reentrance values, per operation.

func NewPerAPICallLimiter added in v0.56.0

func NewPerAPICallLimiter(listMetrics, getMetricData, getMetricStatistics int) ConcurrencyLimiter

NewPerAPICallLimiter creates a new PerAPICallLimiter.

func NewSingleLimiter added in v0.56.0

func NewSingleLimiter(limit int) ConcurrencyLimiter

NewSingleLimiter creates a new SingleLimiter.

type MetricDataResult

type MetricDataResult struct {
	ID string
	// A nil datapoint is a marker for no datapoint being found
	Datapoint *float64
	Timestamp time.Time
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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