Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type APIClient ¶
type APIClient struct {
// contains filtered or unexported fields
}
APIClient send metrics to Datadog, via the Datadog API
func MakeAPIClient ¶
MakeAPIClient creates a new API client with the given api and app keys
func (*APIClient) PrewarmConnection ¶
PrewarmConnection sends a redundant GET request to the Datadog API to prewarm the TSL connection
func (*APIClient) SendMetrics ¶
SendMetrics posts a batch metrics payload to the Datadog API
type APIMetric ¶
type APIMetric struct {
Name string `json:"metric"`
Host *string `json:"host,omitempty"`
Tags []string `json:"tags,omitempty"`
MetricType MetricType `json:"type"`
Interval *float64 `json:"interval,omitempty"`
Points []interface{} `json:"points"`
}
APIMetric is a metric that can be marshalled to send to the metrics API
type BatchKey ¶
type BatchKey struct {
// contains filtered or unexported fields
}
BatchKey identifies a batch of metrics
type Batcher ¶
type Batcher struct {
// contains filtered or unexported fields
}
Batcher aggregates metrics with common properties,(metric name, tags, type etc)
func MakeBatcher ¶
MakeBatcher creates a new batcher object
func (*Batcher) ToAPIMetrics ¶
ToAPIMetrics converts the current batch of metrics into API metrics
type Config ¶
type Config struct {
APIKey string
Site string
ShouldRetryOnFailure bool
BatchInterval time.Duration
}
Config gives options for how the listener should work
type Distribution ¶
type Distribution struct {
Name string
Tags []string
Host *string
Values []MetricValue
}
Distribution is a type of metric that is aggregated over multiple hosts
func (*Distribution) AddPoint ¶
func (d *Distribution) AddPoint(timestamp time.Time, value float64)
AddPoint adds a point to the distribution metric
func (*Distribution) Join ¶
func (d *Distribution) Join(metric Metric)
Join creates a union between two metric sets
func (*Distribution) ToAPIMetric ¶
func (d *Distribution) ToAPIMetric(interval time.Duration) []APIMetric
ToAPIMetric converts a distribution into an API ready format.
func (*Distribution) ToBatchKey ¶
func (d *Distribution) ToBatchKey() BatchKey
ToBatchKey returns a key that can be used to batch the metric
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener implements wrapper.HandlerListener, injecting metrics into the context
func MakeListener ¶
MakeListener initializes a new metrics lambda listener
func (*Listener) HandlerFinished ¶
HandlerFinished implemented as part of the wrapper.HandlerListener interface
func (*Listener) HandlerStarted ¶
HandlerStarted adds metrics service to the context
type Metric ¶
type Metric interface {
AddPoint(timestamp time.Time, value float64)
ToAPIMetric(interval time.Duration) []APIMetric
ToBatchKey() BatchKey
Join(metric Metric)
}
Metric represents a metric that can have any kind of
type MetricType ¶
type MetricType string
MetricType enumerates all the available metric types
const ( // DistributionType represents a distribution metric DistributionType MetricType = "distribution" )
type MetricValue ¶ added in v0.2.0
MetricValue represents a datapoint for a metric
type Processor ¶
type Processor interface {
// AddMetric sends a metric to the agent
AddMetric(metric Metric)
// StartProcessing begins processing metrics asynchronously
StartProcessing()
// FinishProcessing shuts down the agent, and tries to flush any remaining metrics
FinishProcessing()
}
Processor is used to batch metrics on a background thread, and send them on to a client periodically.
func GetProcessor ¶
GetProcessor retrieves the processor from a context object.
func MakeProcessor ¶
func MakeProcessor(ctx context.Context, client Client, timeService TimeService, batchInterval time.Duration, shouldRetryOnFail bool) Processor
MakeProcessor creates a new metrics context
type TimeService ¶
TimeService wraps common time related operations
func MakeTimeService ¶
func MakeTimeService() TimeService
MakeTimeService creates a new time service