statsd

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxPacketSize = 1 << 16
)

Variables

View Source
var (
	ErrInvalidScheme = fmt.Errorf("invalid statsd transport")
)

Functions

This section is empty.

Types

type Adapter

type Adapter interface {
	AppendName(export.Record, *bytes.Buffer)
	AppendTags(export.Record, *bytes.Buffer)
}

Adapter supports statsd syntax variations, primarily plain statsd vs. dogstatsd.

type Config

type Config struct {
	// URL describes the destination for exporting statsd data.
	// e.g., udp://host:port
	//       tcp://host:port
	//       unix:///socket/path
	URL string

	// Writer is an alternate to providing a URL.  When Writer is
	// non-nil, URL will be ignored and the exporter will write to
	// the configured Writer interface.
	Writer io.Writer

	// MaxPacketSize this limits the packet size for packet-oriented transports.
	MaxPacketSize int
}

Config supports common configuration that applies to statsd exporters.

type Exporter

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

Exporter is common type meant to implement concrete statsd exporters.

func NewExporter

func NewExporter(config Config, adapter Adapter) (*Exporter, error)

NewExport returns a common implementation for exporters that Export statsd syntax.

func (*Exporter) Export

func (e *Exporter) Export(_ context.Context, checkpointSet export.CheckpointSet) error

Export is common code for any statsd-based metric.Exporter implementation.

type LabelEncoder

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

LabelEncoder encodes metric labels in the dogstatsd syntax.

TODO: find a link for this syntax. It's been copied out of code, not a specification:

https://github.com/stripe/veneur/blob/master/sinks/datadog/datadog.go

func NewLabelEncoder

func NewLabelEncoder() *LabelEncoder

NewLabelEncoder returns a new encoder for dogstatsd-syntax metric labels.

func (*LabelEncoder) Encode

func (e *LabelEncoder) Encode(labels []core.KeyValue) string

Encode emits a string like "|#key1:value1,key2:value2".

func (*LabelEncoder) ForceEncode

func (e *LabelEncoder) ForceEncode(labels export.Labels) (string, bool)

ForceEncode returns a statsd label encoding, even if the exported labels were encoded by a different type of encoder. Returns a boolean to indicate whether the labels were in fact re-encoded, to test for (and warn about) efficiency.

Jump to

Keyboard shortcuts

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