Documentation ¶
Index ¶
- func InitLog(cfg TomlConfig)
- func InitProm()
- func OpenConnection(kafkaVersion string, clusterAddr []string, adminTimeout int) sarama.ClusterAdmin
- func PullConfigs(cfg TomlConfig, clusterName string, collector *Collector)
- func RegisterMetrics(topicConfig []sarama.ConfigEntry, topicName string, c *Collector)
- type Collector
- type TomlConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OpenConnection ¶
func OpenConnection(kafkaVersion string, clusterAddr []string, adminTimeout int) sarama.ClusterAdmin
OpenConnection to one of a given broker using supplied version
func PullConfigs ¶
func PullConfigs(cfg TomlConfig, clusterName string, collector *Collector)
PullConfigs opens a connection to a given cluster, filter topics based on the config file and then run DescribeTopicConfig to populate the metrics
func RegisterMetrics ¶
func RegisterMetrics(topicConfig []sarama.ConfigEntry, topicName string, c *Collector)
RegisterMetrics populate the metrics with a topic label
Types ¶
type Collector ¶
Collector define all metrics as GaugeVec The "metrics" are configuration parameters so it's better to represent them as Gauge metrics.
func (*Collector) Collect ¶
func (c *Collector) Collect(ch chan<- prometheus.Metric)
Collect implements Collector
func (*Collector) Describe ¶
func (c *Collector) Describe(ch chan<- *prometheus.Desc)
Describe implements Collector
type TomlConfig ¶
type TomlConfig struct { Global struct { Port string `toml:"port"` Timeout int `toml:"timeout"` } `toml:"global"` Log struct { Format string `toml:"format"` Level string `toml:"level"` } `toml:"log"` Kafka struct { DefaultRefreshRate int `toml:"default_refresh_rate"` MinKafkaVersion string `toml:"min_kafka_version"` AdminTimeout int `toml:"admin_timeout"` } `toml:"kafka"` Clusters map[string]clusters }
TomlConfig is the main config struct
var ( // Configuration is main conig Configuration TomlConfig )
Click to show internal directories.
Click to hide internal directories.