snapshot

package
v1.51.0 Latest Latest
Warning

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

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

Documentation

Overview

Package snapshot defines contract for collecting snapshots as well as helper structures

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogBuffer

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

LogBuffer is a buffer for plog.Logs

func NewLogBuffer

func NewLogBuffer(idealSize int) *LogBuffer

NewLogBuffer creates a logBuffer with the ideal size set

func (*LogBuffer) Add

func (l *LogBuffer) Add(ld plog.Logs)

Add adds the new log payload and adjust buffer to keep ideal size

func (*LogBuffer) ConstructPayload

func (l *LogBuffer) ConstructPayload(searchQuery *string, minimumTimestamp *time.Time) ([]byte, error)

ConstructPayload condenses the buffer and serializes to protobuf

func (*LogBuffer) Len

func (l *LogBuffer) Len() int

Len counts the number of log records in all Log payloads in buffer

type MetricBuffer

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

MetricBuffer is a buffer for pmetric.Metrics

func NewMetricBuffer

func NewMetricBuffer(idealSize int) *MetricBuffer

NewMetricBuffer creates a metricBuffer with the ideal size set

func (*MetricBuffer) Add

func (l *MetricBuffer) Add(md pmetric.Metrics)

Add adds the new metric payload and adjust buffer to keep ideal size

func (*MetricBuffer) ConstructPayload

func (l *MetricBuffer) ConstructPayload(searchQuery *string, minimumTimestamp *time.Time) ([]byte, error)

ConstructPayload condenses the buffer and serializes to protobuf

func (*MetricBuffer) Len

func (l *MetricBuffer) Len() int

Len counts the number of data points in all Metric payloads in buffer

type Snapshotter

type Snapshotter interface {
	// SaveLogs saves off logs in a snapshot
	SaveLogs(componentID string, ld plog.Logs)

	// SaveTraces saves off traces in a snapshot
	SaveTraces(componentID string, td ptrace.Traces)

	// SaveMetrics saves off metrics in a snapshot
	SaveMetrics(componentID string, md pmetric.Metrics)
}

Snapshotter represents an interface to save logs, metrics, and traces for snapshots

//go:generate mockery --name Snapshotter --filename mock_snapshotter.go --structname MockSnapshotter No go generate for this as it requires internal otel structures that don't import correctly with mockery. Can uncomment above and run then modify by hand.

type TraceBuffer

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

TraceBuffer is a buffer for ptrace.Traces

func NewTraceBuffer

func NewTraceBuffer(idealSize int) *TraceBuffer

NewTraceBuffer creates a traceBuffer with the ideal size set

func (*TraceBuffer) Add

func (l *TraceBuffer) Add(td ptrace.Traces)

Add adds the new trace payload and adjust buffer to keep ideal size

func (*TraceBuffer) ConstructPayload

func (l *TraceBuffer) ConstructPayload(searchQuery *string, minimumTimestamp *time.Time) ([]byte, error)

ConstructPayload condenses the buffer and serializes to protobuf

func (*TraceBuffer) Len

func (l *TraceBuffer) Len() int

Len counts the number of spans in all Traces payloads in buffer

Directories

Path Synopsis
Package mocks contains mocks for snapshot interfaces
Package mocks contains mocks for snapshot interfaces

Jump to

Keyboard shortcuts

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