collector

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package collector has various collector utilities and implementations.

Package collector has various collector utilities and implementations.

Package collector has various collector utilities and implementations.

Package collector has various collector utilities and implementations.

Index

Constants

View Source
const (
	ConsoleLogType = iota
	SysLogType
	RemoteSysLogType
	FileLogType
)

Log Types

Variables

View Source
var (
	// use gnatsd for backward compatiblity.  Changing would require users to
	// change their dashboards or other applications that rely on the
	// prometheus metric names.
	CoreSystem       = "gnatsd"
	StreamingSystem  = "nss"
	ReplicatorSystem = "replicator"
)

System Name Varibles

Functions

func ConfigureLogger

func ConfigureLogger(lOpts *LoggerOptions)

ConfigureLogger configures logging for the NATS exporter.

func Debugf

func Debugf(format string, v ...interface{})

Debugf logs a debug statement nolint

func Errorf

func Errorf(format string, v ...interface{})

Errorf logs an error

func Fatalf

func Fatalf(format string, v ...interface{})

Fatalf logs a fatal error

func GetServerIDFromVarz added in v0.5.0

func GetServerIDFromVarz(endpoint string, retryInterval time.Duration) string

GetServerIDFromVarz gets the server ID from the server.

func NewCollector

func NewCollector(system, endpoint, prefix string, servers []*CollectedServer) prometheus.Collector

NewCollector creates a new NATS Collector from a list of monitoring URLs. Each URL should be to a specific endpoint (e.g. varz, connz, subsz, or routez)

func Noticef

func Noticef(format string, v ...interface{})

Noticef logs a notice statement

func RemoveLogger

func RemoveLogger()

RemoveLogger clears the logger instance and debug/trace flags. Used for testing.

func Tracef

func Tracef(format string, v ...interface{})

Tracef logs a trace statement nolint

Types

type Channelsz added in v0.2.0

type Channelsz struct {
	ClusterID string      `json:"cluster_id"`
	Now       time.Time   `json:"now"`
	Offset    int         `json:"offset"`
	Limit     int         `json:"limit"`
	Count     int         `json:"count"`
	Total     int         `json:"total"`
	Names     []string    `json:"names,omitempty"`
	Channels  []*Channelz `json:"channels,omitempty"`
}

Channelsz lists the name of all NATS Streaming Channelsz

type Channelz added in v0.2.0

type Channelz struct {
	Name          string           `json:"name"`
	Msgs          int              `json:"msgs"`
	Bytes         uint64           `json:"bytes"`
	FirstSeq      uint64           `json:"first_seq"`
	LastSeq       uint64           `json:"last_seq"`
	Subscriptions []*Subscriptionz `json:"subscriptions,omitempty"`
}

Channelz describes a NATS Streaming Channel

type CollectedServer

type CollectedServer struct {
	URL string
	ID  string
}

CollectedServer is a NATS server polled by this collector

type Connz added in v0.3.0

type Connz struct {
	NumConnections int `json:"num_connections"`
	Total          int `json:"total"`
	Offset         int `json:"offset"`
	Limit          int `json:"limit"`
	Connections    []struct {
		PendingBytes int `json:"pending_bytes"`
	} `json:"connections"`
}

Connz output

type Logger

type Logger interface {

	// Log a notice statement
	Noticef(format string, v ...interface{})

	// Log a fatal error
	Fatalf(format string, v ...interface{})

	// Log an error
	Errorf(format string, v ...interface{})

	// Log a debug statement
	Debugf(format string, v ...interface{})

	// Log a trace statement
	Tracef(format string, v ...interface{})
}

Logger provides an interface to logging methods.

type LoggerOptions

type LoggerOptions struct {
	Debug        bool
	Trace        bool
	Logtime      bool
	LogFile      string
	LogType      int
	RemoteSyslog string
}

LoggerOptions configure the logger

type NATSCollector

type NATSCollector struct {
	sync.Mutex
	Stats map[string]interface{}
	// contains filtered or unexported fields
}

NATSCollector collects NATS metrics

func (*NATSCollector) Collect

func (nc *NATSCollector) Collect(ch chan<- prometheus.Metric)

Collect all metrics for all URLs to send to Prometheus.

func (*NATSCollector) Describe

func (nc *NATSCollector) Describe(ch chan<- *prometheus.Desc)

Describe the metric to the Prometheus server.

type StreamingServerz added in v0.2.0

type StreamingServerz struct {
	TotalBytes    int    `json:"total_bytes"`
	TotalMsgs     int    `json:"total_msgs"`
	Channels      int    `json:"channels"`
	Subscriptions int    `json:"subscriptions"`
	Clients       int    `json:"clients"`
	ClusterID     string `json:"cluster_id"`
	ServerID      string `json:"server_id"`
	Version       string `json:"version"`
	GoVersion     string `json:"go"`
	State         string `json:"state"`
	Role          string `json:"role"`
	StartTime     string `json:"start_time"`
}

StreamingServerz represents the metrics from streaming/serverz.

type Subscriptionz added in v0.2.0

type Subscriptionz struct {
	ClientID     string `json:"client_id"`
	Inbox        string `json:"inbox"`
	AckInbox     string `json:"ack_inbox"`
	DurableName  string `json:"durable_name,omitempty"`
	QueueName    string `json:"queue_name,omitempty"`
	IsDurable    bool   `json:"is_durable"`
	IsOffline    bool   `json:"is_offline"`
	MaxInflight  int    `json:"max_inflight"`
	AckWait      int    `json:"ack_wait"`
	LastSent     uint64 `json:"last_sent"`
	PendingCount int    `json:"pending_count"`
	IsStalled    bool   `json:"is_stalled"`
}

Subscriptionz describes a NATS Streaming Subscription

Jump to

Keyboard shortcuts

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