Monitoring Setup
Pilot exposes Prometheus metrics at /metrics. This guide sets up scraping and alerts.
Prometheus Configuration
Add Pilot as a scrape target in your prometheus.yml:
scrape_configs:
- job_name: pilot
scrape_interval: 15s
static_configs:
- targets: ['pilot:8080']For Kubernetes with service discovery:
scrape_configs:
- job_name: pilot
kubernetes_sd_configs:
- role: pod
relabel_configs:
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
action: keep
regex: true
- source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port]
action: replace
target_label: __address__
regex: ([^:]+)(?::\d+)?;(\d+)
replacement: $1:$2Key Metrics to Watch
Cluster Health
| Metric | Alert Condition | Description |
|---|---|---|
pilot_cluster_under_replicated_partitions | minus pilot_cluster_urps_from_reassignments, > 0 for 5m | Partitions with ISR < replicas, not counting new replicas still copying |
pilot_cluster_offline_partitions | > 0 for 1m | Partitions with no leader |
pilot_cluster_brokers_unavailable | > 0 for 5m, with a current observation | Known brokers absent from Kafka’s broker roster |
pilot_cluster_broker_observation_current | == 0 for 1m | Broker discovery is unavailable |
pilot_cluster_broker_observation_expires_timestamp_seconds | < time() for 1m | Broker observation expired |
Broker counts retain their last successful values when discovery fails. Gate broker-count alerts on both pilot_cluster_broker_observation_current == 1 and pilot_cluster_broker_observation_expires_timestamp_seconds > time(). Keep a separate alert for failed or expired observations so a monitoring problem cannot appear healthy.
Operations
| Metric | Alert Condition | Description |
|---|---|---|
pilot_reassignment_last_progress_timestamp_seconds | stale > 2h while moves are active or pending | Reassignment stuck |
pilot_sampler_last_successful_collection_timestamp | stale > 60s | Sampler not collecting |
pilot_license_expiry_timestamp_seconds | < 7 days from now | License expiring soon |
pilot_audit_events_failure_total{error_type="dropped"} | increase > 0 in 15m | Audit events lost |
pilot_audit_events_failure_total{error_type="too_large"} | increase > 0 in 15m | HA audit event larger than one audit record or than the audit topic allows |
Performance
| Metric | Alert Condition | Description |
|---|---|---|
pilot_http_requests_total{status_code=~"5.."} | error rate > 1% | API errors |
pilot_http_request_duration_seconds | P99 > 5s | Slow API responses |
Alert Rules
Example Prometheus alert rules:
groups:
- name: pilot
rules:
- alert: KafkaUnderReplicatedPartitions
expr: pilot_cluster_under_replicated_partitions - pilot_cluster_urps_from_reassignments > 0
for: 5m
labels:
severity: warning
annotations:
summary: "Under-replicated partitions detected"
description: "{{ $value }} partitions have ISR < replicas, not counting new replicas still copying"
- alert: KafkaOfflinePartitions
expr: pilot_cluster_offline_partitions > 0
for: 1m
labels:
severity: critical
annotations:
summary: "Offline partitions detected"
description: "{{ $value }} partitions have no leader"
- alert: PilotSamplerStale
expr: time() - pilot_sampler_last_successful_collection_timestamp > 60
for: 2m
labels:
severity: warning
annotations:
summary: "Pilot sampler not collecting"
description: "No successful collection in over 60 seconds"
- alert: PilotLicenseExpiring
expr: pilot_license_expiry_timestamp_seconds - time() < 7 * 24 * 3600
labels:
severity: warning
annotations:
summary: "Pilot license expiring within 7 days"
- alert: PilotReassignmentStuck
expr: |
pilot_reassignment_active + pilot_reassignment_pending > 0
and time() - pilot_reassignment_last_progress_timestamp_seconds > 7200
labels:
severity: warning
annotations:
summary: "Partition reassignment made no progress for 2 hours"
- alert: PilotSelfHealingNotRunning
expr: |
(time() - pilot_selfhealing_last_success_timestamp_seconds{type="critical"} > 1800)
and ignoring(type) (pilot_cluster_under_replicated_partitions - pilot_cluster_urps_from_reassignments > 0)
unless ignoring(type) pilot_selfhealing_in_progress{type="critical"} == 1
for: 15m
labels:
severity: warning
annotations:
summary: "Critical self-healing not running while URPs exist"
- alert: PilotAuditEventsLost
expr: increase(pilot_audit_events_failure_total{error_type="dropped"}[15m]) > 0
labels:
severity: warning
annotations:
summary: "Audit events were lost"
- alert: PilotAuditEventTooLarge
expr: increase(pilot_audit_events_failure_total{error_type="too_large"}[15m]) > 0
labels:
severity: warning
annotations:
summary: "An HA audit event is larger than one audit record"Notes:
KafkaUnderReplicatedPartitions,PilotReassignmentStuckandPilotSelfHealingNotRunninguse metrics added in Pilot 0.29.0. On older versions they stay silent.PilotReassignmentStuckfires when moves are waiting or running and none started or finished for 2 hours. One very large partition can take longer. Set the threshold above your longest expected move (partition size divided by throttle rate).- The under-replicated alerts ignore partitions that are under-replicated only because a reassignment is still copying them.
See Prometheus Metrics for PromQL query examples.
Storage and Follower Lag Coverage
If a broker does not report storage or follower lag, Pilot shows that value as unavailable, never as zero. Pilot also shows how many brokers reported, for example 5/6 brokers. Totals that need every broker are unavailable until all brokers report.