serializer

package
v0.0.0-...-44638ef Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

README

package serializer

The Serializer is in charge of routing payloads from the different parts of the agent to the Forwarder. The backend currently offers 2 versions of the intake API. The V1 version takes JSON payloads, the V2 take protocol buffer payloads or JSON depending on endpoint.

While moving all the existing endpoints to the new format, the agent will support both API. That is why the serializer is here to choose a serialization protocol depending on the content and use the correct Forwarder method.

To be sent, a payload needs to implement the Marshaler interface.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// AgentPayloadVersion is the versions of the agent-payload repository
	// used to serialize to protobuf
	AgentPayloadVersion string
)

Functions

This section is empty.

Types

type AgentV1MockSerializer

type AgentV1MockSerializer struct {
	// contains filtered or unexported fields
}

AgentV1MockSerializer is a mock implementation of agent v1 serializer. USed for testing

func NewAgentV1MockSerializer

func NewAgentV1MockSerializer() AgentV1MockSerializer

NewAgentV1MockSerializer instantiate the agent v1 mock serializer

func (AgentV1MockSerializer) GetJSONToV1IntakeMessage

func (serializer AgentV1MockSerializer) GetJSONToV1IntakeMessage() interface{}

GetJSONToV1IntakeMessage gets message from the mock

func (AgentV1MockSerializer) SendJSONToV1Intake

func (serializer AgentV1MockSerializer) SendJSONToV1Intake(data interface{}) error

SendJSONToV1Intake publishes v1 agent data

type AgentV1Serializer

type AgentV1Serializer interface {
	SendJSONToV1Intake(data interface{}) error
}

AgentV1Serializer is a serializer for just agent v1 data

type EventsStreamJSONMarshaler

type EventsStreamJSONMarshaler interface {
	marshaler.Marshaler

	// Create a single marshaler.
	CreateSingleMarshaler() marshaler.StreamJSONMarshaler

	// If the single marshaler cannot serialize, use smaller marshalers.
	CreateMarshalersBySourceType() []marshaler.StreamJSONMarshaler
}

EventsStreamJSONMarshaler handles two serialization logics.

type MetricSerializer

type MetricSerializer interface {
	SendEvents(e EventsStreamJSONMarshaler) error
	SendServiceChecks(sc marshaler.StreamJSONMarshaler) error
	SendSeries(series marshaler.StreamJSONMarshaler) error
	SendSketch(sketches marshaler.Marshaler) error
	SendMetadata(m marshaler.JSONMarshaler) error
	SendHostMetadata(m marshaler.JSONMarshaler) error
	SendProcessesMetadata(data interface{}) error
	SendOrchestratorMetadata(msgs []ProcessMessageBody, hostName, clusterID string, payloadType int) error
	SendJSONToV1Intake(data interface{}) error // sts
}

MetricSerializer represents the interface of method needed by the aggregator to serialize its data

type ProcessMessageBody

type ProcessMessageBody = stubMessageBody

ProcessMessageBody is a type alias for processes proto message body this type alias allows to avoid importing the process agent payload proto in case it's not needed (dogstastd)

type Serializer

type Serializer struct {
	Forwarder forwarder.Forwarder
	// contains filtered or unexported fields
}

Serializer serializes metrics to the correct format and routes the payloads to the correct endpoint in the Forwarder

func NewSerializer

func NewSerializer(forwarder forwarder.Forwarder, orchestratorForwarder forwarder.Forwarder) *Serializer

NewSerializer returns a new Serializer initialized

func (*Serializer) SendAgentchecksMetadata

func (s *Serializer) SendAgentchecksMetadata(m marshaler.JSONMarshaler) error

SendAgentchecksMetadata serializes a metadata payload and sends it to the forwarder

func (*Serializer) SendEvents

func (s *Serializer) SendEvents(e EventsStreamJSONMarshaler) error

SendEvents serializes a list of event and sends the payload to the forwarder

func (*Serializer) SendHostMetadata

func (s *Serializer) SendHostMetadata(m marshaler.JSONMarshaler) error

SendHostMetadata serializes a metadata payload and sends it to the forwarder

func (*Serializer) SendJSONToV1Intake

func (s *Serializer) SendJSONToV1Intake(data interface{}) error

SendJSONToV1Intake serializes a payload and sends it to the forwarder. Used only by the legacy processes metadata collector. sts

func (*Serializer) SendMetadata

func (s *Serializer) SendMetadata(m marshaler.JSONMarshaler) error

SendMetadata serializes a metadata payload and sends it to the forwarder

func (*Serializer) SendOrchestratorMetadata

func (s *Serializer) SendOrchestratorMetadata(msgs []ProcessMessageBody, hostName, clusterID string, payloadType int) error

SendOrchestratorMetadata serializes & send orchestrator metadata payloads

func (*Serializer) SendProcessesMetadata

func (s *Serializer) SendProcessesMetadata(data interface{}) error

SendProcessesMetadata serializes a payload and sends it to the forwarder. Used only by the legacy processes metadata collector.

func (*Serializer) SendSeries

func (s *Serializer) SendSeries(series marshaler.StreamJSONMarshaler) error

SendSeries serializes a list of serviceChecks and sends the payload to the forwarder

func (*Serializer) SendServiceChecks

func (s *Serializer) SendServiceChecks(sc marshaler.StreamJSONMarshaler) error

SendServiceChecks serializes a list of serviceChecks and sends the payload to the forwarder

func (*Serializer) SendSketch

func (s *Serializer) SendSketch(sketches marshaler.Marshaler) error

SendSketch serializes a list of SketSeriesList and sends the payload to the forwarder

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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