destination

package
v0.1.3-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KindHttp    = "http"
	KindFile    = "file"
	KindStdOut  = "stdout"
	KindChannel = "channel"
)

Variables

View Source
var (
	ErrMissingChannel = errors.New("destination cfg is missing channel")
)
View Source
var (
	ErrMissingEndpoint = errors.New("missing endpoint information")
)
View Source
var (
	ErrMissingPath = errors.New("missing path for file destination")
)
View Source
var (
	ErrNoProcessor = errors.New("no internal processor")
)

Functions

This section is empty.

Types

type ChannelDestination

type ChannelDestination struct {
	Output chan<- *optimusv1.LogEvent
}

func (*ChannelDestination) Close

func (cd *ChannelDestination) Close() error

func (*ChannelDestination) Deliver

func (cd *ChannelDestination) Deliver(ctx context.Context, event *optimusv1.LogEvent) error

func (*ChannelDestination) Setup

func (cd *ChannelDestination) Setup() error

type Closer

type Closer = func() error

type Deliverer

type Deliverer = func(context.Context, *optimusv1.LogEvent) error

type Destination

type Destination struct {
	ID            string
	Kind          string
	BufferSize    int
	Subscriptions []string
	Subscriber    pubsub.Subscriber
	// contains filtered or unexported fields
}

func New

func New(id, kind string, bufferSize int, subscriptions []string, impl DestinationProcessor) (*Destination, error)

func (*Destination) Init

func (d *Destination) Init(id string) error

func (*Destination) Process

func (d *Destination) Process(ctx context.Context)

type DestinationProcessor

type DestinationProcessor interface {
	Setup() error
	Deliver(context.Context, *optimusv1.LogEvent) error
	Close() error
}

func HclImpl

func HclImpl(kind string, body hcl.Body) (DestinationProcessor, hcl.Diagnostics)

type FileDestination

type FileDestination struct {
	Path string `hcl:"path"`
	// contains filtered or unexported fields
}

func (*FileDestination) Close

func (f *FileDestination) Close() error

func (*FileDestination) Deliver

func (f *FileDestination) Deliver(ctx context.Context, event *optimusv1.LogEvent) error

func (*FileDestination) Setup

func (f *FileDestination) Setup() error
type Header struct {
	Key   string `hcl:"key"`
	Value string `hcl:"value"`
	Path  string `hcl:"path"`
}

type HttpDestination

type HttpDestination struct {
	Timeout      time.Duration `hcl:"timeout,optional"`
	Retries      int           `hcl:"retries,optional"`
	Endpoint     string        `hcl:"endpoint"`
	Method       string        `hcl:"http_method,optional"`
	Headers      []Header      `hcl:"headers,optional"`
	BatchSize    int           `hcl:"batch_size,optional"`
	BatchTimeout time.Duration `hcl:"batch_timeout,optional"`
	// contains filtered or unexported fields
}

func (*HttpDestination) AddHeaders

func (h *HttpDestination) AddHeaders(req *retryablehttp.Request, event *optimusv1.LogEvent)

func (*HttpDestination) Close

func (h *HttpDestination) Close() error

func (*HttpDestination) Deliver

func (h *HttpDestination) Deliver(ctx context.Context, event *optimusv1.LogEvent) error

func (*HttpDestination) Setup

func (h *HttpDestination) Setup() error

type Initializer

type Initializer = func() error

type StdOutDestination

type StdOutDestination struct {
	Writer io.Writer
	// contains filtered or unexported fields
}

func (*StdOutDestination) Close

func (sd *StdOutDestination) Close() error

func (*StdOutDestination) Deliver

func (sd *StdOutDestination) Deliver(ctx context.Context, event *optimusv1.LogEvent) error

func (*StdOutDestination) Setup

func (sd *StdOutDestination) Setup() error

Jump to

Keyboard shortcuts

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