dogstatsd

package
v0.0.0-...-339832d Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2023 License: MIT Imports: 23 Imported by: 0

README

dogstatsd

Name

dogstatsd - publish coredns metrics to dogstatsd agents

Description

CoreDNS has a builtin mechanism for exposing metrics to Prometheus over a HTTP endpoint, but infrastructures that use a metric collection system based on dogstatsd have to run a bridge to poll CoreDNS's metrics endpoint and push them to a dogstatsd agent.

The dogstatsd plugin removes the need for a such bridge by allowing CoreDNS to directly push its metrics to a dogstatsd agent over UDP.

Syntax

dogstatsd [ADDR:PORT]
  • ADDR Address at which a dogstatsd agent is available. It may be prefixed with udp://, udp4://, udp6://, or unixgram:// to indicate the protocal to use to push metrics to a dogstatsd agent. If unxigram:// is specified the address must be a path to a unix domain socket on the file system.
  • PORT Port number at which the dogstatsd agent is accepting metrics. The port must not be set when the unixgram:// protocol is used to push metrics to a dogstatsd agent.

If you want more control:

dogstatsd [ADDR:PORT] {
    buffer SIZE
    flush INTERVAL
    go
    process
}
  • buffer configures the size of the client buffer used to push metrics to a dogstatsd agent. This must not exceed the size of the receive buffer used by the agent. The minimum size is 512 B, the maximum is 64 KB.
  • flush configures the time interval between flushes of metrics to a dogstatsd agent. The minimum interval is 1 second, there is not maximum.
  • go enables reporting of go metrics to the dogstatsd agent.
  • process enables reporting of process metrics to the dogstatsd agent.

Examples

Enable the dogstatsd plugin with a client buffer size of 8 KB, and flushing metrics every 10 seconds.

. {
    dogstatsd localhost:8125 {
        buffer 8192
        flush 10s
    }
}
plugins.cfg

This plugin is intended to appear right after the prometheus plugin declaration.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dogstatsd

type Dogstatsd struct {
	Next plugin.Handler

	// Address of the dogstatsd agent to push metrics to.
	Addr string

	// Size of the socket buffer used to push metrics to the dogstatsd agent.
	BufferSize int

	// Time interval between flushes of metrics to the dogstasd agent.
	FlushInterval time.Duration

	// Reg is the prometheus registry used by the metrics plugin where all
	// metrics are registered.
	Reg *prometheus.Registry

	// Those flags control whether this plugin instance is allowed to report
	// go and process metrics. This is used because those metrics are global
	// so it is OK if only a single plugin pushes them to the dogstatsd agent.
	EnableGoMetrics      bool
	EnableProcessMetrics bool

	// ZoneNames is the list of zones that this plugin reports metrics for.
	ZoneNames []string
	// contains filtered or unexported fields
}

Dogstatsd is the implementation of the dogstasd coredns plugin.

func New

func New() *Dogstatsd

New returns a new instance of a dogstatsd plugin.

func (*Dogstatsd) Name

func (d *Dogstatsd) Name() string

Name returns the name of the plugin.

func (*Dogstatsd) ServeDNS

func (d *Dogstatsd) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error)

ServeDNS satisfies the plugin.Handler interface.

func (*Dogstatsd) Start

func (d *Dogstatsd) Start()

Start the dogstatsd plugin. The method returns immediatly after starting the plugin's internal goroutine.

func (*Dogstatsd) Stop

func (d *Dogstatsd) Stop()

Stop interrupts the runing plugin.

Jump to

Keyboard shortcuts

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