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.
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 NewJszCollector(endpoint, prefix string, servers []*CollectedServer, ...) prometheus.Collector
- func Noticef(format string, v ...interface{})
- func RemoveLogger()
- func Tracef(format string, v ...interface{})
- type Account
- type AccountDetail
- type Accountz
- type AccountzDetail
- type Accstatz
- type CollectedServer
- type ConnInfo
- type Connz
- type ConnzConnection
- type DataStats
- type DecodedJWT
- type Gatewayz
- type Healthz
- type Leaf
- type Leafz
- type Limits
- type Logger
- type LoggerOptions
- type NATS
- type NATSCollector
- type RemoteGatewayz
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" 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 NewJszCollector ¶ added in v0.19.0
func NewJszCollector( endpoint, prefix string, servers []*CollectedServer, streamMetaKeys, consumerMetaKeys []string, ) prometheus.Collector
NewJszCollector creates a new NATS JetStream Collector.
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"`
Name string `json:"name"`
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 AccountDetail ¶ added in v0.18.0
type AccountDetail struct {
AccountName string `json:"account_name"`
UpdateTime time.Time `json:"update_time"`
IsSystem bool `json:"is_system"`
Expired bool `json:"expired"`
Complete bool `json:"complete"`
JetstreamEnabled bool `json:"jetstream_enabled"`
LeafnodeConnections int `json:"leafnode_connections"`
ClientConnections int `json:"client_connections"`
Subscriptions int `json:"subscriptions"`
NameTag string `json:"name_tag"`
DecodedJWT DecodedJWT `json:"decoded_jwt"`
}
AccountDetail contains the detailed account information
type Accountz ¶ added in v0.18.0
type Accountz struct {
Accounts []string `json:"accounts"`
}
Accountz represents the list of accounts returned by /accountz
type AccountzDetail ¶ added in v0.18.0
type AccountzDetail struct {
ServerID string `json:"server_id"`
AccountDetail AccountDetail `json:"account_detail"`
}
AccountzDetail represents the detailed account information returned by /accountz?acc=<account_id>
type Accstatz ¶ added in v0.13.0
type Accstatz struct {
Accounts []*Account `json:"account_statz"`
}
Accstatz output
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"`
Account string `json:"account"`
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 DecodedJWT ¶ added in v0.18.0
type DecodedJWT struct {
NATS NATS `json:"nats"`
}
DecodedJWT contains the decoded JWT information
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 {
Name string `json:"name"`
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 Limits ¶ added in v0.18.0
type Limits struct {
Subs int `json:"subs"`
Data int `json:"data"`
Payload int `json:"payload"`
Imports int `json:"imports"`
Exports int `json:"exports"`
Wildcards bool `json:"wildcards"`
Conn int `json:"conn"`
Leaf int `json:"leaf"`
}
Limits contains the account limits
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 NATS ¶ added in v0.18.0
type NATS struct {
Limits Limits `json:"limits"`
}
NATS contains the NATS-specific configuration
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