metrics

package
v0.52.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package metrics provides a set of functions to Marshal and Unmarshal metric events.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Events

type Events struct {
	EventsArr []*event.Event
	Hostname  string
}

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) Marshal

func (events Events) Marshal() ([]byte, error)

Marshal serialize events using agent-payload definition

func (Events) MarshalJSON

func (events Events) MarshalJSON() ([]byte, error)

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) MarshalJSON

func (series *IterableSeries) MarshalJSON() ([]byte, error)

MarshalJSON serializes timeseries to JSON so it can be sent to V1 endpoints FIXME(maxime): to be removed when v2 endpoints are available

func (*IterableSeries) MarshalSplitCompress

func (series *IterableSeries) MarshalSplitCompress(bufferContext *marshaler.BufferContext, config config.Component) (transaction.BytesPayloads, error)

MarshalSplitCompress uses the stream compressor to marshal and compress 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 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) SplitPayload

func (series *IterableSeries) SplitPayload(times int) ([]marshaler.AbstractMarshaler, error)

SplitPayload breaks the payload into, at least, "times" number of pieces

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 Series

type Series []*metrics.Serie

Series represents a list of metrics.Serie ready to be serialize

func (Series) MarshalJSON

func (series Series) MarshalJSON() ([]byte, error)

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) SplitPayload

func (series Series) SplitPayload(times int) ([]marshaler.AbstractMarshaler, error)

SplitPayload breaks the payload into, at least, "times" number of pieces

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) 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.AbstractMarshaler, error)

SplitPayload breaks the payload into times number of pieces

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

func (ServiceChecks) WriteItem

func (sc ServiceChecks) WriteItem(stream *jsoniter.Stream, i int) error

WriteItem writes the json representation of an item

type SketchSeriesList

type SketchSeriesList struct {
	metrics.SketchesSource
}

A SketchSeriesList implements marshaler.Marshaler

func (SketchSeriesList) Marshal

func (sl SketchSeriesList) Marshal() ([]byte, error)

Marshal encodes this series list.

func (SketchSeriesList) MarshalSplitCompress

func (sl SketchSeriesList) MarshalSplitCompress(bufferContext *marshaler.BufferContext, config config.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) SplitPayload

func (sl SketchSeriesList) SplitPayload(times int) ([]marshaler.AbstractMarshaler, error)

SplitPayload breaks the payload into times number of pieces

type SketchSeriesSlice

type SketchSeriesSlice []*metrics.SketchSeries

func (SketchSeriesSlice) SplitPayload

func (sl SketchSeriesSlice) SplitPayload(times int) ([]marshaler.AbstractMarshaler, error)

SplitPayload breaks the payload into times number of pieces

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL