Documentation
¶
Index ¶
- Constants
- type API
- type Client
- func (c *Client) Close() error
- func (c *Client) Count(name string, value float64, tags []string) error
- func (c *Client) Decr(name string, tags []string) error
- func (c *Client) Flush() error
- func (c *Client) Gauge(name string, value float64, tags []string) error
- func (c *Client) Histogram(name string, val float64, tags []string) error
- func (c *Client) Incr(name string, tags []string) error
- func (c *Client) Snapshot() *Client
- func (c *Client) Timing(name string, val time.Duration, tags []string) error
- type ExactHistogram
- type FlushCloser
- type HistogramResult
- type HostTagger
- type Metric
- type MultiTask
- type Periodic
Constants ¶
const ( TypeGauge = "gauge" TypeRate = "rate" TypeCount = "count" )
todo: make proper type
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
func (API) AddHostTags ¶
AddHostTags adds a host tags to a given host. If host is new or doesn't have metrics yet, this call will fail.
type Client ¶
type Client struct {
Series []*Metric `json:"series"` // raw data
sync.Mutex
// contains filtered or unexported fields
}
Client is the main datastructure of metrics to upload
type ExactHistogram ¶
type ExactHistogram struct {
// contains filtered or unexported fields
}
ExactHistogram is the dumbest way possible to compute various descriptive statistics
It keeps all data, does a sort, and the figures out various stats. That said for 1000 elements, it takes under 1/20 of a millisecond to compute.
Also the "sort" method is what datadog's agent does, so it can't be too painful.
func NewExactHistogram ¶
func NewExactHistogram(points int, tags []string) *ExactHistogram
NewExactHistogram creates a new object
func (*ExactHistogram) Flush ¶
func (he *ExactHistogram) Flush() HistogramResult
Flush needs to be renamed, but computes the data
type FlushCloser ¶
FlushCloser is similar to a io.WriteCloser
type HistogramResult ¶
type HistogramResult struct {
Count float64
Min float64
Max float64
Avg float64
Median float64
P95 float64
}
HistogramResult returns some descriptive statistics Add other stats as needed
type HostTagger ¶
type HostTagger struct {
// contains filtered or unexported fields
}
func NewHostTagger ¶
func NewHostTagger(api API, hostname string, tags []string) *HostTagger
func (*HostTagger) Close ¶
func (ht *HostTagger) Close() error
func (*HostTagger) Flush ¶
func (ht *HostTagger) Flush() error
type Metric ¶
type Metric struct {
Name string `json:"metric"`
Value [1][2]float64 `json:"points"`
Type string `json:"type"`
Hostname string `json:"host,omitempty"`
Tags []string `json:"tags,omitempty"`
Interval int `json:"interval,omitempty"`
}
Metric is a data structure that represents the JSON that Datadog wants when posting to the API
type MultiTask ¶
type MultiTask []FlushCloser
MultiTask is a sequence of FlushClosers
It operates in serial, although the underlyding implimentation can work in parallel. See Periodic below
type Periodic ¶
type Periodic struct {
// contains filtered or unexported fields
}
Periodic handles flushing data periodically, also satifies the FlushCloser interface so it can be used in MutliTask
func NewPeriodic ¶
func NewPeriodic(client FlushCloser, duration time.Duration) *Periodic
NewPeriodic task create a new ticket to flush data at regular intervals