Documentation ¶
Index ¶
- Variables
- func AssertPointsEqual(t *testing.T, expected, actual []Point)
- func AssertSerieEqual(t *testing.T, expected, actual *Serie)
- func AssertSketchSeriesEqual(t *testing.T, expected, actual *percentile.SketchSeries)
- func AssertSketchesEqual(t *testing.T, expected, actual []percentile.Sketch)
- func AssertTagsEqual(t *testing.T, expected, actual []string)
- type APIMetricType
- type ContextKey
- type ContextMetrics
- type ContextSketch
- type Count
- type Counter
- type Distribution
- type Event
- type EventAlertType
- type EventPriority
- type Events
- type Gauge
- type Histogram
- type Historate
- type Metric
- type MetricSample
- type MetricType
- type MonotonicCount
- type NoSerieError
- type OrderedSketches
- type Point
- type Rate
- type Serie
- type Series
- type ServiceCheck
- type ServiceCheckStatus
- type ServiceChecks
- type Set
Constants ¶
This section is empty.
Variables ¶
var DistributionMetricTypes = map[MetricType]struct{}{ DistributionType: {}, }
DistributionMetricTypes contains the MetricTypes that are used for percentiles
Functions ¶
func AssertPointsEqual ¶
AssertPointsEqual evaluate if two list of point are equal (order doesn't matters).
func AssertSerieEqual ¶
AssertSerieEqual evaluate if two are equal.
func AssertSketchSeriesEqual ¶
func AssertSketchSeriesEqual(t *testing.T, expected, actual *percentile.SketchSeries)
AssertSketchSeriesEqual checks whether two SketchSeries are equal
func AssertSketchesEqual ¶
func AssertSketchesEqual(t *testing.T, expected, actual []percentile.Sketch)
AssertSketchesEqual checks whether two Sketch slices are equal
func AssertTagsEqual ¶
AssertTagsEqual evaluate if two list of tags are equal (the order doesn't matters).
Types ¶
type APIMetricType ¶
type APIMetricType int
APIMetricType represents an API metric type
const ( APIGaugeType APIMetricType = iota APIRateType APICountType )
Enumeration of the existing API metric types
func (APIMetricType) MarshalText ¶
func (a APIMetricType) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshal interface to marshal an APIMetricType to a serialized byte slice
func (APIMetricType) String ¶
func (a APIMetricType) String() string
String returns a string representation of APIMetricType
func (APIMetricType) UnmarshalText ¶
func (a APIMetricType) UnmarshalText(buf []byte) error
UnmarshalText is a custom unmarshaller for APIMetricType (used for testing)
type ContextKey ¶
type ContextKey [16]byte
ContextKey is a non-cryptographic hash unique to a context
type ContextMetrics ¶
type ContextMetrics map[ckey.ContextKey]Metric
ContextMetrics stores all the metrics by context key
func MakeContextMetrics ¶
func MakeContextMetrics() ContextMetrics
MakeContextMetrics returns a new ContextMetrics
func (ContextMetrics) AddSample ¶
func (m ContextMetrics) AddSample(contextKey ckey.ContextKey, sample *MetricSample, timestamp float64, interval int64)
AddSample add a sample to the current ContextMetrics and initialize a new metrics if needed. TODO: Pass a reference to *MetricSample instead
func (ContextMetrics) Flush ¶
func (m ContextMetrics) Flush(timestamp float64) []*Serie
Flush flushes every metrics in the ContextMetrics
type ContextSketch ¶
type ContextSketch map[ckey.ContextKey]*Distribution
ContextSketch stores the distributions by context key
func MakeContextSketch ¶
func MakeContextSketch() ContextSketch
MakeContextSketch returns a new ContextSketch
func (ContextSketch) AddSample ¶
func (c ContextSketch) AddSample(contextKey ckey.ContextKey, sample *MetricSample, timestamp float64, interval int64)
AddSample adds a sample to the ContextSketch
func (ContextSketch) Flush ¶
func (c ContextSketch) Flush(timestamp float64) []*percentile.SketchSeries
Flush flushes sketches in the ContextSketch
type Count ¶
type Count struct {
// contains filtered or unexported fields
}
Count is used to count the number of events that occur between 2 flushes. Each sample's value is added to the value that's flushed
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
Counter tracks how many times something happened per second. Counters are only used by DogStatsD and are very similar to Count: the main diffence is that they are sent as Rate.
func NewCounter ¶
NewCounter return a new initialized Counter
type Distribution ¶
type Distribution struct {
// contains filtered or unexported fields
}
Distribution tracks the distribution of samples added over one flush period. Designed to be globally accurate for percentiles.
func NewDistribution ¶
func NewDistribution() *Distribution
NewDistribution creates a new Distribution containing GKArray
type Event ¶
type Event struct { Title string `json:"msg_title"` Text string `json:"msg_text"` Ts int64 `json:"timestamp"` Priority EventPriority `json:"priority,omitempty"` Host string `json:"host"` Tags []string `json:"tags,omitempty"` AlertType EventAlertType `json:"alert_type,omitempty"` AggregationKey string `json:"aggregation_key,omitempty"` SourceTypeName string `json:"source_type_name,omitempty"` EventType string `json:"event_type,omitempty"` }
Event holds an event (w/ serialization to DD agent 5 intake format)
type EventAlertType ¶
type EventAlertType string
EventAlertType represents the alert type of an event
const ( EventAlertTypeError EventAlertType = "error" EventAlertTypeWarning EventAlertType = "warning" EventAlertTypeInfo EventAlertType = "info" EventAlertTypeSuccess EventAlertType = "success" )
Enumeration of the existing event alert types, and their values
func GetAlertTypeFromString ¶
func GetAlertTypeFromString(val string) (EventAlertType, error)
GetAlertTypeFromString returns the EventAlertType from its string representation
type EventPriority ¶
type EventPriority string
EventPriority represents the priority of an event
const ( EventPriorityNormal EventPriority = "normal" EventPriorityLow EventPriority = "low" )
Enumeration of the existing event priorities, and their values
func GetEventPriorityFromString ¶
func GetEventPriorityFromString(val string) (EventPriority, error)
GetEventPriorityFromString returns the EventPriority from its string representation
type Events ¶
type Events []*Event
Events represents a list of events ready to be serialize
func (Events) MarshalJSON ¶
MarshalJSON serializes events to JSON so it can be sent to the Agent 5 intake (we don't use the v1 event endpoint because it only supports 1 event per payload) FIXME(olivier): to be removed when v2 endpoints are available
type Gauge ¶
type Gauge struct {
// contains filtered or unexported fields
}
Gauge tracks the value of a metric
type Histogram ¶
type Histogram struct {
// contains filtered or unexported fields
}
Histogram tracks the distribution of samples added over one flush period
func NewHistogram ¶
NewHistogram returns a newly initialized histogram
type Historate ¶
type Historate struct {
// contains filtered or unexported fields
}
Historate tracks the distribution of samples added over one flush period for "rate" like metrics. Warning this doesn't use the harmonic mean, beware of what it means when using it.
func NewHistorate ¶
NewHistorate returns a newly-initialized historate
type Metric ¶
type Metric interface {
// contains filtered or unexported methods
}
Metric is the interface of all metric types
type MetricSample ¶
type MetricSample struct { Name string Value float64 RawValue string Mtype MetricType Tags []string Host string SampleRate float64 Timestamp float64 }
MetricSample represents a raw metric sample
type MetricType ¶
type MetricType int
MetricType is the representation of an aggregator metric type
const ( GaugeType MetricType = iota RateType CountType MonotonicCountType CounterType HistogramType HistorateType SetType // NOTE: DistributionType is in development and is NOT supported DistributionType )
metric type constants enumeration
func (MetricType) String ¶
func (m MetricType) String() string
String returns a string representation of MetricType
type MonotonicCount ¶
type MonotonicCount struct {
// contains filtered or unexported fields
}
MonotonicCount tracks a raw counter, based on increasing counter values. Samples that have a lower value than the previous sample are ignored (since it usually means that the underlying raw counter has been reset). Example:
submitting samples 2, 3, 6, 7 returns 5 (i.e. 7-2) on flush ; then submitting samples 10, 11 on the same MonotonicCount returns 4 (i.e. 11-7) on flush
type NoSerieError ¶
type NoSerieError struct{}
NoSerieError is the error returned by a metric when not enough samples have been submitted to generate a serie
func (NoSerieError) Error ¶
func (e NoSerieError) Error() string
type OrderedSketches ¶
type OrderedSketches struct {
// contains filtered or unexported fields
}
OrderedSketches are used to sort []Sketch
func (OrderedSketches) Len ¶
func (os OrderedSketches) Len() int
func (OrderedSketches) Less ¶
func (os OrderedSketches) Less(i, j int) bool
func (OrderedSketches) Swap ¶
func (os OrderedSketches) Swap(i, j int)
type Point ¶
Point represents a metric value at a specific time
func (*Point) MarshalJSON ¶
MarshalJSON return a Point as an array of value (to be compatible with v1 API) FIXME(maxime): to be removed when v2 endpoints are available
func (*Point) UnmarshalJSON ¶
UnmarshalJSON is a custom unmarshaller for Point (used for testing)
type Rate ¶
type Rate struct {
// contains filtered or unexported fields
}
Rate tracks the rate of a metric over 2 successive flushes
type Serie ¶
type Serie struct { Name string `json:"metric"` Points []Point `json:"points"` Tags []string `json:"tags"` Host string `json:"host"` Device string `json:"device,omitempty"` // FIXME(olivier): remove as soon as the v1 API can handle `device` as a regular tag MType APIMetricType `json:"type"` Interval int64 `json:"interval"` SourceTypeName string `json:"source_type_name,omitempty"` ContextKey ckey.ContextKey `json:"-"` NameSuffix string `json:"-"` }
Serie holds a timeseries (w/ json serialization to DD API format)
type Series ¶
type Series []*Serie
Series represents a list of Serie ready to be serialize
func (Series) MarshalJSON ¶
MarshalJSON serializes timeseries to JSON so it can be sent to V1 endpoints FIXME(maxime): to be removed when v2 endpoints are available
type ServiceCheck ¶
type ServiceCheck struct { CheckName string `json:"check"` Host string `json:"host_name"` Ts int64 `json:"timestamp"` Status ServiceCheckStatus `json:"status"` Message string `json:"message"` Tags []string `json:"tags"` }
ServiceCheck holds a service check (w/ serialization to DD api format)
func (ServiceCheck) String ¶
func (sc ServiceCheck) String() string
type ServiceCheckStatus ¶
type ServiceCheckStatus int
ServiceCheckStatus represents the status associated with a service check
const ( ServiceCheckOK ServiceCheckStatus = iota ServiceCheckWarning ServiceCheckStatus = 1 ServiceCheckCritical ServiceCheckStatus = 2 ServiceCheckUnknown ServiceCheckStatus = 3 )
Enumeration of the existing service check statuses, and their values
func GetServiceCheckStatus ¶
func GetServiceCheckStatus(val int) (ServiceCheckStatus, error)
GetServiceCheckStatus returns the ServiceCheckStatus from and integer value
func (ServiceCheckStatus) String ¶
func (s ServiceCheckStatus) String() string
String returns a string representation of ServiceCheckStatus
type ServiceChecks ¶
type ServiceChecks []*ServiceCheck
ServiceChecks represents a list of service checks ready to be serialize
func (ServiceChecks) Marshal ¶
func (sc ServiceChecks) Marshal() ([]byte, error)
Marshal serialize service checks using agent-payload definition
func (ServiceChecks) MarshalJSON ¶
func (sc ServiceChecks) MarshalJSON() ([]byte, error)
MarshalJSON serializes service checks to JSON so it can be sent to V1 endpoints FIXME(olivier): to be removed when v2 endpoints are available
func (ServiceChecks) SplitPayload ¶
func (sc ServiceChecks) SplitPayload(times int) ([]marshaler.Marshaler, error)
SplitPayload breaks the payload into times number of pieces