sample

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OTLPLogFrom

func OTLPLogFrom(logRecord plog.LogRecord) any

func OTLPLogToSampleType

func OTLPLogToSampleType[T OTLPLog]() control.SampleType

func Range

func Range(otlpLogs OTLPLogs, fn func(resource, sampler string, otlpLog interface{}))

Range iterates over the logs and runs the callback for each log. Logs added to the SamplerOTLPLogs after this function is called will not be visited.

func RangeSamplerLogs

func RangeSamplerLogs(samplerOtlpLogs SamplerOTLPLogs, fn func(otlpLog interface{}))

RangeSamplerLogs iterates over the logs and runs the callback for each log. Logs added to the SamplerOTLPLogs after this function is called will not be visited

func RangeSamplerLogsWithType

func RangeSamplerLogsWithType[T OTLPLog](samplerOtlpLogs SamplerOTLPLogs, fn func(otlpLog T))

func RangeSamplers

func RangeSamplers(otlpLogs OTLPLogs, fn func(resource, sampler string, samplerLogs SamplerOTLPLogs))

RangeSamplers iterates over the samplers and runs the callback for each one. Samplers added to the OTLPLogs after this function is called will not be visited

func RangeWithType

func RangeWithType[T OTLPLog](otlpLogs OTLPLogs, fn func(resource, sampler string, otlpLog T))

Range iterates over the logs and runs the callback for each log record that matches the type provided. Logs added to the SamplerOTLPLogs after this function is called will not be visited.

Types

type ConfigOTLPLog

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

ConfigOTLPLog implementation

func ConfigOTLPLogFrom

func ConfigOTLPLogFrom(logRecord plog.LogRecord) ConfigOTLPLog

func (ConfigOTLPLog) Record

func (b ConfigOTLPLog) Record() plog.LogRecord

func (ConfigOTLPLog) SampleData

func (b ConfigOTLPLog) SampleData() (*data.Data, error)

func (ConfigOTLPLog) SampleEncoding

func (b ConfigOTLPLog) SampleEncoding() Encoding

func (ConfigOTLPLog) SampleKey

func (b ConfigOTLPLog) SampleKey() string

func (ConfigOTLPLog) SampleRawData

func (b ConfigOTLPLog) SampleRawData() []byte

func (ConfigOTLPLog) SampleType

func (b ConfigOTLPLog) SampleType() control.SampleType

func (ConfigOTLPLog) SetSampleKey

func (b ConfigOTLPLog) SetSampleKey(key string)

func (ConfigOTLPLog) SetSampleRawData

func (b ConfigOTLPLog) SetSampleRawData(encoding Encoding, data []byte)

func (ConfigOTLPLog) SetStreams

func (b ConfigOTLPLog) SetStreams(streams []control.SamplerStreamUID)

func (ConfigOTLPLog) SetTimestamp

func (b ConfigOTLPLog) SetTimestamp(ts time.Time)

func (ConfigOTLPLog) Streams

func (b ConfigOTLPLog) Streams() []control.SamplerStreamUID

func (ConfigOTLPLog) StreamsStr

func (b ConfigOTLPLog) StreamsStr() []string

func (ConfigOTLPLog) Timestamp

func (b ConfigOTLPLog) Timestamp() time.Time

type Encoding

type Encoding uint8
const (
	UnknownEncoding Encoding = iota
	JSONEncoding
)

func ParseSampleEncoding

func ParseSampleEncoding(enc string) Encoding

func (Encoding) String

func (s Encoding) String() string

type EventOTLPLog

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

EventOTLPLog implementation

func EventOTLPLogFrom

func EventOTLPLogFrom(logRecord plog.LogRecord) EventOTLPLog

func (EventOTLPLog) Record

func (b EventOTLPLog) Record() plog.LogRecord

func (EventOTLPLog) RuleExpression

func (e EventOTLPLog) RuleExpression() string

func (EventOTLPLog) SampleData

func (b EventOTLPLog) SampleData() (*data.Data, error)

func (EventOTLPLog) SampleEncoding

func (b EventOTLPLog) SampleEncoding() Encoding

func (EventOTLPLog) SampleKey

func (b EventOTLPLog) SampleKey() string

func (EventOTLPLog) SampleRawData

func (b EventOTLPLog) SampleRawData() []byte

func (EventOTLPLog) SampleType

func (b EventOTLPLog) SampleType() control.SampleType

func (EventOTLPLog) SetRuleExpression

func (e EventOTLPLog) SetRuleExpression(ruleExpression string)

func (EventOTLPLog) SetSampleKey

func (b EventOTLPLog) SetSampleKey(key string)

func (EventOTLPLog) SetSampleRawData

