prometheus

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SelectStep

func SelectStep(queryRange time.Duration) time.Duration

SelectStep chooses an appropriate query step based on the time range

Types

type MetricQuery added in v0.8.4

type MetricQuery struct {
	Label string
	// Query is a format string. %s is replaced with the rate window (e.g. "5m", "4h").
	// Queries without %s are used as-is.
	Query string
	// PrometheusMetric is the raw Prometheus metric name used in the query.
	PrometheusMetric string
	// GroupByConnector indicates the query is aggregated with `sum by (connector) (...)`
	// and results should be broken out per connector using the `connector` series label.
	GroupByConnector bool
	// Overridden is true when PrometheusMetric came from a user-configured
	// metric-name override rather than the default series name. An overridden
	// query that still returns no data is actionable (the override was set
	// precisely to fix an empty result), so it is logged louder than a routine
	// empty default.
	Overridden bool
}

MetricQuery defines a single Prometheus metric to collect.

func BrokerQueryDefinitions added in v0.8.4

func BrokerQueryDefinitions(overrides map[string]string) []MetricQuery

BrokerQueryDefinitions returns the standard Kafka broker Prometheus queries. overrides maps a logical label (e.g. "BytesInPerSec") to the base series name this cluster's exporter actually exposes; an entry with an empty value is ignored. The overridden name is substituted into kcp's existing query wrapping and set as PrometheusMetric, so applyLabelFilter injection keeps working. Pass nil for the defaults.

func ConnectQueryDefinitions added in v0.8.4

func ConnectQueryDefinitions(overrides map[string]string) []MetricQuery

ConnectQueryDefinitions returns the Kafka Connect worker Prometheus queries. overrides maps a logical Connect label (e.g. "task-count") to the base series name this cluster's exporter actually exposes; an entry with an empty value is ignored. The overridden name is substituted into kcp's existing wrapping and set as PrometheusMetric, so applyLabelFilter injection keeps working, and per-connector metrics keep their sum by (connector) grouping. Pass nil for the defaults.

type PrometheusService

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

PrometheusService collects Kafka metrics from a Prometheus server

func NewPrometheusService

func NewPrometheusService(promClient *client.PrometheusClient, queries []MetricQuery, labels map[string]string) *PrometheusService

NewPrometheusService creates a new Prometheus metrics service. Labels is an optional map of Prometheus label selectors to scope queries to a specific target (e.g. {"job": "confluent/connect-jmx-exporter"}). Pass nil for no filtering.

func (*PrometheusService) CollectMetrics

func (s *PrometheusService) CollectMetrics(ctx context.Context, queryRange time.Duration) (*types.ProcessedClusterMetrics, error)

CollectMetrics queries Prometheus for all Kafka metrics over the specified range

Jump to

Keyboard shortcuts

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