datadog

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2018 License: Apache-2.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPClient

type HTTPClient interface {
	Post(string, string, io.Reader) (*http.Response, error)
}

HTTPClient is the interface used for sending HTTP POST requests to Datadog.

type Point

type Point struct {
	Metric string    `json:"metric"`
	Points [][]int64 `json:"points"`
	Type   string    `json:"type"`
	Host   string    `json:"host"`
	Tags   []string  `json:"tags"`
}

Point represents a single metric.

type PointBuilder

type PointBuilder interface {
	BuildPoints(int64) ([]Point, error)
}

PointBuilder is the interface the DatadogReporter will use to collect metrics to send to Datadog.

type Reporter

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

Reporter stores configuration for reporting to Datadog.

func NewReporter

func NewReporter(
	apiKey string,
	pointBuilder PointBuilder,
	opts ...ReporterOption,
) *Reporter

NewReporter initializes and returns a new Reporter.

func (*Reporter) Run

func (r *Reporter) Run()

Run reports metrics from the configured PointBuilder to Datadog on a configured interval.

type ReporterOption

type ReporterOption func(*Reporter)

ReporterOption is a func that is used to configure optional settings on a DatadogReporter.

func WithHTTPClient

func WithHTTPClient(c HTTPClient) ReporterOption

WithHTTPClient returns a ReporterOption for configuring the HTTPClient to be used for sending metrics via HTTP to Datadog.

func WithHost

func WithHost(host string) ReporterOption

WithHost is a ReporterOption for configuring the host that is applied to all metrics.

func WithInterval

func WithInterval(d time.Duration) ReporterOption

WithInterval returns a ReporterOption for configuring the interval metrics will be reported to Datadog.

Jump to

Keyboard shortcuts

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