func (b EventOTLPLog) SetSampleRawData(encoding Encoding, data []byte)

func (EventOTLPLog) SetStreams

func (b EventOTLPLog) SetStreams(streams []control.SamplerStreamUID)

func (EventOTLPLog) SetTimestamp

func (b EventOTLPLog) SetTimestamp(ts time.Time)

func (EventOTLPLog) SetUID

func (e EventOTLPLog) SetUID(uid control.SamplerEventUID)

func (EventOTLPLog) Streams

func (b EventOTLPLog) Streams() []control.SamplerStreamUID

func (EventOTLPLog) StreamsStr

func (b EventOTLPLog) StreamsStr() []string

func (EventOTLPLog) Timestamp

func (b EventOTLPLog) Timestamp() time.Time

func (EventOTLPLog) UID

type MetadataKey

type MetadataKey string
const (
	EventUID  MetadataKey = "event_uid"
	EventRule MetadataKey = "event_rule"
	DigestUID MetadataKey = "digest_uid"
)

type OTLPLogs

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

func NewOTLPLogs

func NewOTLPLogs() OTLPLogs

func OTLPLogsFrom

func OTLPLogsFrom(plogs plog.Logs) OTLPLogs

func (*OTLPLogs) AppendSamplerOTLPLogs

func (l *OTLPLogs) AppendSamplerOTLPLogs(resource string, sampler string) SamplerOTLPLogs

func (OTLPLogs) Len

func (l OTLPLogs) Len() int

func (OTLPLogs) Logs

func (l OTLPLogs) Logs() plog.Logs

func (OTLPLogs) MoveAndAppendTo

func (l OTLPLogs) MoveAndAppendTo(dest OTLPLogs)

func (OTLPLogs) RemoveOTLPLogIf

func (l OTLPLogs) RemoveOTLPLogIf(f func(otlpLog any) bool)

RemoveOTLPLogIf calls f sequentially for each element present in the otlp logs. f receives an interface containing a RawSampleOTLPLog, EventOTLPLog, etc. If f returns true, the element is removed from otlp logs.

type RawSampleOTLPLog

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

RawSampleOTLPLog implementation

func RawSampleOTLPLogFrom

func RawSampleOTLPLogFrom(logRecord plog.LogRecord) RawSampleOTLPLog

func (RawSampleOTLPLog) Record

func (b RawSampleOTLPLog) Record() plog.LogRecord

func (RawSampleOTLPLog) SampleData

func (b RawSampleOTLPLog) SampleData() (*data.Data, error)

func (RawSampleOTLPLog) SampleEncoding

func (b RawSampleOTLPLog) SampleEncoding() Encoding

func (RawSampleOTLPLog) SampleKey

func (b RawSampleOTLPLog) SampleKey() string

func (RawSampleOTLPLog) SampleRawData

func (b RawSampleOTLPLog) SampleRawData() []byte

func (RawSampleOTLPLog) SampleType

func (b RawSampleOTLPLog) SampleType() control.SampleType

func (RawSampleOTLPLog) SetSampleKey

func (b RawSampleOTLPLog) SetSampleKey(key string)

func (RawSampleOTLPLog) SetSampleRawData

func (b RawSampleOTLPLog) SetSampleRawData(encoding Encoding, data []byte)

func (RawSampleOTLPLog) SetStreams

func (b RawSampleOTLPLog) SetStreams(streams []control.SamplerStreamUID)

func (RawSampleOTLPLog) SetTimestamp

func (b RawSampleOTLPLog) SetTimestamp(ts time.Time)

func (RawSampleOTLPLog) Streams

func (b RawSampleOTLPLog) Streams() []control.SamplerStreamUID

func (RawSampleOTLPLog) StreamsStr

func (b RawSampleOTLPLog) StreamsStr() []string

func (RawSampleOTLPLog) Timestamp

func (b RawSampleOTLPLog) Timestamp() time.Time

type Sample

type Sample struct {
	Ts       time.Time
	Type     control.SampleType
	Streams  []control.SamplerStreamUID
	Encoding Encoding
	Key      string
	Data     []byte
	Metadata map[MetadataKey]string
}

Sample defines a sample to be exported

type SamplerOTLPLogs

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

func (SamplerOTLPLogs) AppendConfigOTLPLog

func (s SamplerOTLPLogs) AppendConfigOTLPLog() ConfigOTLPLog

func (SamplerOTLPLogs) AppendEventOTLPLog

func (s SamplerOTLPLogs) AppendEventOTLPLog() EventOTLPLog

func (SamplerOTLPLogs) AppendRawSampleOTLPLog

func (s SamplerOTLPLogs) AppendRawSampleOTLPLog() RawSampleOTLPLog

