nats_output

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: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NatsNumberOfFailSendMsgs = prometheus.NewCounterVec(prometheus.CounterOpts{
	Namespace: "gnmic",
	Subsystem: "nats_output",
	Name:      "number_of_nats_msgs_sent_fail_total",
	Help:      "Number of failed msgs sent by gnmic nats output",
}, []string{"publisher_id", "reason"})
View Source
var NatsNumberOfSentBytes = prometheus.NewCounterVec(prometheus.CounterOpts{
	Namespace: "gnmic",
	Subsystem: "nats_output",
	Name:      "number_of_written_nats_bytes_total",
	Help:      "Number of bytes written by gnmic nats output",
}, []string{"publisher_id", "subject"})
View Source
var NatsNumberOfSentMsgs = prometheus.NewCounterVec(prometheus.CounterOpts{
	Namespace: "gnmic",
	Subsystem: "nats_output",
	Name:      "number_of_nats_msgs_sent_success_total",
	Help:      "Number of msgs successfully sent by gnmic nats output",
}, []string{"publisher_id", "subject"})
View Source
var NatsSendDuration = prometheus.NewGaugeVec(prometheus.GaugeOpts{
	Namespace: "gnmic",
	Subsystem: "nats_output",
	Name:      "msg_send_duration_ns",
	Help:      "gnmic nats output send duration in ns",
}, []string{"publisher_id"})

Functions

This section is empty.

Types

type Config

type Config struct {
	Name               string        `mapstructure:"name,omitempty"`
	Address            string        `mapstructure:"address,omitempty"`
	SubjectPrefix      string        `mapstructure:"subject-prefix,omitempty"`
	Subject            string        `mapstructure:"subject,omitempty"`
	Username           string        `mapstructure:"username,omitempty"`
	Password           string        `mapstructure:"password,omitempty"`
	ConnectTimeWait    time.Duration `mapstructure:"connect-time-wait,omitempty"`
	Format             string        `mapstructure:"format,omitempty"`
	AddTarget          string        `mapstructure:"add-target,omitempty"`
	TargetTemplate     string        `mapstructure:"target-template,omitempty"`
	MsgTemplate        string        `mapstructure:"msg-template,omitempty"`
	OverrideTimestamps bool          `mapstructure:"override-timestamps,omitempty"`
	NumWorkers         int           `mapstructure:"num-workers,omitempty"`
	WriteTimeout       time.Duration `mapstructure:"write-timeout,omitempty"`
	Debug              bool          `mapstructure:"debug,omitempty"`
	EnableMetrics      bool          `mapstructure:"enable-metrics,omitempty"`
	EventProcessors    []string      `mapstructure:"event-processors,omitempty"`
}

Config //

type NatsOutput

type NatsOutput struct {
	Cfg *Config
	// contains filtered or unexported fields
}

NatsOutput //

func (*NatsOutput) Close

func (n *NatsOutput) Close() error

Close //

func (*NatsOutput) Dial

func (n *NatsOutput) Dial(network, address string) (net.Conn, error)

Dial //

func (*NatsOutput) Init

func (n *NatsOutput) Init(ctx context.Context, name string, cfg map[string]interface{}, opts ...outputs.Option) error

Init //

func (*NatsOutput) RegisterMetrics

func (n *NatsOutput) RegisterMetrics(reg *prometheus.Registry)

Metrics //

func (*NatsOutput) SetClusterName

func (n *NatsOutput) SetClusterName(name string)

func (*NatsOutput) SetEventProcessors

func (n *NatsOutput) SetEventProcessors(ps map[string]map[string]interface{},
	logger *log.Logger,
	tcs map[string]*types.TargetConfig,
	acts map[string]map[string]interface{})

func (*NatsOutput) SetLogger

func (n *NatsOutput) SetLogger(logger *log.Logger)

func (*NatsOutput) SetName

func (n *NatsOutput) SetName(name string)

func (*NatsOutput) SetTargetsConfig

func (n *NatsOutput) SetTargetsConfig(map[string]*types.TargetConfig)

func (*NatsOutput) String

func (n *NatsOutput) String() string

func (*NatsOutput) Write

func (n *NatsOutput) Write(ctx context.Context, rsp proto.Message, meta outputs.Meta)

Write //

func (*NatsOutput) WriteEvent

func (n *NatsOutput) WriteEvent(ctx context.Context, ev *formatters.EventMsg)

Jump to

Keyboard shortcuts

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