KafkaTopicOffsetDecreased #
Kafka topic offset has decreased
Alert Rule
alert: KafkaTopicOffsetDecreased
annotations:
description: |-
Kafka topic offset has decreased
VALUE = {{ $value }}
LABELS = {{ $labels }}
runbook: https://srerun.github.io/prometheus-alerts/runbooks/linkedin-kafka-exporter/kafkatopicoffsetdecreased/
summary: Kafka topic offset decreased (instance {{ $labels.instance }})
expr: delta(kafka_burrow_partition_current_offset[1m]) < 0
for: 0m
labels:
severity: warning
Here is a runbook for the KafkaTopicOffsetDecreased alert:
Meaning #
The KafkaTopicOffsetDecreased alert is triggered when the current offset of a Kafka topic partition decreases. This can indicate a problem with the Kafka consumers or the Kafka broker itself. A decreasing offset can lead to data loss or duplication, depending on the configuration of the consumers.
Impact #
The impact of a decreasing Kafka topic offset can be significant, leading to:
- Data loss or duplication
- Inconsistent data processing
- Consumer lag or failure
- Potential disruption to downstream applications
Diagnosis #
To diagnose the issue, follow these steps:
- Check the Kafka console consumer or Kafka Tool to verify the current offset and verify that it is decreasing.
- Investigate the Kafka consumer logs to identify any errors or issues that may be causing the offset to decrease.
- Check the Kafka broker logs to identify any issues with the broker that may be causing the offset to decrease.
- Verify that the Kafka consumer configuration is correct and that the consumer is properly configured to commit offsets.
- Check for any network connectivity issues between the Kafka consumer and the Kafka broker.
Mitigation #
To mitigate the issue, follow these steps:
- Identify and resolve the root cause of the offset decrease, such as fixing consumer configuration issues or resolving network connectivity problems.
- Use the Kafka console consumer or Kafka Tool to manually adjust the offset to the correct position.
- If the issue is caused by a consumer failure, restart the consumer and verify that it is properly consuming from the correct offset.
- Consider increasing the
offsets.retention.minutes
configuration in the Kafka broker to ensure that offsets are retained for a longer period, allowing for easier recovery in case of an offset decrease. - Consider implementing offset monitoring and alerting to quickly detect and respond to offset decreases.