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 AllowAllFilter
- type Filter
- type Filterable
- type IterableSeries
- func (series *IterableSeries) DescribeCurrentItem() string
- func (series *IterableSeries) GetCurrentItemPointCount() int
- func (series *IterableSeries) MarshalSplitCompressPipelines(config config.Component, strategy compression.Component, pipelines PipelineSet) 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 MapFilter
- type PayloadsBuilder
- type PipelineConfig
- type PipelineContext
- type PipelineDestination
- type PipelineSet
- type ServiceChecks
- type SketchSeriesList
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 AllowAllFilter ¶ added in v0.74.0
type AllowAllFilter struct{}
AllowAllFilter admits all metrics into the payload.
func (AllowAllFilter) Filter ¶ added in v0.74.0
func (nf AllowAllFilter) Filter(_ Filterable) bool
Filter implements Filter interface.
type Filter ¶ added in v0.74.0
type Filter interface {
// Filter returns true when metric should be added to the payload.
Filter(Filterable) bool
}
Filter can decide if metric should be included in a payload or not.
type Filterable ¶ added in v0.72.0
type Filterable interface {
GetName() string
}
Filterable defines the minimal interface needed for pipeline filtering. Both Series and SketchSeries implement this interface.
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 PipelineSet) 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, pipelineConfig PipelineConfig, pipelineContext *PipelineContext, ) (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 MapFilter ¶ added in v0.74.0
type MapFilter struct {
// contains filtered or unexported fields
}
MapFilter admits only metrics whose name is present in the map.
func NewMapFilter ¶ added in v0.74.0
NewMapFilter creates a new filter using the supplied map.
The map is not copied and is shared with the filter.
func (MapFilter) Filter ¶ added in v0.74.0
func (mf MapFilter) Filter(f Filterable) bool
Filter implements Filter interface.
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 PipelineConfig ¶ added in v0.74.0
PipelineConfig contains properties that determine how a payload is built.
Put here everything that makes a payload different from other payloads. Conversly, if it doesn't change bytes of the payload, it doesn't belong here.
This type must be comparable.
type PipelineContext ¶ added in v0.74.0
type PipelineContext struct {
Destinations []PipelineDestination
// contains filtered or unexported fields
}
PipelineContext holds information needed during and after pipeline execution.
type PipelineDestination ¶ added in v0.74.0
type PipelineDestination struct {
Resolver resolver.DomainResolver
Endpoint transaction.Endpoint
AddValidationHeaders bool
}
PipelineDestination describes how to deliver a payload to the intake.
type PipelineSet ¶ added in v0.74.0
type PipelineSet map[PipelineConfig]*PipelineContext
PipelineSet is a collection of pipelines, mapping unique descriptors to their contexts.
func (PipelineSet) Add ¶ added in v0.74.0
func (ps PipelineSet) Add(conf PipelineConfig, dest PipelineDestination)
Add adds a resolver to a pipeline with matching configuration or creates a new one.
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) MarshalSplitCompressPipelines ¶ added in v0.72.0
func (sl SketchSeriesList) MarshalSplitCompressPipelines(config config.Component, strategy compression.Component, pipelines PipelineSet, logger log.Component) error
MarshalSplitCompressPipelines uses the stream compressor to marshal and compress sketch series payloads across multiple pipelines. Each pipeline defines a filter function and destination, enabling selective routing of sketches to different endpoints.