Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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
}
MetricQuery defines a single Prometheus metric to collect.
func BrokerQueryDefinitions ¶ added in v0.8.4
func BrokerQueryDefinitions() []MetricQuery
BrokerQueryDefinitions returns the standard Kafka broker Prometheus queries.
func ConnectQueryDefinitions ¶ added in v0.8.4
func ConnectQueryDefinitions() []MetricQuery
ConnectQueryDefinitions returns Prometheus queries for Kafka Connect worker metrics. Metric names match the JMX exporter naming convention (kafka_connect_worker_*). Client-level metrics (incoming/outgoing-byte-rate, connection-count, request-rate) require the JMX exporter to whitelist kafka.connect:client-id=*,type=connect-metrics.
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