statsd

package
v2.3.2 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2023 License: MIT Imports: 2 Imported by: 2

Documentation

Overview

Package statsd implements an statsd client.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*config)

Option represents statsd option function.

func WithFlushBytes

func WithFlushBytes(bytes int) Option

WithFlushBytes sets the maximum udp packet size that will be sent. Defaults to 1432 flushBytes.

func WithFlushInterval

func WithFlushInterval(interval time.Duration) Option

WithFlushInterval sets the maximum flushInterval for packet sending. Defaults to 300ms.

type Statsd

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

Statsd is a statsd client.

func New

func New(addr, prefix string, opts ...Option) (*Statsd, error)

New returns a statsd reporter.

Example
reporter, err := statsd.New("127.0.0.1:8125", "my-prefix",
	statsd.WithFlushBytes(1432),
	statsd.WithFlushInterval(300*time.Millisecond),
)
if err != nil {
	panic(err)
}

statter.New(reporter, 10*time.Second)

func (*Statsd) Close

func (s *Statsd) Close() error

Close closes the client and flushes buffered stats, if applicable.

func (*Statsd) Counter

func (s *Statsd) Counter(name string, v int64, tags [][2]string)

Counter reports a counter value.

func (*Statsd) Gauge

func (s *Statsd) Gauge(name string, v float64, tags [][2]string)

Gauge reports a gauge value.

Jump to

Keyboard shortcuts

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