Documentation

Overview

    Package datadog provides types and functions to export metrics and logs to Datadog via a statds client.

    Index

    Constants

    This section is empty.

    Variables

    View Source
    var Desc = baker.MetricsDesc{
    	Name:   "Datadog",
    	Config: &Config{},
    	New:    newClient,
    }

      Desc describes the Datadog metrics client inteface.

      Functions

      func NewHook

      func NewHook(level log.Level, client *statsd.Client, host string) log.Hook

        NewHook returns a Logrus hook that forwards log entries as events to a statsd client, such as the datadog-agent.

        Log entries with a level higher than level are discarded. host is used to fill the Hostname field of statsd events, its purpose it NOT to serve as configuring the stats connection (the client must already be configured). tags is a list of tags to include with all events.

        Types

        type Client

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

          Client allows to instrument code and export the metrics to a dogstatds client.

          func (*Client) DeltaCount

          func (c *Client) DeltaCount(name string, delta int64)

            DeltaCount increments the value of a metric of type counter by delta. delta must be positive.

            func (*Client) DeltaCountWithTags

            func (c *Client) DeltaCountWithTags(name string, delta int64, tags []string)

              DeltaCountWithTags increments the value of a metric or type counter and associates that value with a set of tags.

              func (*Client) Duration

              func (c *Client) Duration(name string, value time.Duration)

                Duration adds a duration to a metric of type histogram. A histogram samples observations and counts them in different 'buckets'. Duration is basically an histogram but allows to sample values of type time.Duration.

                In Datadog, this is shown as a 'Timer', an implementation of an 'Histogram' DogStatsd metric type, on which percentiles, mean and other info are calculated. see https://docs.datadoghq.com/developers/dogstatsd/data_types/#timers

                func (*Client) DurationWithTags

                func (c *Client) DurationWithTags(name string, value time.Duration, tags []string)

                  DurationWithTags adds a duration to an histogram and associates that duration with a set of tags.

                  func (*Client) Gauge

                  func (c *Client) Gauge(name string, value float64)

                    Gauge sets the value of a metric of type gauge. A Gauge represents a single numerical data point that can arbitrarily go up and down.

                    func (*Client) GaugeWithTags

                    func (c *Client) GaugeWithTags(name string, value float64, tags []string)

                      GaugeWithTags sets the value of a metric of type gauge and associates that value with a set of tags.

                      func (*Client) Histogram

                      func (c *Client) Histogram(name string, value float64)

                        Histogram adds a sample to a metric of type histogram. A histogram samples observations and counts them in different 'buckets' in order to track and show the statistical distribution of a set of values.

                        In Datadog, this is shown as an 'Histogram', a DogStatsd metric type on which percentiles, mean and other info are calculated. see https://docs.datadoghq.com/developers/dogstatsd/data_types/#histograms

                        func (*Client) HistogramWithTags

                        func (c *Client) HistogramWithTags(name string, value float64, tags []string)

                          HistogramWithTags adds a sample to an histogram and associates that sample with a set of tags.

                          func (*Client) RawCount

                          func (c *Client) RawCount(name string, value int64)

                            RawCount sets the value of a metric of type counter. A counter is a cumulative metrics that can only increase. RawCount sets the current value of the counter.

                            func (*Client) RawCountWithTags

                            func (c *Client) RawCountWithTags(name string, value int64, tags []string)

                              RawCountWithTags sets the value of a metric or type counter and associates that value with a set of tags.

                              type Config

                              type Config struct {
                              	Prefix   string   // Prefix is the prefix of all metric names. defaults to baker.
                              	Host     string   // Host is the address (host:port) of the statsd host to send log to (in UDP). defaults to 127.0.0.1:8125.
                              	Tags     []string // Tags is the list of tags to attach to all metrics.
                              	SendLogs bool     `toml:"send_logs"` // SendLogs indicates whether logs should be sent (as statds events) to the statsd client at Host.
                              }

                                Config is the configuration of the Datadog metrics client.

                                Source Files