pipeline

package
v0.0.0-...-31600e6 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConditionalExpressionConfig

type ConditionalExpressionConfig string

type Config

type Config struct {
	ID          string            `yaml:"id,omitempty"          json:"id,omitempty"`
	Description string            `yaml:"description,omitempty" json:"description,omitempty"`
	Processors  []ProcessorConfig `yaml:"processors,omitempty"  json:"processors,omitempty"`
	OnFailure   []ProcessorConfig `yaml:"on_failure,omitempty"  json:"on_failure,omitempty"`
}

type Pipeline

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

func New

func New(config *Config) (*Pipeline, error)

func (*Pipeline) ID

func (pipe *Pipeline) ID() string

func (*Pipeline) Metrics

func (pipe *Pipeline) Metrics() []prometheus.Collector

func (*Pipeline) Process

func (pipe *Pipeline) Process(evt *event.Event) (*event.Event, error)

Process transforms an event by processing it through the pipeline. There are four cases that callers should expect for return values.

Event pass through - The input event is returned as index 0 of the slice.
Dropped event - Empty slice and nil error.
Processing error - Empty slice and non-nil error.
Event split - Slice length is greater than 1 and non-nil error.

type ProcessorConfig

type ProcessorConfig map[string]*ProcessorOptionConfig

type ProcessorOptionConfig

type ProcessorOptionConfig struct {
	ID        string                      `yaml:"id,omitempty"         json:"id,omitempty"`
	If        ConditionalExpressionConfig `yaml:"if,omitempty"         json:"if,omitempty"`
	OnFailure []ProcessorConfig           `yaml:"on_failure,omitempty" json:"on_failure,omitempty"`
	Config    map[string]interface{}      `yaml:",inline"              json:"-"                    config:",inline"`
}

func (ProcessorOptionConfig) MarshalJSON

func (c ProcessorOptionConfig) MarshalJSON() ([]byte, error)

MarshalJSON contains a workaround for the lack of inline tag support in encoding/json.

func (*ProcessorOptionConfig) UnmarshalJSON

func (c *ProcessorOptionConfig) UnmarshalJSON(data []byte) error

UnmarshalJSON contains a workaround for the lack of inline tag support in encoding/json.

Jump to

Keyboard shortcuts

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