tune

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2020 License: MIT Imports: 9 Imported by: 0

README

Tune

GitHub Workflow Status (branch) Go Reportcard go.dev reference License Release

A statting client for Golang microservices. Allows for local vs deployed configuration, and permits StatsD and Cloudwatch endpoints.

Versioning

The project will be versioned in accordance with Semver 2.0.0. See the releases section for the latest version. Until version 1.0.0 the project is considered to be unstable.

It is always highly recommended to vendor the version you are using.

License

See LICENSE.md for more information.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAsyncStatsD

func NewAsyncStatsD(proto, host, prefix string, retry time.Duration) <-chan *Client

NewAsyncStatsD takes a protocol, hnost, prefix, and retry interval to initialize a statsD client with. It will retry on the interval given and returns the client on a channel.

Types

type CWStatter

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

CWStatter represents all the elements necessary to meet the Statter struct used by the tune statting client

func (*CWStatter) Counter

func (cws *CWStatter) Counter(sampleRate float32, bucket string, n ...int)

Counter meets the Statter interface

func (*CWStatter) Gauge

func (cws *CWStatter) Gauge(sampleRate float32, bucket string, value ...string)

Gauge meets the Statter interface

func (*CWStatter) Timing

func (cws *CWStatter) Timing(sampleRate float32, bucket string, d ...time.Duration)

Timing meets the Statter interface

type Client

type Client struct {
	g2s.Statter
}

Client represents a client wrapper for a statsD client

func NewCWStatter

func NewCWStatter(prefix, region string) (*Client, error)

NewCWStatter takes a prefix and returns a configured statter to point at cloudwatch

func NewCWStatterWithClient

func NewCWStatterWithClient(prefix, region string, client *http.Client) (*Client, error)

NewCWStatterWithClient takes a prefix and http client and returns a configured statter to point at cloudwatch

func NewNoop

func NewNoop() *Client

NewNoop returns a new client that will perform noops.

func NewStatsD

func NewStatsD(proto, host, prefix string) (*Client, error)

NewStatsD takes a protocol, host, and prefix to initialize a statsD client with. It returns an error if initializing the client encounters any errors.

func (*Client) StatEndpoint

func (c *Client) StatEndpoint(fn http.HandlerFunc, label string) http.HandlerFunc

StatEndpoint wraps a http handler to collect and send stats to the aggregator. It will send counts and timing metrics to be aggregated.

Jump to

Keyboard shortcuts

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