Help us shape the future of Go! Take the 2026 Go Developer Survey

outputs

package
v0.44.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultTargetTemplate = template.Must(
		template.New("target-template").
			Funcs(TemplateFuncs).
			Parse(defaultTargetTemplateString))

	TemplateFuncs = template.FuncMap{
		"host": utils.GetHost,
	}
)
View Source
var OutputTypes = map[string]struct{}{
	"file":             {},
	"influxdb":         {},
	"kafka":            {},
	"nats":             {},
	"otlp":             {},
	"prometheus":       {},
	"prometheus_write": {},
	"tcp":              {},
	"udp":              {},
	"gnmi":             {},
	"jetstream":        {},
	"snmp":             {},
	"asciigraph":       {},
}
View Source
var Outputs = map[string]Initializer{}

Functions

func AddSubscriptionTarget

func AddSubscriptionTarget(msg proto.Message, meta Meta, addTarget string, tpl *template.Template) (*gnmi.SubscribeResponse, error)

func DecodeConfig

func DecodeConfig(src, dst any) error

func ExecTemplate

func ExecTemplate(content []byte, tpl *template.Template) ([]byte, error)

func Marshal

func Marshal(pmsg protoreflect.ProtoMessage, meta map[string]string, mo *formatters.MarshalOptions, splitEvents bool, evps ...formatters.EventProcessor) ([][]byte, error)

func Register

func Register(name string, initFn Initializer)

func UpdateProcessorInSlice added in v0.43.0

func UpdateProcessorInSlice(
	logger *log.Logger,
	storeObj store.Store[any],
	eventProcessors []string,
	currentEvps []formatters.EventProcessor,
	processorName string,
	pcfg map[string]any,
) ([]formatters.EventProcessor, bool, error)

Types

type BaseOutput added in v0.42.1

type BaseOutput struct {
}

func (*BaseOutput) Close added in v0.42.1

func (b *BaseOutput) Close() error

func (*BaseOutput) Init added in v0.42.1

func (b *BaseOutput) Init(context.Context, string, map[string]any, ...Option) error

func (*BaseOutput) String added in v0.42.1

func (b *BaseOutput) String() string

func (*BaseOutput) Update added in v0.43.0

func (b *BaseOutput) Update(context.Context, map[string]any) error

func (*BaseOutput) UpdateProcessor added in v0.43.0

func (b *BaseOutput) UpdateProcessor(string, map[string]any) error

func (*BaseOutput) Validate added in v0.43.0

func (b *BaseOutput) Validate(map[string]any) error

func (*BaseOutput) Write added in v0.42.1

func (*BaseOutput) WriteEvent added in v0.42.1

func (b *BaseOutput) WriteEvent(context.Context, *formatters.EventMsg)

type Initializer

type Initializer func() Output

type Meta

type Meta map[string]string

type Option

type Option func(*OutputOptions) error

func WithClusterName

func WithClusterName(name string) Option

func WithConfigStore added in v0.43.0

func WithConfigStore(st store.Store[any]) Option

func WithLogger

func WithLogger(logger *log.Logger) Option

func WithName

func WithName(name string) Option

func WithRegistry

func WithRegistry(reg *prometheus.Registry) Option

type Output

type Output interface {
	// initialize the output
	Init(context.Context, string, map[string]any, ...Option) error
	// validate the config
	Validate(map[string]any) error
	// update the config
	Update(context.Context, map[string]any) error
	// update a processor
	UpdateProcessor(string, map[string]any) error
	// write a protobuf message to the output
	Write(context.Context, proto.Message, Meta)
	// write an event message to the output
	WriteEvent(context.Context, *formatters.EventMsg)
	// close the output
	Close() error
	// return a string representation of the output
	String() string
}

type OutputOptions added in v0.42.1

type OutputOptions struct {
	Name        string
	ClusterName string
	Logger      *log.Logger
	Registry    *prometheus.Registry
	Store       store.Store[any]
}

type ProtoMsg

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

func NewProtoMsg

func NewProtoMsg(m proto.Message, meta Meta) *ProtoMsg

func (*ProtoMsg) GetMeta

func (m *ProtoMsg) GetMeta() Meta

func (*ProtoMsg) GetMsg

func (m *ProtoMsg) GetMsg() proto.Message

Jump to

Keyboard shortcuts

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