transformers

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidConfig = func(name Type) error { return fmt.Errorf("invalid config for %q transformer", name) }

ErrInvalidConfig signals an invalid configuration input

Functions

func Register

func Register(typ Type, factory Factory)

Register registers a singleton instance of the provided transformer.

Types

type Config

type Config struct {
	Type        Type
	Transformer interface{}
}

Config acts as a container for the transformer configuration structures.

type Factory

type Factory func(config Config) (Transformer, error)

Factory defines the function for transformer factories

type Transformer

type Transformer interface {
	Transform(*kevent.Kevent) error
}

Transformer is the minimal interface all transformers have to satisfy.

func Load

func Load(config Config) (Transformer, error)

Load loads a single transformer from the configuration.

func LoadAll

func LoadAll(configs []Config) ([]Transformer, error)

LoadAll loads all transformers from the configuration inputs.

type Type

type Type uint8

Type defines the alias for the transformer types

const (
	// Remove represents the remove transformer type. This transformer deletes the given list of parameters from the event.
	Remove Type = iota
	// Rename represents the rename transformer type. It renames a sequence of kparam from old to new names.
	Rename
	// Replace represents the replace tranformer type. It applies string replacements on specific kparams.
	Replace
	// Trim represents the trim transformer type that that removes suffix/prefix from string kparams.
	Trim
	// Tags represents the tags transformer type. This transformer appends tags to the event's metadata.
	Tags
)

func (Type) String

func (typ Type) String() string

String returns the type human-readable name.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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