metrics

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2022 License: MIT Imports: 3 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

type Collector interface {
	Timing(name string, tags ...string) (end func(moretags ...string))
	Increment(name string, tags ...string)
	Gauge(name string, value float64, tags ...string)
}

Collector describes an object that collects metrics

type DatadogCollector

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

DatadogCollector represents a collector that pushes metrics to Datadog

func NewDatadogCollector

func NewDatadogCollector(namespace, addr string, tags []string) (*DatadogCollector, error)

NewDatadogCollector returns a DatadogCollector using dogstatsd at addr, using namespace and adding tags to all metrics.

func (*DatadogCollector) Gauge

func (dc *DatadogCollector) Gauge(name string, value float64, tags ...string)

Gauge sets the value of a gauge. Tags is zero or more strings of the form "[TAG]:[VALUE]"

func (*DatadogCollector) Increment

func (dc *DatadogCollector) Increment(name string, tags ...string)

Increment increments a counter. Tags is zero or more strings of the form "[TAG]:[VALUE]"

func (*DatadogCollector) Timing

func (dc *DatadogCollector) Timing(name string, tags ...string) (end func(moretags ...string))

Timing marks the start of a timed operation and returns a function that should be called when the timed operation is finished Tags is zero or more strings of the form "[TAG]:[VALUE]". Optional additional tags can be provided when end() is called.

type FakeCollector

type FakeCollector struct{}

func (*FakeCollector) Gauge

func (fc *FakeCollector) Gauge(name string, value float64, tags ...string)

func (*FakeCollector) Increment

func (fc *FakeCollector) Increment(name string, tags ...string)

func (*FakeCollector) Timing

func (fc *FakeCollector) Timing(name string, tags ...string) (end func(moretags ...string))

Jump to

Keyboard shortcuts

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