outputs

package
v0.36.2 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 16 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":             {},
	"prometheus":       {},
	"prometheus_write": {},
	"stan":             {},
	"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 interface{}) 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)

Types

type Initializer

type Initializer func() Output

type Meta

type Meta map[string]string

type Option

type Option func(Output) error

func WithClusterName

func WithClusterName(name string) Option

func WithEventProcessors

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

func WithLogger(logger *log.Logger) Option

func WithName

func WithName(name string) Option

func WithRegistry

func WithRegistry(reg *prometheus.Registry) Option

func WithTargetsConfig

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{}) error
	SetName(string)
	SetClusterName(string)
	SetTargetsConfig(map[string]*types.TargetConfig)
}

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