Documentation ¶
Index ¶
- Constants
- func ConfigureLogger(lOpts *LoggerOptions)
- func Debugf(format string, v ...interface{})
- func Errorf(format string, v ...interface{})
- func Fatalf(format string, v ...interface{})
- func NewCollector(endpoint string, servers []*CollectedServer) prometheus.Collector
- func Noticef(format string, v ...interface{})
- func RemoveLogger()
- func Tracef(format string, v ...interface{})
- type Channelsz
- type Channelz
- type CollectedServer
- type Connz
- type Logger
- type LoggerOptions
- type NATSCollector
- type StreamingServerz
- type Subscriptionz
Constants ¶
const ( ConsoleLogType = iota SysLogType RemoteSysLogType FileLogType )
Log Types
Variables ¶
This section is empty.
Functions ¶
func ConfigureLogger ¶
func ConfigureLogger(lOpts *LoggerOptions)
ConfigureLogger configures logging for the NATS exporter.
func NewCollector ¶
func NewCollector(endpoint 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 RemoveLogger ¶
func RemoveLogger()
RemoveLogger clears the logger instance and debug/trace flags. Used for testing.
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 ¶
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