statsd

package
v7.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

A buffered statsd reporter

See examples/statsd_main.go for an end to end example.

Some emitted stats using the example listening with nc 8125 -l -u:

stats.my-service.test-histogram.100ms-200ms:2|c
stats.my-service.test-histogram.300ms-400ms:1|c
stats.my-service.test-histogram.600ms-800ms:1|c
stats.my-service.test-counter:1|c
stats.my-service.test-gauge:813|g

Options

You can use either a basic or a buffered statsd client and pass it to the reporter along with options.

The reporter options are:

// Options is a set of options for the tally reporter.
type Options struct {
	// SampleRate is the metrics emission sample rate. If you
	// do not set this value it will be set to 1.
	SampleRate float32
}

Documentation

Index

Constants

View Source
const (
	// DefaultHistogramBucketNamePrecision is the default
	// precision to use when formatting the metric name
	// with the histogram bucket bound values.
	DefaultHistogramBucketNamePrecision = uint(6)
)

Variables

This section is empty.

Functions

func NewReporter

func NewReporter(statsd statsd.Statter, opts Options) tally.StatsReporter

NewReporter wraps a statsd.Statter for use with tally. Use either statsd.NewClient or statsd.NewBufferedClient.

Types

type Options

type Options struct {
	// SampleRate is the metrics emission sample rate. If you
	// do not set this value it will be set to 1.
	SampleRate float32

	// HistogramBucketNamePrecision is the precision to use when
	// formatting the metric name with the histogram bucket bound values.
	// By default this will be set to the const DefaultHistogramBucketPrecision.
	HistogramBucketNamePrecision uint
}

Options is a set of options for the tally reporter.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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