adapter

package
v0.70.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2023 License: Apache-2.0 Imports: 44 Imported by: 26

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert

func Convert(ent *entry.Entry) plog.Logs

Convert converts one entry.Entry into plog.Logs. To be used in a stateless setting like tests where ease of use is more important than performance or throughput. Deprecated: [v0.68.0] Unnecessarily exported API. Please add a comment in https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/17429 if you use it.

func ConvertFrom

func ConvertFrom(pLogs plog.Logs) []*entry.Entry

ConvertFrom converts plog.Logs into a slice of entry.Entry To be used in a stateless setting like tests where ease of use is more important than performance or throughput. Deprecated: [v0.69.0] Unnecessarily exported API. Please add a comment in https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/17429 if you use it.

func GetStorageClient

func GetStorageClient(ctx context.Context, host component.Host, storageID *component.ID, componentID component.ID) (storage.Client, error)

func HashResource

func HashResource(resource map[string]interface{}) uint64

HashResource will hash an entry.Entry.Resource

func NewFactory

func NewFactory(logReceiverType LogReceiverType, sl component.StabilityLevel) rcvr.Factory

NewFactory creates a factory for a Stanza-based receiver

Types

type BaseConfig

type BaseConfig struct {
	Operators []operator.Config `mapstructure:"operators"`
	StorageID *component.ID     `mapstructure:"storage"`
}

BaseConfig is the common configuration of a stanza-based receiver

type Converter

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

Converter converts a batch of entry.Entry into plog.Logs aggregating translated entries into logs coming from the same Resource.

The diagram below illustrates the internal communication inside the Converter:

          ┌─────────────────────────────────┐
          │ Batch()                         │
┌─────────┤  Ingests batches of log entries │
│         │  and sends them onto workerChan │
│         └─────────────────────────────────┘
│
│ ┌───────────────────────────────────────────────────┐
├─► workerLoop()                                      │
│ │ ┌─────────────────────────────────────────────────┴─┐
├─┼─► workerLoop()                                      │
│ │ │ ┌─────────────────────────────────────────────────┴─┐
└─┼─┼─► workerLoop()                                      │
  └─┤ │   consumes sent log entries from workerChan,      │
    │ │   translates received entries to plog.LogRecords,│
    └─┤   hashes them to generate an ID, and sends them   │
      │   onto batchChan                                  │
      └─────────────────────────┬─────────────────────────┘
                                │
                                ▼
    ┌─────────────────────────────────────────────────────┐
    │ aggregationLoop()                                   │
    │   consumes from batchChan, aggregates log records   │
    │   by marshaled Resource and sends the               │
    │   aggregated buffer to flushChan                    │
    └───────────────────────────┬─────────────────────────┘
                                │
                                ▼
    ┌─────────────────────────────────────────────────────┐
    │ flushLoop()                                         │
    │   receives log records from flushChan and sends     │
    │   them onto pLogsChan which is consumed by          │
    │   downstream consumers via OutChannel()             │
    └─────────────────────────────────────────────────────┘

func NewConverter

func NewConverter(logger *zap.Logger) *Converter

func (*Converter) Batch

func (c *Converter) Batch(e []*entry.Entry) error

Batch takes in an entry.Entry and sends it to an available worker for processing.

func (*Converter) OutChannel

func (c *Converter) OutChannel() <-chan plog.Logs

OutChannel returns the channel on which converted entries will be sent to.

func (*Converter) Start

func (c *Converter) Start()

func (*Converter) Stop

func (c *Converter) Stop()

type FromPdataConverter

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

FromPdataConverter converts a set of entry.Entry into plog.Logs

The diagram below illustrates the internal communication inside the FromPdataConverter:

          ┌─────────────────────────────────┐
          │ Batch()                         │
┌─────────┤  Ingests plog.Logs, splits up   │
│         │  and places them on workerChan  │
│         └─────────────────────────────────┘
│
│ ┌───────────────────────────────────────────────────┐
├─► workerLoop()                                      │
│ │ ┌─────────────────────────────────────────────────┴─┐
├─┼─► workerLoop()                                      │
│ │ │ ┌─────────────────────────────────────────────────┴─┐
└─┼─┼─► workerLoop()                                      │
  └─┤ │   consumes sent log entries from workerChan,      │
    │ │   translates received logs to entry.Entry,        │
    └─┤   and sends them along entriesChan                │
      └───────────────────────────────────────────────────┘

func NewFromPdataConverter

func NewFromPdataConverter(workerCount int, logger *zap.Logger) *FromPdataConverter

func (*FromPdataConverter) Batch

func (c *FromPdataConverter) Batch(pLogs plog.Logs) error

Batch takes in an set of plog.Logs and sends it to an available worker for processing.

func (*FromPdataConverter) OutChannel

func (c *FromPdataConverter) OutChannel() <-chan []*entry.Entry

OutChannel returns the channel on which converted entries will be sent to.

func (*FromPdataConverter) Start

func (c *FromPdataConverter) Start()

func (*FromPdataConverter) Stop

func (c *FromPdataConverter) Stop()

type LogEmitter

type LogEmitter struct {
	helper.OutputOperator
	// contains filtered or unexported fields
}

LogEmitter is a stanza operator that emits log entries to a channel

func NewLogEmitter

func NewLogEmitter(logger *zap.SugaredLogger) *LogEmitter

NewLogEmitter creates a new receiver output

func (*LogEmitter) OutChannel

func (e *LogEmitter) OutChannel() <-chan []*entry.Entry

OutChannel returns the channel on which entries will be sent to.

func (*LogEmitter) Process

func (e *LogEmitter) Process(ctx context.Context, ent *entry.Entry) error

Process will emit an entry to the output channel

func (*LogEmitter) Start

func (e *LogEmitter) Start(_ operator.Persister) error

Start starts the goroutine(s) required for this operator

func (*LogEmitter) Stop

func (e *LogEmitter) Stop() error

Stop will close the log channel and stop running goroutines

type LogReceiverType

type LogReceiverType interface {
	Type() component.Type
	CreateDefaultConfig() component.Config
	BaseConfig(component.Config) BaseConfig
	InputConfig(component.Config) operator.Config
}

LogReceiverType is the interface used by stanza-based log receivers

Jump to

Keyboard shortcuts

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