Documentation
¶
Overview ¶
Package cloudwatch emulates Amazon CloudWatch metrics, alarms and dashboards over every protocol its SDKs speak: RPCv2-CBOR (Go, Java), JSON 1.0 (Python, JS, CLI) and the legacy Query protocol. Metric alarms are evaluated in the background and fire their actions through the hub.
Index ¶
- type Alarm
- type Dashboard
- type Dimension
- type HistoryItem
- type Metric
- type Point
- type Service
- func (s *Service) Close() error
- func (s *Service) Evaluate(now time.Time)
- func (s *Service) Info() core.Info
- func (s *Service) Inspect(table, id string) any
- func (s *Service) Load(b []byte) error
- func (s *Service) Reset()
- func (s *Service) Resources() []core.Table
- func (s *Service) Save() ([]byte, error)
- func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *Service) TaggedResources(account, region string) map[string]map[string]string
- type Tag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alarm ¶
type Alarm struct {
AlarmName string
AlarmArn string
AlarmDescription string `json:",omitempty"`
AlarmConfigurationUpdatedTimestamp core.Time
ActionsEnabled bool
OKActions []string `json:",omitempty"`
AlarmActions []string `json:",omitempty"`
InsufficientDataActions []string `json:",omitempty"`
StateValue string
StateReason string `json:",omitempty"`
StateReasonData string `json:",omitempty"`
StateUpdatedTimestamp core.Time
StateTransitionedTimestamp core.Time
MetricName string `json:",omitempty"`
Namespace string `json:",omitempty"`
Statistic string `json:",omitempty"`
ExtendedStatistic string `json:",omitempty"`
Dimensions []Dimension `json:",omitempty"`
Period int `json:",omitempty"`
Unit string `json:",omitempty"`
EvaluationPeriods int `json:",omitempty"`
DatapointsToAlarm int `json:",omitempty"`
Threshold *float64 `json:",omitempty"`
ComparisonOperator string `json:",omitempty"`
TreatMissingData string `json:",omitempty"`
EvaluateLowSampleCountPercentile string `json:",omitempty"`
Metrics []query `json:",omitempty"`
ThresholdMetricId string `json:",omitempty"`
AlarmRule string `json:",omitempty"`
}
Alarm is a metric or composite alarm in its MetricAlarm/CompositeAlarm wire shape; composite alarms set AlarmRule.
type Dashboard ¶
type Dashboard struct {
Name string `json:"name"`
Account string `json:"account"`
Body string `json:"body"`
Modified time.Time `json:"modified"`
}
Dashboard is a stored dashboard.
type HistoryItem ¶
type HistoryItem struct {
AlarmName string
AlarmType string
Timestamp core.Time
HistoryItemType string
HistorySummary string
HistoryData string
}
HistoryItem is one DescribeAlarmHistory entry.
type Metric ¶
type Metric struct {
Account string `json:"account"`
Region string `json:"region"`
Namespace string `json:"namespace"`
Name string `json:"name"`
Dimensions []Dimension `json:"dimensions,omitempty"`
Points []Point `json:"points"`
}
Metric is one time series.
type Point ¶
type Point struct {
T time.Time `json:"t"`
N float64 `json:"n"`
Sum float64 `json:"sum"`
Min float64 `json:"min"`
Max float64 `json:"max"`
Values []float64 `json:"values,omitempty"` // samples of a Values/Counts datum, for percentiles
Counts []float64 `json:"counts,omitempty"`
Unit string `json:"unit,omitempty"`
}
Point is one datum: a value, values with counts, or a statistic set.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the CloudWatch emulator.
func (*Service) Evaluate ¶
Evaluate evaluates every metric alarm at now and runs the actions of the alarms that change state. The background loop calls it every 10 seconds.
func (*Service) Inspect ¶
Inspect returns an alarm (by name) or the metrics of a namespace with their recent points.