package cloudwatch
import "github.com/go-kit/kit/metrics/cloudwatch"
Index ¶
- func WithConcurrentRequests(n int) option
- func WithLogger(logger log.Logger) option
- func WithPercentiles(percentiles ...float64) option
- type CloudWatch
- func New(namespace string, svc cloudwatchiface.CloudWatchAPI, options ...option) *CloudWatch
- func (cw *CloudWatch) NewCounter(name string) metrics.Counter
- func (cw *CloudWatch) NewGauge(name string) metrics.Gauge
- func (cw *CloudWatch) NewHistogram(name string) metrics.Histogram
- func (cw *CloudWatch) Send() error
- func (cw *CloudWatch) WriteLoop(c <-chan time.Time)
- type Counter
- type Gauge
- func (g *Gauge) Add(delta float64)
- func (g *Gauge) Set(value float64)
- func (g *Gauge) With(labelValues ...string) metrics.Gauge
- type Histogram
- func (h *Histogram) Observe(value float64)
- func (h *Histogram) With(labelValues ...string) metrics.Histogram
- type Percentiles
Functions ¶
func WithConcurrentRequests ¶
func WithConcurrentRequests(n int) option
func WithLogger ¶
func WithPercentiles ¶
func WithPercentiles(percentiles ...float64) option
WithPercentiles registers the percentiles to track, overriding the existing/default values. Reason is that Cloudwatch makes you pay per metric, so you can save half the money by only using 2 metrics instead of the default 4.
Types ¶
type CloudWatch ¶
type CloudWatch struct {
// contains filtered or unexported fields
}
CloudWatch receives metrics observations and forwards them to CloudWatch. Create a CloudWatch object, use it to create metrics, and pass those metrics as dependencies to the components that will use them.
To regularly report metrics to CloudWatch, use the WriteLoop helper method.
func New ¶
func New(namespace string, svc cloudwatchiface.CloudWatchAPI, options ...option) *CloudWatch
New returns a CloudWatch object that may be used to create metrics. Namespace is applied to all created metrics and maps to the CloudWatch namespace. Callers must ensure that regular calls to Send are performed, either manually or with one of the helper methods.
func (*CloudWatch) NewCounter ¶
func (cw *CloudWatch) NewCounter(name string) metrics.Counter
NewCounter returns a counter. Observations are aggregated and emitted once per write invocation.
func (*CloudWatch) NewGauge ¶
func (cw *CloudWatch) NewGauge(name string) metrics.Gauge
NewGauge returns an gauge.
func (*CloudWatch) NewHistogram ¶
func (cw *CloudWatch) NewHistogram(name string) metrics.Histogram
NewHistogram returns a histogram.
func (*CloudWatch) Send ¶
func (cw *CloudWatch) Send() error
Send will fire an API request to CloudWatch with the latest stats for all metrics. It is preferred that the WriteLoop method is used.
func (*CloudWatch) WriteLoop ¶
func (cw *CloudWatch) WriteLoop(c <-chan time.Time)
WriteLoop is a helper method that invokes Send every time the passed channel fires. This method blocks until the channel is closed, so clients probably want to run it in its own goroutine. For typical usage, create a time.Ticker and pass its C channel to this method.
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
Counter is a counter. Observations are forwarded to a node object, and aggregated (summed) per timeseries.
func (*Counter) Add ¶
Add implements metrics.Counter.
func (*Counter) With ¶
With implements metrics.Counter.
type Gauge ¶
type Gauge struct {
// contains filtered or unexported fields
}
Gauge is a gauge. Observations are forwarded to a node object, and aggregated (the last observation selected) per timeseries.
func (*Gauge) Add ¶
Add implements metrics.Gauge.
func (*Gauge) Set ¶
Set implements metrics.Gauge.
func (*Gauge) With ¶
With implements metrics.Gauge.
type Histogram ¶
type Histogram struct {
// contains filtered or unexported fields
}
Histogram is an Influx histrogram. Observations are aggregated into a generic.Histogram and emitted as per-quantile gauges to the Influx server.
func (*Histogram) Observe ¶
Observe implements metrics.Histogram.
func (*Histogram) With ¶
With implements metrics.Histogram.
type Percentiles ¶
type Percentiles []struct {
// contains filtered or unexported fields
}
Source Files ¶
- Version
- v0.8.0
- Published
- Nov 8, 2018
- Platform
- windows/amd64
- Imports
- 12 packages
- Last checked
- 53 minutes ago –
Tools for package owners.