otel: go.opentelemetry.io/otel/exporter/metric/internal/statsd Index | Files

package statsd

import "go.opentelemetry.io/otel/exporter/metric/internal/statsd"


Package Files

conn.go labels.go


const (
    MaxPacketSize = 1 << 16


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

type Adapter Uses

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 Uses

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 Uses

type Exporter struct {
    // contains filtered or unexported fields

Exporter is common type meant to implement concrete statsd exporters.

func NewExporter Uses

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

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

func (*Exporter) Export Uses

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

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

type LabelEncoder Uses

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:


func NewLabelEncoder Uses

func NewLabelEncoder() *LabelEncoder

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

func (*LabelEncoder) Encode Uses

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

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

func (*LabelEncoder) ForceEncode Uses

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.

Package statsd imports 12 packages (graph) and is imported by 1 packages. Updated 2020-02-07. Refresh now. Tools for package owners.