cloudmetrics

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

README

cloudmetrics

CircleCI

This is a reporter for the go-metrics that will posts metrics to CloudWatch.

Usage

import "github.com/neurio/cloudmetrics"

go cloudmetrics.Publish(metrics.DefaultRegistry,
    "/sample/", // namespace
)

Configuration

cloudmetrics supports a number of configuration options

import "github.com/neurio/cloudmetrics"

go cloudmetrics.Publish(metrics.DefaultRegistry,
    "/sample/",                                      // namespace
    cloudmetrics.Dimensions("k1", "v1", "k2", "v2"), // allows for custom dimensions
    cloudmetrics.Interval(time.Minutes * 5),         // custom interval
    cloudmetrics.Context(context.Background()),      // enables graceful shutdown via golang.org/x/net/context 
    cloudmetrics.Percentiles([]float64{.5, .99}),    // customize percentiles for histograms and timers 
)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Client

func Client(client CloudWatch) func(*Publisher)

Client allows for user provided *cloudwatch.Cloudwatch instance

func Context

func Context(ctx context.Context) func(*Publisher)

Context allows a context to be specified. When <-ctx.Done() returns; the Publisher will stop any internal go routines and return

func Debug

func Debug(w io.Writer) func(*Publisher)

Debug writes additional data to the writer specified

func Dimensions

func Dimensions(keyvals ...string) func(*Publisher)

Dimensions allows for user specified dimensiosn to be added to the post

func Interval

func Interval(interval time.Duration) func(*Publisher)

Interval allows for a custom posting interval; by default, the interval is every 1 minute

func Percentiles

func Percentiles(percentiles []float64) func(*Publisher)

Percentiles allows the reported percentiles for Histogram and Timer metrics to be customized

func Publish

func Publish(registry metrics.Registry, namespace string, configs ...func(*Publisher))

Publish is the main entry point to publish metrics on a recurring basis to CloudWatch

Types

type CloudWatch

type CloudWatch interface {
	PutMetricData(input *cloudwatch.PutMetricDataInput) (*cloudwatch.PutMetricDataOutput, error)
}

CloudWatch is an interface for *cloudwatch.CloudWatch that clearly identifies the functions used by cloudmetrics

type Datums

type Datums []*cloudwatch.MetricDatum

func (Datums) Len

func (d Datums) Len() int

func (Datums) Less

func (d Datums) Less(i, j int) bool

func (Datums) Swap

func (d Datums) Swap(i, j int)

type Publisher

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

Directories

Path Synopsis
_examples

Jump to

Keyboard shortcuts

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