Documentation ¶
Index ¶
- Variables
- func InformMetricsExporterAboutWatchedCHI(namespace, chiName string, hostnames []string) error
- func InformMetricsExporterToDeleteWatchedCHI(namespace, chiName string) error
- type CHAccessInfo
- type ClickHouseFetcher
- type Exporter
- func (e *Exporter) Collect(ch chan<- prometheus.Metric)
- func (e *Exporter) Describe(ch chan<- *prometheus.Desc)
- func (e *Exporter) DiscoveryWatchedCHIs(chopClient *chopclientset.Clientset, kubeClient *kube.Clientset)
- func (e *Exporter) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (e *Exporter) UpdateWatch(namespace, chiName string, hostnames []string)
- func (e *Exporter) WalkWatchedChi(f func(chi *WatchedCHI, hostname string))
- type PrometheusWriter
- func (w *PrometheusWriter) WriteClickhouseUp(req string)
- func (w *PrometheusWriter) WriteDetachedParts(data [][]string)
- func (w *PrometheusWriter) WriteErrorFetch(fetchType string)
- func (w *PrometheusWriter) WriteMetrics(data [][]string)
- func (w *PrometheusWriter) WriteMutations(data [][]string)
- func (w *PrometheusWriter) WriteOKFetch(fetchType string)
- func (w *PrometheusWriter) WriteSystemDisks(data [][]string)
- func (w *PrometheusWriter) WriteSystemParts(data [][]string)
- func (w *PrometheusWriter) WriteSystemReplicas(data [][]string)
- func (w *PrometheusWriter) WriteTableSizes(data [][]string)
- type WatchedCHI
Constants ¶
This section is empty.
Variables ¶
var KubeClient *kube.Clientset
Functions ¶
func InformMetricsExporterAboutWatchedCHI ¶
InformMetricsExporterAboutWatchedCHI informs exporter about new watched CHI
func InformMetricsExporterToDeleteWatchedCHI ¶
InformMetricsExporterToDeleteWatchedCHI informs exporter to delete/forget watched CHI
Types ¶
type CHAccessInfo ¶
CHAccessInfo specifies ClickHouse access info
func NewCHAccessInfo ¶
func NewCHAccessInfo(username, password string, port int) *CHAccessInfo
NewCHAccessInfo creates new CHAccessInfo from specified access info
type ClickHouseFetcher ¶
type ClickHouseFetcher struct {
// contains filtered or unexported fields
}
ClickHouseFetcher specifies clickhouse fetcher object
func NewClickHouseFetcher ¶
func NewClickHouseFetcher(hostname, username, password string, port int) *ClickHouseFetcher
NewClickHouseFetcher creates new clickhouse fetcher object
func (*ClickHouseFetcher) SetQueryTimeout ¶
func (f *ClickHouseFetcher) SetQueryTimeout(timeout time.Duration) *ClickHouseFetcher
SetQueryTimeout sets query timeout
type Exporter ¶
type Exporter struct {
// contains filtered or unexported fields
}
Exporter implements prometheus.Collector interface
func NewExporter ¶
func NewExporter(chAccess *CHAccessInfo) *Exporter
NewExporter returns a new instance of Exporter type
func StartMetricsREST ¶
func StartMetricsREST( chAccess *CHAccessInfo, metricsAddress string, metricsPath string, chiListAddress string, chiListPath string, ) *Exporter
StartMetricsREST start Prometheus metrics exporter in background
func (*Exporter) Collect ¶
func (e *Exporter) Collect(ch chan<- prometheus.Metric)
Collect implements prometheus.Collector Collect method
func (*Exporter) Describe ¶
func (e *Exporter) Describe(ch chan<- *prometheus.Desc)
Describe implements prometheus.Collector Describe method
func (*Exporter) DiscoveryWatchedCHIs ¶
func (e *Exporter) DiscoveryWatchedCHIs(chopClient *chopclientset.Clientset, kubeClient *kube.Clientset)
DiscoveryWatchedCHIs discovers all ClickHouseInstallation objects available for monitoring and adds them to watched list
func (*Exporter) ServeHTTP ¶
func (e *Exporter) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP is an interface method to serve HTTP requests
func (*Exporter) UpdateWatch ¶
UpdateWatch ensures hostnames of the Pods from CHI object included into metrics.Exporter state
func (*Exporter) WalkWatchedChi ¶
func (e *Exporter) WalkWatchedChi(f func(chi *WatchedCHI, hostname string))
WalkWatchedChi walks over watched CHI objects
type PrometheusWriter ¶
type PrometheusWriter struct {
// contains filtered or unexported fields
}
PrometheusWriter specifies write to prometheus
func NewPrometheusWriter ¶
func NewPrometheusWriter( out chan<- prometheus.Metric, chi *WatchedCHI, hostname string, ) *PrometheusWriter
NewPrometheusWriter creates new prometheus writer
func (*PrometheusWriter) WriteClickhouseUp ¶
func (w *PrometheusWriter) WriteClickhouseUp(req string)
func (*PrometheusWriter) WriteDetachedParts ¶
func (w *PrometheusWriter) WriteDetachedParts(data [][]string)
WriteDetachedParts writes detached parts
func (*PrometheusWriter) WriteErrorFetch ¶
func (w *PrometheusWriter) WriteErrorFetch(fetchType string)
WriteErrorFetch writes error fetch
func (*PrometheusWriter) WriteMetrics ¶
func (w *PrometheusWriter) WriteMetrics(data [][]string)
WriteMetrics pushes set of prometheus.Metric objects created from the ClickHouse system data Expected data structure: metric, value, description, type (gauge|counter) TODO add namespace handling. It is just skipped for now
func (*PrometheusWriter) WriteMutations ¶
func (w *PrometheusWriter) WriteMutations(data [][]string)
WriteMutations writes mutations
func (*PrometheusWriter) WriteOKFetch ¶
func (w *PrometheusWriter) WriteOKFetch(fetchType string)
WriteOKFetch writes successful fetch
func (*PrometheusWriter) WriteSystemDisks ¶
func (w *PrometheusWriter) WriteSystemDisks(data [][]string)
WriteSystemDisks writes system disks
func (*PrometheusWriter) WriteSystemParts ¶
func (w *PrometheusWriter) WriteSystemParts(data [][]string)
WriteSystemParts pushesh set of prometheus.Metric object related to system.parts
func (*PrometheusWriter) WriteSystemReplicas ¶
func (w *PrometheusWriter) WriteSystemReplicas(data [][]string)
WriteSystemReplicas writes system replicas
func (*PrometheusWriter) WriteTableSizes ¶
func (w *PrometheusWriter) WriteTableSizes(data [][]string)
WriteTableSizes pushes set of prometheus.Metric objects created from the ClickHouse system data Expected data structure: database, table, partitions, parts, bytes, uncompressed_bytes, rows TODO add namespace handling. It is just skipped for now
type WatchedCHI ¶
type WatchedCHI struct { Namespace string `json:"namespace"` Name string `json:"name"` Hostnames []string `json:"hostnames"` }
WatchedCHI specifies watched CLickHouseInstallation