Documentation
¶
Overview ¶
Package metrics provides a set of functions to Marshal and Unmarshal metric events.
Index ¶
- func MarshalEvents(events event.Events, hostname string, config config.Component, ...) ([]*transaction.BytesPayload, error)
- type Events
- type IterableSeries
- func (series *IterableSeries) DescribeCurrentItem() string
- func (series *IterableSeries) GetCurrentItemPointCount() int
- func (series *IterableSeries) MarshalSplitCompressPipelines(config config.Component, strategy compression.Component, pipelines []Pipeline) (transaction.BytesPayloads, error)
- func (series *IterableSeries) MoveNext() bool
- func (series *IterableSeries) NewPayloadsBuilder(bufferContext *marshaler.BufferContext, config config.Component, ...) (PayloadsBuilder, error)
- func (series *IterableSeries) WriteCurrentItem(stream *jsoniter.Stream) error
- func (series *IterableSeries) WriteFooter(stream *jsoniter.Stream) error
- func (series *IterableSeries) WriteHeader(stream *jsoniter.Stream) error
- type PayloadsBuilder
- type Pipeline
- type ServiceChecks
- type SketchSeriesList
- func (sl SketchSeriesList) MarshalSplitCompress(bufferContext *marshaler.BufferContext, config config.Component, ...) (transaction.BytesPayloads, error)
- func (sl SketchSeriesList) MarshalSplitCompressMultiple(config config.Component, strategy compression.Component, ...) (transaction.BytesPayloads, transaction.BytesPayloads, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalEvents ¶ added in v0.70.0
func MarshalEvents( events event.Events, hostname string, config config.Component, logger log.Component, compression compression.Component, ) ([]*transaction.BytesPayload, error)
MarshalEvents serializes an array of events into one or more compressed intake payloads.
Types ¶
type Events ¶
Events represents a list of events ready to be serialize
func (Events) CreateMarshalersBySourceType ¶
func (events Events) CreateMarshalersBySourceType() []marshaler.StreamJSONMarshaler
CreateMarshalersBySourceType creates a collection of marshaler.StreamJSONMarshaler. Each StreamJSONMarshaler is composed of all events for a specific source type name.
func (Events) CreateSingleMarshaler ¶
func (events Events) CreateSingleMarshaler() marshaler.StreamJSONMarshaler
CreateSingleMarshaler creates marshaler.StreamJSONMarshaler where each item is composed of all events for a specific source type name.
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) SplitPayload ¶
func (events Events) SplitPayload(times int) ([]marshaler.AbstractMarshaler, error)
SplitPayload breaks the payload into times number of pieces
type IterableSeries ¶
type IterableSeries struct {
// contains filtered or unexported fields
}
IterableSeries is a serializer for metrics.IterableSeries
func CreateIterableSeries ¶
func CreateIterableSeries(source metrics.SerieSource) *IterableSeries
CreateIterableSeries creates a new instance of *IterableSeries
func (*IterableSeries) DescribeCurrentItem ¶
func (series *IterableSeries) DescribeCurrentItem() string
DescribeCurrentItem returns a text description for logs
func (*IterableSeries) GetCurrentItemPointCount ¶
func (series *IterableSeries) GetCurrentItemPointCount() int
GetCurrentItemPointCount gets the number of points in the current serie
func (*IterableSeries) MarshalSplitCompressPipelines ¶ added in v0.70.0
func (series *IterableSeries) MarshalSplitCompressPipelines(config config.Component, strategy compression.Component, pipelines []Pipeline) (transaction.BytesPayloads, error)
MarshalSplitCompressPipelines uses the stream compressor to marshal and compress series payloads, allowing multiple variants to be generated in a single pass over the input data. If a compressed payload is larger than the max, a new payload will be generated. This method returns a slice of compressed protobuf marshaled MetricPayload objects.
func (*IterableSeries) MoveNext ¶
func (series *IterableSeries) MoveNext() bool
MoveNext moves to the next item. This function skips the series when `NoIndex` is set at true as `NoIndex` is only supported by `MarshalSplitCompress`.
func (*IterableSeries) NewPayloadsBuilder ¶ added in v0.56.0
func (series *IterableSeries) NewPayloadsBuilder(bufferContext *marshaler.BufferContext, config config.Component, strategy compression.Component) (PayloadsBuilder, error)
NewPayloadsBuilder initializes a new PayloadsBuilder to be used for serializing series into a set of output payloads.
func (*IterableSeries) WriteCurrentItem ¶
func (series *IterableSeries) WriteCurrentItem(stream *jsoniter.Stream) error
WriteCurrentItem writes the json representation of an item
func (*IterableSeries) WriteFooter ¶
func (series *IterableSeries) WriteFooter(stream *jsoniter.Stream) error
WriteFooter writes the payload footer for this type
func (*IterableSeries) WriteHeader ¶
func (series *IterableSeries) WriteHeader(stream *jsoniter.Stream) error
WriteHeader writes the payload header for this type
type PayloadsBuilder ¶ added in v0.56.0
type PayloadsBuilder struct {
// contains filtered or unexported fields
}
PayloadsBuilder represents an in-progress serialization of a series into potentially multiple payloads.
type Pipeline ¶ added in v0.70.0
type Pipeline struct { FilterFunc func(s *metrics.Serie) bool Destination transaction.Destination }
Pipeline represents a data processing pipeline that filters series and marks them for a specific destination
type ServiceChecks ¶
type ServiceChecks []*servicecheck.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) WriteFooter ¶
func (sc ServiceChecks) WriteFooter(stream *jsoniter.Stream) error
WriteFooter writes 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 SketchSeriesList ¶
type SketchSeriesList struct {
metrics.SketchesSource
}
A SketchSeriesList implements marshaler.Marshaler
func (SketchSeriesList) MarshalSplitCompress ¶
func (sl SketchSeriesList) MarshalSplitCompress(bufferContext *marshaler.BufferContext, config config.Component, strategy compression.Component, logger log.Component) (transaction.BytesPayloads, 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) MarshalSplitCompressMultiple ¶ added in v0.56.0
func (sl SketchSeriesList) MarshalSplitCompressMultiple(config config.Component, strategy compression.Component, filterFunc func(ss *metrics.SketchSeries) bool, logger log.Component) (transaction.BytesPayloads, transaction.BytesPayloads, error)
MarshalSplitCompressMultiple uses the stream compressor to marshal and compress one sketch list into two sets of payloads. One set of payloads contains all metrics, and the other contains only those that pass the provided filter function. This function exists because we need a way to build both payloads in a single pass over the input data, which cannot be iterated over twice.