metrics

package
v0.0.0-...-bbbf66a Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 24 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InformMetricsExporterAboutWatchedCHI

func InformMetricsExporterAboutWatchedCHI(chi *WatchedCHI) error

InformMetricsExporterAboutWatchedCHI informs exporter about new watched CHI

func InformMetricsExporterToDeleteWatchedCHI

func InformMetricsExporterToDeleteWatchedCHI(chi *WatchedCHI) error

InformMetricsExporterToDeleteWatchedCHI informs exporter to delete/forget watched CHI

Types

type CHIPrometheusWriter

type CHIPrometheusWriter struct {
	// contains filtered or unexported fields
}

CHIPrometheusWriter specifies writer to prometheus

func NewCHIPrometheusWriter

func NewCHIPrometheusWriter(
	out chan<- prometheus.Metric,
	chi *WatchedCHI,
	host *WatchedHost,
) *CHIPrometheusWriter

NewCHIPrometheusWriter creates new CHI prometheus writer

func (*CHIPrometheusWriter) WriteDetachedParts

func (w *CHIPrometheusWriter) WriteDetachedParts(data [][]string)

WriteDetachedParts writes detached parts

func (*CHIPrometheusWriter) WriteErrorFetch

func (w *CHIPrometheusWriter) WriteErrorFetch(fetchType string)

WriteErrorFetch writes error fetch

func (*CHIPrometheusWriter) WriteMetrics

func (w *CHIPrometheusWriter) 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 (*CHIPrometheusWriter) WriteMutations

func (w *CHIPrometheusWriter) WriteMutations(data [][]string)

WriteMutations writes mutations

func (*CHIPrometheusWriter) WriteOKFetch

func (w *CHIPrometheusWriter) WriteOKFetch(fetchType string)

WriteOKFetch writes successful fetch

func (*CHIPrometheusWriter) WriteSystemDisks

func (w *CHIPrometheusWriter) WriteSystemDisks(data [][]string)

WriteSystemDisks writes system disks

func (*CHIPrometheusWriter) WriteSystemParts

func (w *CHIPrometheusWriter) WriteSystemParts(data [][]string)

WriteSystemParts pushes set of prometheus.Metric object related to system.parts

func (*CHIPrometheusWriter) WriteSystemReplicas

func (w *CHIPrometheusWriter) WriteSystemReplicas(data [][]string)

WriteSystemReplicas writes system replicas

func (*CHIPrometheusWriter) WriteTableSizes

func (w *CHIPrometheusWriter) 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 ClickHouseMetricsFetcher

type ClickHouseMetricsFetcher struct {
	// contains filtered or unexported fields
}

ClickHouseMetricsFetcher specifies clickhouse fetcher object

func NewClickHouseFetcher

func NewClickHouseFetcher(endpointConnectionParams *clickhouse.EndpointConnectionParams) *ClickHouseMetricsFetcher

NewClickHouseFetcher creates new clickhouse fetcher object

type Exporter

type Exporter struct {
	// contains filtered or unexported fields
}

Exporter implements prometheus.Collector interface

func NewExporter

func NewExporter(collectorTimeout time.Duration) *Exporter

NewExporter returns a new instance of Exporter type

func StartMetricsREST

func StartMetricsREST(
	metricsAddress string,
	metricsPath string,
	collectorTimeout time.Duration,

	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(kubeClient kube.Interface, chopClient *chopAPI.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

type ScanFunction

type ScanFunction func(rows *sql.Rows, data *Table) error

ScanFunction defines function to scan rows

type Table

type Table [][]string

Table defines tables of strings

type WatchedCHI

type WatchedCHI struct {
	Namespace   string            `json:"namespace"`
	Name        string            `json:"name"`
	Labels      map[string]string `json:"labels"`
	Annotations map[string]string `json:"annotations"`
	Clusters    []*WatchedCluster `json:"clusters"`
}

WatchedCHI specifies watched ClickHouseInstallation

func NewWatchedCHI

func NewWatchedCHI(c *api.ClickHouseInstallation) *WatchedCHI

NewWatchedCHI creates new watched CHI

func (*WatchedCHI) GetAnnotations

func (chi *WatchedCHI) GetAnnotations() map[string]string

func (*WatchedCHI) GetLabels

func (chi *WatchedCHI) GetLabels() map[string]string

func (*WatchedCHI) GetName

func (chi *WatchedCHI) GetName() string

func (*WatchedCHI) GetNamespace

func (chi *WatchedCHI) GetNamespace() string

func (*WatchedCHI) String

func (chi *WatchedCHI) String() string

String is a stringifier

type WatchedCluster

type WatchedCluster struct {
	Name  string         `json:"name,omitempty"  yaml:"name,omitempty"`
	Hosts []*WatchedHost `json:"hosts,omitempty" yaml:"hosts,omitempty"`
}

WatchedCluster specifies watched cluster

type WatchedHost

type WatchedHost struct {
	Name      string `json:"name,omitempty"      yaml:"name,omitempty"`
	Hostname  string `json:"hostname,omitempty"  yaml:"hostname,omitempty"`
	TCPPort   int32  `json:"tcpPort,omitempty"   yaml:"tcpPort,omitempty"`
	TLSPort   int32  `json:"tlsPort,omitempty"   yaml:"tlsPort,omitempty"`
	HTTPPort  int32  `json:"httpPort,omitempty"  yaml:"httpPort,omitempty"`
	HTTPSPort int32  `json:"httpsPort,omitempty" yaml:"httpsPort,omitempty"`
}

WatchedHost specifies watched host

Jump to

Keyboard shortcuts

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