func (*SamplerOTLPLogs) AppendStructDigestOTLPLog

func (s *SamplerOTLPLogs) AppendStructDigestOTLPLog() StructDigestOTLPLog

func (SamplerOTLPLogs) AppendValueDigestOTLPLog

func (s SamplerOTLPLogs) AppendValueDigestOTLPLog() ValueDigestOTLPLog

func (SamplerOTLPLogs) MoveAndAppendTo

func (s SamplerOTLPLogs) MoveAndAppendTo(dest SamplerOTLPLogs)

type SamplerSamples

type SamplerSamples struct {
	ResourceName string
	SamplerName  string
	Samples      []Sample
}

SamplerSamples contains a group of samples that originate from the same resource e.g. operator, service...

type StructDigestOTLPLog

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

StructDigestOTLPLog implementation

func StructDigestOTLPLogFrom

func StructDigestOTLPLogFrom(logRecord plog.LogRecord) StructDigestOTLPLog

func (StructDigestOTLPLog) Record

func (b StructDigestOTLPLog) Record() plog.LogRecord

func (StructDigestOTLPLog) SampleData

func (b StructDigestOTLPLog) SampleData() (*data.Data, error)

func (StructDigestOTLPLog) SampleEncoding

func (b StructDigestOTLPLog) SampleEncoding() Encoding

func (StructDigestOTLPLog) SampleKey

func (b StructDigestOTLPLog) SampleKey() string

func (StructDigestOTLPLog) SampleRawData

func (b StructDigestOTLPLog) SampleRawData() []byte

func (StructDigestOTLPLog) SampleType

func (b StructDigestOTLPLog) SampleType() control.SampleType

func (StructDigestOTLPLog) SetSampleKey

func (b StructDigestOTLPLog) SetSampleKey(key string)

func (StructDigestOTLPLog) SetSampleRawData

func (b StructDigestOTLPLog) SetSampleRawData(encoding Encoding, data []byte)

func (StructDigestOTLPLog) SetStreams

func (b StructDigestOTLPLog) SetStreams(streams []control.SamplerStreamUID)

func (StructDigestOTLPLog) SetTimestamp

func (b StructDigestOTLPLog) SetTimestamp(ts time.Time)

func (StructDigestOTLPLog) SetUID

func (StructDigestOTLPLog) Streams

func (b StructDigestOTLPLog) Streams() []control.SamplerStreamUID

func (StructDigestOTLPLog) StreamsStr

func (b StructDigestOTLPLog) StreamsStr() []string

func (StructDigestOTLPLog) Timestamp

func (b StructDigestOTLPLog) Timestamp() time.Time

func (StructDigestOTLPLog) UID

type ValueDigestOTLPLog

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

ValueDigestOTLPLog implementation

func ValueDigestOTLPLogFrom

func ValueDigestOTLPLogFrom(logRecord plog.LogRecord) ValueDigestOTLPLog

func (ValueDigestOTLPLog) Record

func (b ValueDigestOTLPLog) Record() plog.LogRecord

func (ValueDigestOTLPLog) SampleData

func (b ValueDigestOTLPLog) SampleData() (*data.Data, error)

func (ValueDigestOTLPLog) SampleEncoding

func (b ValueDigestOTLPLog) SampleEncoding() Encoding

func (ValueDigestOTLPLog) SampleKey

func (b ValueDigestOTLPLog) SampleKey() string

func (ValueDigestOTLPLog) SampleRawData

func (b ValueDigestOTLPLog) SampleRawData() []byte

func (ValueDigestOTLPLog) SampleType

func (b ValueDigestOTLPLog) SampleType() control.SampleType

func (ValueDigestOTLPLog) SetSampleKey

func (b ValueDigestOTLPLog) SetSampleKey(key string)

func (ValueDigestOTLPLog) SetSampleRawData

func (b ValueDigestOTLPLog) SetSampleRawData(encoding Encoding, data []byte)

func (ValueDigestOTLPLog) SetStreams

func (b ValueDigestOTLPLog) SetStreams(streams []control.SamplerStreamUID)

func (ValueDigestOTLPLog) SetTimestamp

func (b ValueDigestOTLPLog) SetTimestamp(ts time.Time)

func (ValueDigestOTLPLog) SetUID

func (ValueDigestOTLPLog) Streams

func (b ValueDigestOTLPLog) Streams() []control.SamplerStreamUID

func (ValueDigestOTLPLog) StreamsStr

func (b ValueDigestOTLPLog) StreamsStr() []string

func (ValueDigestOTLPLog) Timestamp

func (b ValueDigestOTLPLog) Timestamp() time.Time

func (ValueDigestOTLPLog) UID

Jump to

Keyboard shortcuts

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