datadog

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2022 License: MIT Imports: 11 Imported by: 3

Documentation

Index

Constants

View Source
const DefaultURL = "https://app.datadoghq.com/api/v1/series"

DefaultURL is the default series URL the client sends metric data to

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {

	// URL is the series URL to push data to.
	// Default: DefaultURL
	URL string

	// Disables zlib payload compression when
	// POSTing data to the API.
	DisableCompression bool
	// contains filtered or unexported fields
}

func NewClient

func NewClient(apiKey string) *Client

NewClient creates a new API client.

func (*Client) Post

func (c *Client) Post(metrics []Metric) error

Post delivers a metrics snapshot to datadog

type Metric

type Metric struct {
	Name   string           `json:"metric"`
	Points [][2]interface{} `json:"points"`
	Host   string           `json:"host,omitempty"`
	Tags   []string         `json:"tags,omitempty"`
}

Metric represents a flushed metric

type Reporter

type Reporter struct {
	// Client is a customisable reporter client
	Client *Client

	// Hostname can be customised.
	// Default: set via os.Hostname()
	Hostname string
	// contains filtered or unexported fields
}

Reporter implements instruments.Reporter and simply logs metrics

func New

func New(apiKey string) *Reporter

New creates a new reporter.

func (*Reporter) Discrete

func (r *Reporter) Discrete(name string, tags []string, val float64) error

Discrete implements instruments.Reporter

func (*Reporter) Flush

func (r *Reporter) Flush() error

Flush implements instruments.Reporter

func (*Reporter) Metric

func (r *Reporter) Metric(name string, tags []string, v float32)

Metric appends a new metric to the reporter. The value v must be either an int64 or float64, otherwise an error is returned

func (*Reporter) Prep

func (r *Reporter) Prep() error

Prepare implements instruments.Reporter

func (*Reporter) Sample

func (r *Reporter) Sample(name string, tags []string, dist instruments.Distribution) error

Sample implements instruments.Reporter

Jump to

Keyboard shortcuts

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