Documentation ¶
Overview ¶
Package exporter is a Prometheus exporter for NATS.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( DefaultListenPort = 7777 DefaultListenAddress = "0.0.0.0" DefaultScrapePath = "/metrics" DefaultMonitorURL = "http://localhost:8222" DefaultRetryIntervalSecs = 30 )
Defaults
Functions ¶
This section is empty.
Types ¶
type NATSExporter ¶
type NATSExporter struct { sync.Mutex Collectors []prometheus.Collector // contains filtered or unexported fields }
NATSExporter collects NATS metrics
func NewExporter ¶
func NewExporter(opts *NATSExporterOptions) *NATSExporter
NewExporter creates a new NATS exporter
func (*NATSExporter) AddServer ¶
func (ne *NATSExporter) AddServer(id, url string) error
AddServer is an advanced API; normally the NATS server should be set through the options. Adding more than one server will violate Prometheus.io guidelines.
func (*NATSExporter) ClearCollectors ¶ added in v0.10.0
func (ne *NATSExporter) ClearCollectors()
ClearCollectors unregisters the collectors caller must lock
func (*NATSExporter) InitializeCollectors ¶ added in v0.10.0
func (ne *NATSExporter) InitializeCollectors() error
InitializeCollectors initializes the Collectors for the exporter. Caller must lock
func (*NATSExporter) WaitUntilDone ¶
func (ne *NATSExporter) WaitUntilDone()
WaitUntilDone blocks until the collector is stopped.
type NATSExporterOptions ¶
type NATSExporterOptions struct { collector.LoggerOptions ListenAddress string ListenPort int ScrapePath string GetHealthz bool GetConnz bool GetConnzDetailed bool GetVarz bool GetSubz bool GetRoutez bool GetGatewayz bool GetAccstatz bool GetLeafz bool GetReplicatorVarz bool GetStreamingChannelz bool GetStreamingServerz bool GetJszFilter string RetryInterval time.Duration CertFile string KeyFile string CaFile string NATSServerURL string NATSServerTag string HTTPUser string // User in metrics scrape by prometheus. HTTPPassword string Prefix string UseInternalServerID bool UseServerName bool }
NATSExporterOptions are options to configure the NATS collector
func GetDefaultExporterOptions ¶
func GetDefaultExporterOptions() *NATSExporterOptions
GetDefaultExporterOptions returns the default set of exporter options The NATS server url must be set