...

Package datadog

import "github.com/palantir/go-baseapp/baseapp/datadog"
Overview
Index

Overview ▾

Package datadog defines configuration and functions for emitting metrics to Datadog using the DogStatd protocol.

It supports a special format for metric names to add metric-specific tags:

metricName[tag1,tag2:value2,...]

Global tags for all metrics can be set in the configuration.

Note that rcrowley/go-metrics and DogStatsd define counters in different ways: counters in DogStatsd are reported over an interval and reset to zero at the start of each period while go-metrics counters are running totals that are more like gauges with internal state. This package follows the DogStatsd definition and reports the change in counter values between emmit calls. The go-metrics behavior can be simulated at analysis time in Datadog by taking cumulative sums.

Constants

const (
    DefaultAddress  = "127.0.0.1:8125"
    DefaultInterval = 10 * time.Second
)

func StartEmitter

func StartEmitter(s *baseapp.Server, c Config) error

StartEmitter starts a goroutine that emits metrics from the server's registry to the configured DogStatsd endpoint.

type Config

type Config struct {
    Address  string        `yaml:"address" json:"address"`
    Interval time.Duration `yaml:"interval" json:"interval"`
    Tags     []string      `yaml:"tags" json:"tags"`
}

type Emitter

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

func NewEmitter

func NewEmitter(client *statsd.Client, registry metrics.Registry) *Emitter

func (*Emitter) Emit

func (e *Emitter) Emit(ctx context.Context, interval time.Duration)

func (*Emitter) EmitOnce

func (e *Emitter) EmitOnce()