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.
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.
Package collector has various collector utilities and implementations.
Index ¶
- Constants
- Variables
- func ConfigureLogger(lOpts *LoggerOptions)
- func Debugf(format string, v ...interface{})
- func Errorf(format string, v ...interface{})
- func Fatalf(format string, v ...interface{})
- func GetServerIDFromVarz(endpoint string, retryInterval time.Duration) string
- func GetServerNameFromVarz(endpoint string, retryInterval time.Duration) string
- func NewCollector(system, endpoint, prefix string, servers []*CollectedServer) prometheus.Collector
- func Noticef(format string, v ...interface{})
- func RemoveLogger()
- func Tracef(format string, v ...interface{})
- type Account
- type Accstatz
- type Channelsz
- type Channelz
- type CollectedServer
- type ConnInfo
- type Connz
- type ConnzConnection
- type DataStats
- type Gatewayz
- type Healthz
- type Leaf
- type Leafz
- type Logger
- type LoggerOptions
- type NATSCollector
- type RemoteGatewayz
- type StreamingServerz
- type Subscriptionz
Constants ¶
const ( ConsoleLogType = iota SysLogType RemoteSysLogType FileLogType )
Log Types
Variables ¶
var ( // use gnatsd for backward compatibility. Changing would require users to // change their dashboards or other applications that rely on the // prometheus metric names. CoreSystem = "gnatsd" StreamingSystem = "nss" ReplicatorSystem = "replicator" JetStreamSystem = "jetstream" )
System Name Variables
Functions ¶
func ConfigureLogger ¶
func ConfigureLogger(lOpts *LoggerOptions)
ConfigureLogger configures logging for the NATS exporter.
func GetServerIDFromVarz ¶ added in v0.5.0
GetServerIDFromVarz gets the server ID from the server.
func GetServerNameFromVarz ¶ added in v0.11.0
GetServerNameFromVarz gets the server name 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, healthz, subsz, or routez)
func RemoveLogger ¶
func RemoveLogger()
RemoveLogger clears the logger instance and debug/trace flags. Used for testing.
Types ¶
type Account ¶ added in v0.13.0
type Account struct { Account string `json:"acc"` Conns int `json:"conns"` LeafNodes int `json:"leafnodes"` TotalConns int `json:"total_conns"` NumSubs uint32 `json:"num_subscriptions"` Sent DataStats `json:"sent"` Received DataStats `json:"received"` SlowConsumers int64 `json:"slow_consumers"` }
Account stats output
type Accstatz ¶ added in v0.13.0
type Accstatz struct {
Accounts []*Account `json:"account_statz"`
}
Accstatz output
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 ConnInfo ¶ added in v0.6.2
type ConnInfo struct { Cid uint64 `json:"cid"` Start time.Time `json:"start"` LastActivity time.Time `json:"last_activity"` RTT string `json:"rtt,omitempty"` Uptime string `json:"uptime"` Idle string `json:"idle"` Pending int `json:"pending_bytes"` InMsgs int64 `json:"in_msgs"` OutMsgs int64 `json:"out_msgs"` InBytes int64 `json:"in_bytes"` OutBytes int64 `json:"out_bytes"` NumSubs uint32 `json:"subscriptions"` }
ConnInfo output
type Connz ¶ added in v0.3.0
type Connz struct { NumConnections float64 `json:"num_connections"` Total float64 `json:"total"` Offset float64 `json:"offset"` Limit float64 `json:"limit"` Connections []ConnzConnection `json:"connections"` }
Connz output
type ConnzConnection ¶ added in v0.11.0
type ConnzConnection struct { Cid string `json:"cid"` Kind string `json:"kind"` Type string `json:"type"` IP string `json:"ip"` Port string `json:"port"` Start float64 `json:"start"` LastActivity float64 `json:"last_activity"` Rtt float64 `json:"rtt"` Uptime float64 `json:"uptime"` Idle float64 `json:"idle"` PendingBytes float64 `json:"pending_bytes"` InMsgs float64 `json:"in_msgs"` OutMsgs float64 `json:"out_msgs"` InBytes float64 `json:"in_bytes"` OutBytes float64 `json:"out_bytes"` Subscriptions float64 `json:"subscriptions"` Name string `json:"name"` NameTag string `json:"name_tag"` Lang string `json:"lang"` Version string `json:"version"` TLSVersion string `json:"tls_version"` TLSCipherSuite string `json:"tls_cipher_suite"` }
ConnzConnection represents the connections details
func (*ConnzConnection) UnmarshalJSON ¶ added in v0.11.0
func (c *ConnzConnection) UnmarshalJSON(data []byte) error
UnmarshalJSON converts JSON string to struct. This is required as we want to parse time or duration fields as `time.Duration` and then to milliseconds
type Gatewayz ¶ added in v0.6.2
type Gatewayz struct { Name string `json:"name"` OutboundGateways map[string]*RemoteGatewayz `json:"outbound_gateways"` InboundGateways map[string][]*RemoteGatewayz `json:"inbound_gateways"` }
Gatewayz output
type Leaf ¶ added in v0.9.0
type Leaf struct { Account string `json:"account"` IP string `json:"ip"` Port int `json:"port"` RTT string `json:"rtt"` InMsgs int `json:"in_msgs"` OutMsgs int `json:"out_msgs"` InBytes int `json:"in_bytes"` OutBytes int `json:"out_bytes"` Subscriptions int `json:"subscriptions"` SubscriptionsList []string `json:"subscriptions_list"` }
Leaf 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]metric // 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 RemoteGatewayz ¶ added in v0.6.2
type RemoteGatewayz struct { IsConfigured bool `json:"configured"` Connection ConnInfo `json:"connection,omitempty"` }
RemoteGatewayz output
type StreamingServerz ¶ added in v0.2.0
type StreamingServerz struct { TotalBytes int `json:"total_bytes"` InBytes int `json:"in_bytes"` OutBytes int `json:"out_bytes"` TotalMsgs int `json:"total_msgs"` InMsgs int `json:"in_msgs"` OutMsgs int `json:"out_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