metrics

package
v0.17.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KubeClient *kube.Clientset

Functions

func InformMetricsExporterAboutWatchedCHI

func InformMetricsExporterAboutWatchedCHI(namespace, chiName string, hostnames []string) error

InformMetricsExporterAboutWatchedCHI informs exporter about new watched CHI

func InformMetricsExporterToDeleteWatchedCHI

func InformMetricsExporterToDeleteWatchedCHI(namespace, chiName string) error

InformMetricsExporterToDeleteWatchedCHI informs exporter to delete/forget watched CHI

Types

type CHAccessInfo

type CHAccessInfo struct {
	Username string
	Password string
	Port     int
}

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

func (e *Exporter) UpdateWatch(namespace, chiName string, hostnames []string)

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL