Documentation
¶
Overview ¶
Package cloudwatch reads CloudWatch metrics (Query API 2010-08-01) and CloudWatch Logs (JSON 1.1). Metric reads are billed by AWS, so callers go through Cache.
Index ¶
- Constants
- Variables
- func Cached[T any](c *Cache, key string, fn func() (T, error)) (T, bool, error)
- type Cache
- type Client
- func (c *Client) DescribeLogGroups(ctx context.Context, region, prefix string, limit int) ([]LogGroup, error)
- func (c *Client) FilterLogEvents(ctx context.Context, region string, f FilterInput) (events []Event, truncated bool, err error)
- func (c *Client) GetMetricData(ctx context.Context, region string, qs []Query, start, end time.Time) ([]Series, error)
- func (c *Client) ListMetrics(ctx context.Context, region, namespace, name string, dims []Dimension) ([]Metric, error)
- type Dimension
- type Event
- type FilterInput
- type LogGroup
- type Metric
- type Point
- type Query
- type Series
Constants ¶
const ( // DefaultWindow is the read window for one metric view. DefaultWindow = 3 * time.Hour // DefaultPeriod is the datapoint period in seconds for one metric view. DefaultPeriod = 300 )
const ServiceName = "cloudwatch"
ServiceName is the key used in the guard ServicesEnabled map.
Variables ¶
var ( Service = awsx.Service{Name: "monitoring", Prefix: "monitoring", SigningName: "monitoring"} LogsService = awsx.Service{Name: "logs", Prefix: "logs", SigningName: "logs", TargetPrefix: "Logs_20140328"} )
Service names are checked against the botocore models for monitoring and logs.
var ErrBadQuery = errors.New("cloudwatch: invalid metric query")
ErrBadQuery is returned for a query that cannot be sent.
Functions ¶
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache holds metric reads for a short TTL. Concurrent callers with the same key share one provider call, because every metric read is billed.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the lazy CloudWatch module; it makes no call until a method runs.
func (*Client) DescribeLogGroups ¶
func (c *Client) DescribeLogGroups(ctx context.Context, region, prefix string, limit int) ([]LogGroup, error)
DescribeLogGroups lists groups by name prefix, up to limit (all pages until then).
func (*Client) FilterLogEvents ¶
func (c *Client) FilterLogEvents(ctx context.Context, region string, f FilterInput) (events []Event, truncated bool, err error)
FilterLogEvents reads matching events in the window, up to Limit. truncated reports that more events exist than were returned.
type Dimension ¶
type Dimension struct{ Name, Value string }
Dimension is one name and value of a metric identity.
type FilterInput ¶
FilterInput selects log events.