outputs

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2022 License: Apache-2.0 Imports: 15 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))
)
View Source
var OutputTypes = map[string]struct{}{
	"file":             {},
	"influxdb":         {},
	"kafka":            {},
	"nats":             {},
	"prometheus":       {},
	"prometheus_write": {},
	"stan":             {},
	"tcp":              {},
	"udp":              {},
	"gnmi":             {},
	"jetstream":        {},
}
View Source
var Outputs = map[string]Initializer{}
View Source
var TemplateFuncs = template.FuncMap{
	"host": utils.GetHost,
}

Functions

func AddSubscriptionTarget added in v0.15.0

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

func DecodeConfig added in v0.4.0

func DecodeConfig(src, dst interface{}) error

func ExecTemplate added in v0.21.0

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

func Register

func Register(name string, initFn Initializer)

Types

type Initializer

type Initializer func() Output

type Meta

type Meta map[string]string

type Option added in v0.5.2

type Option func(Output)

func WithClusterName added in v0.8.0

func WithClusterName(name string) Option

func WithEventProcessors added in v0.6.0

func WithEventProcessors(eps map[string]map[string]interface{},
	log *log.Logger,
	tcs map[string]*types.TargetConfig,
	acts map[string]map[string]interface{}) Option

func WithLogger added in v0.5.2

func WithLogger(logger *log.Logger) Option

func WithName added in v0.7.0

func WithName(name string) Option

func WithRegistry added in v0.25.0

func WithRegistry(reg *prometheus.Registry) Option

func WithTargetsConfig added in v0.18.0

func WithTargetsConfig(tcs map[string]*types.TargetConfig) Option

type Output

type Output interface {
	Init(context.Context, string, map[string]interface{}, ...Option) error
	Write(context.Context, proto.Message, Meta)
	WriteEvent(context.Context, *formatters.EventMsg)
	Close() error
	RegisterMetrics(*prometheus.Registry)
	String() string

	SetLogger(*log.Logger)
	SetEventProcessors(map[string]map[string]interface{}, *log.Logger, map[string]*types.TargetConfig, map[string]map[string]interface{})
	SetName(string)
	SetClusterName(string)
	SetTargetsConfig(map[string]*types.TargetConfig)
}

type ProtoMsg added in v0.26.0

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

func NewProtoMsg added in v0.26.0

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

func (*ProtoMsg) GetMeta added in v0.26.0

func (m *ProtoMsg) GetMeta() Meta

func (*ProtoMsg) GetMsg added in v0.26.0

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

Jump to

Keyboard shortcuts

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