Documentation ¶
Index ¶
- Variables
- func EnrichTags(tb *util.TagsBuilder, originID string, k8sOriginID string, cardinality string)
- type APIMetricType
- type ContextMetrics
- type Count
- type Counter
- type Event
- type EventAlertType
- type EventPriority
- type Events
- type Gauge
- type Histogram
- type HistogramBucket
- type Historate
- type Metric
- type MetricSample
- type MetricSampleContext
- type MetricSamplePool
- type MetricType
- type MonotonicCount
- type NoSerieError
- type Point
- type Rate
- type Serie
- type Series
- func (series Series) DescribeItem(i int) string
- func (series Series) Len() int
- func (series Series) Marshal() ([]byte, error)
- func (series Series) MarshalJSON() ([]byte, error)
- func (series Series) MarshalSplitCompress(bufferContext *marshaler.BufferContext) ([]*[]byte, error)
- func (series Series) MarshalStrings() ([]string, [][]string)
- func (series Series) SplitPayload(times int) ([]marshaler.Marshaler, error)
- func (series Series) WriteFooter(stream *jsoniter.Stream) error
- func (series Series) WriteHeader(stream *jsoniter.Stream) error
- func (series Series) WriteItem(stream *jsoniter.Stream, i int) error
- type ServiceCheck
- type ServiceCheckStatus
- type ServiceChecks
- func (sc ServiceChecks) DescribeItem(i int) string
- func (sc ServiceChecks) Len() int
- func (sc ServiceChecks) Marshal() ([]byte, error)
- func (sc ServiceChecks) MarshalJSON() ([]byte, error)
- func (sc ServiceChecks) MarshalSplitCompress(bufferContext *marshaler.BufferContext) ([]*[]byte, error)
- func (sc ServiceChecks) MarshalStrings() ([]string, [][]string)
- func (sc ServiceChecks) SplitPayload(times int) ([]marshaler.Marshaler, error)
- func (sc ServiceChecks) WriteFooter(stream *jsoniter.Stream) error
- func (sc ServiceChecks) WriteHeader(stream *jsoniter.Stream) error
- func (sc ServiceChecks) WriteItem(stream *jsoniter.Stream, i int) error
- type Set
- type SketchPoint
- type SketchSeries
- type SketchSeriesList
Constants ¶
This section is empty.
Variables ¶
var ( DistributionMetricTypes = map[MetricType]struct{}{ DistributionType: {}, } )
DistributionMetricTypes contains the MetricTypes that are used for percentiles
Functions ¶
func EnrichTags ¶
func EnrichTags(tb *util.TagsBuilder, originID string, k8sOriginID string, cardinality string)
EnrichTags expend a tag list with origin detection tags
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 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) error
AddSample add a sample to the current ContextMetrics and initialize a new metrics if needed.
func (ContextMetrics) Flush ¶
func (m ContextMetrics) Flush(timestamp float64) ([]*Serie, map[ckey.ContextKey]error)
Flush flushes every metrics in the ContextMetrics. Returns the slice of Series and a map of errors by context key.
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 Event ¶
type Event struct { Title string `json:"msgTitle"` Text string `json:"msgText"` Ts int64 `json:"timestamp"` Priority EventPriority `json:"priority,omitempty"` Host string `json:"host"` Tags []string `json:"tags,omitempty"` AlertType EventAlertType `json:"alertType,omitempty"` AggregationKey string `json:"aggregationKey,omitempty"` SourceTypeName string `json:"sourceTypeName,omitempty"` EventType string `json:"eventType,omitempty"` OriginID string `json:"-"` K8sOriginID string `json:"-"` Cardinality string `json:"-"` }
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
func (Events) MarshalSplitCompress ¶
func (events Events) MarshalSplitCompress(bufferContext *marshaler.BufferContext) ([]*[]byte, error)
MarshalSplitCompress not implemented
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 HistogramBucket ¶
type HistogramBucket struct { Name string Value int64 LowerBound float64 UpperBound float64 Monotonic bool Tags []string Host string Timestamp float64 }
HistogramBucket represents a prometheus/openmetrics histogram bucket
func (*HistogramBucket) GetHost ¶
func (m *HistogramBucket) GetHost() string
GetHost returns the bucket host
func (*HistogramBucket) GetName ¶
func (m *HistogramBucket) GetName() string
GetName returns the bucket name
func (*HistogramBucket) GetTags ¶
func (m *HistogramBucket) GetTags(tb *util.TagsBuilder)
GetTags returns the bucket tags.
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 FlushFirstValue bool OriginID string K8sOriginID string Cardinality string }
MetricSample represents a raw metric sample
func (*MetricSample) Copy ¶
func (m *MetricSample) Copy() *MetricSample
Copy returns a deep copy of the m MetricSample
func (*MetricSample) GetHost ¶
func (m *MetricSample) GetHost() string
GetHost returns the metric sample host
func (*MetricSample) GetName ¶
func (m *MetricSample) GetName() string
GetName returns the metric sample name
func (*MetricSample) GetTags ¶
func (m *MetricSample) GetTags(tb *util.TagsBuilder)
GetTags returns the metric sample tags
type MetricSampleContext ¶
type MetricSampleContext interface { GetName() string GetHost() string GetTags(*util.TagsBuilder) }
MetricSampleContext allows to access a sample context data
type MetricSamplePool ¶
type MetricSamplePool struct {
// contains filtered or unexported fields
}
MetricSamplePool is a pool of metrics sample
func NewMetricSamplePool ¶
func NewMetricSamplePool(batchSize int) *MetricSamplePool
NewMetricSamplePool creates a new MetricSamplePool
func (*MetricSamplePool) GetBatch ¶
func (m *MetricSamplePool) GetBatch() []MetricSample
GetBatch gets a batch of metric samples from the pool
func (*MetricSamplePool) PutBatch ¶
func (m *MetricSamplePool) PutBatch(batch []MetricSample)
PutBatch puts a batch back into the pool
type MetricType ¶
type MetricType int
MetricType is the representation of an aggregator metric type
const ( GaugeType MetricType = iota // gauge RateType // rage ? CountType // count ? MonotonicCountType // ? CounterType // counter ? HistogramType // histogram HistorateType // ? SetType // ? DistributionType // quantile )
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 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 Note: it is not used with jsoniter, encodePoints takes over
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:"sourceTypeName,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) DescribeItem ¶
DescribeItem returns a text description for logs
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
func (Series) MarshalSplitCompress ¶
func (series Series) MarshalSplitCompress(bufferContext *marshaler.BufferContext) ([]*[]byte, error)
MarshalSplitCompress not implemented
func (Series) MarshalStrings ¶
MarshalStrings converts the timeseries to a sorted slice of string slices
func (Series) SplitPayload ¶
SplitPayload breaks the payload into, at least, "times" number of pieces
func (Series) WriteFooter ¶
WriteFooter prints the payload footer for this type
func (Series) WriteHeader ¶
WriteHeader writes the payload header for this type
type ServiceCheck ¶
type ServiceCheck struct { CheckName string `json:"check"` Host string `json:"hostName"` Ts int64 `json:"timestamp"` Status ServiceCheckStatus `json:"status"` Message string `json:"message"` Tags []string `json:"tags"` OriginID string `json:"-"` K8sOriginID string `json:"-"` Cardinality string `json:"-"` }
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) DescribeItem ¶
func (sc ServiceChecks) DescribeItem(i int) string
DescribeItem returns a text description for logs
func (ServiceChecks) Len ¶
func (sc ServiceChecks) Len() int
Len returns the number of items to marshal
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) MarshalSplitCompress ¶
func (sc ServiceChecks) MarshalSplitCompress(bufferContext *marshaler.BufferContext) ([]*[]byte, error)
MarshalSplitCompress not implemented
func (ServiceChecks) MarshalStrings ¶
func (sc ServiceChecks) MarshalStrings() ([]string, [][]string)
MarshalStrings converts the service checks to a sorted slice of string slices
func (ServiceChecks) SplitPayload ¶
func (sc ServiceChecks) SplitPayload(times int) ([]marshaler.Marshaler, error)
SplitPayload breaks the payload into times number of pieces
func (ServiceChecks) WriteFooter ¶
func (sc ServiceChecks) WriteFooter(stream *jsoniter.Stream) error
WriteFooter prints the payload footer for this type
func (ServiceChecks) WriteHeader ¶
func (sc ServiceChecks) WriteHeader(stream *jsoniter.Stream) error
WriteHeader writes the payload header for this type
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
Set tracks the number of unique elements in a set. They are only use by DogStatsD
type SketchPoint ¶
A SketchPoint represents a quantile sketch at a specific time
type SketchSeries ¶
type SketchSeries struct { Name string `json:"metric"` Tags []string `json:"tags"` Host string `json:"host"` Interval int64 `json:"interval"` Points []SketchPoint `json:"points"` ContextKey ckey.ContextKey `json:"-"` }
A SketchSeries is a timeseries of quantile sketches.
type SketchSeriesList ¶
type SketchSeriesList []SketchSeries
A SketchSeriesList implements marshaler.Marshaler
func (SketchSeriesList) Marshal ¶
func (sl SketchSeriesList) Marshal() ([]byte, error)
Marshal encodes this series list.
func (SketchSeriesList) MarshalJSON ¶
func (sl SketchSeriesList) MarshalJSON() ([]byte, error)
MarshalJSON serializes sketch series to JSON. Quite slow, but hopefully this method is called only in the `agent check` command
func (SketchSeriesList) MarshalSplitCompress ¶
func (sl SketchSeriesList) MarshalSplitCompress(bufferContext *marshaler.BufferContext) ([]*[]byte, error)
MarshalSplitCompress uses the stream compressor to marshal and compress sketch series payloads. If a compressed payload is larger than the max, a new payload will be generated. This method returns a slice of compressed protobuf marshaled gogen.SketchPayload objects. gogen.SketchPayload is not directly marshaled - instead it's contents are marshaled individually, packed with the appropriate protobuf metadata, and compressed in stream. The resulting payloads (when decompressed) are binary equal to the result of marshaling the whole object at once.
func (SketchSeriesList) SplitPayload ¶
func (sl SketchSeriesList) SplitPayload(times int) ([]marshaler.Marshaler, error)
SplitPayload breaks the payload into times number of pieces