datadog

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

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.

Index

Constants

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

Variables

This section is empty.

Functions

func SetTimerUnit

func SetTimerUnit(unit time.Duration)

SetTimerUnit sets the units used when exporting metrics.Timer metrics. By default, times are reported in nanoseconds. You must call this function before starting any Emitter instances.

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.

Types

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()

func (*Emitter) Flush

func (e *Emitter) Flush() error

Jump to

Keyboard shortcuts

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