Skip to content

Conversation

@amuraru
Copy link

@amuraru amuraru commented Jun 28, 2022

Description

Kafka 3.0+ added support to fetch offset with the max timestamp.
This is useful in monitoring the steady progress of producing to a topic/partion
but also to detect very high timestamps in the topic that can stuck topic retention.

This patch adds two new metrics:

  • kafka_topic_partition_max_timestamp: for each topic partition reports the max timestamp in that partition
  • kafka_topic_max_timestamp: for each topic reports the max timestamp in that topic, computed as the maximum timestamp across partitions

See:

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

// NB: this requires Kafka Brokers 3.0+ (see https://issues.apache.org/jira/browse/KAFKA-12541)
// In older versions this is returning the timestamp of the low watermarks (earliest offset)
maxTimestampOffsets, err := e.minionSvc.ListOffsetsCached(ctx, -3)
if err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we expecting an error for brokers with version < 3.0.0 ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not an error but incorrect results:
"""In older versions this is returning the timestamp of the low watermarks (earliest offset)"""

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the clarification.

Copy link
Member

@alexander-falca alexander-falca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor question and then :shipit:

Kafka 3.0+ added support to fetch offset with the max timestamp.
This is useful in monitoring the steady progress of producing to a topic/partion
but also to detect very high timestamps in the topic that can stuck topic retention.

This patch adds two new metrics:
- kafka_topic_partition_max_timestamp: for each topic partition reports the max timestamp in that partition
- kafka_topic_max_timestamp: for each topic reports the max timestamp in that topic, computed as the maximum timestamp across partitions


See: 
- https://issues.apache.org/jira/browse/KAFKA-12541
- https://cwiki.apache.org/confluence/display/KAFKA/KIP-734%3A+Improve+AdminClient.listOffsets+to+return+timestamp+and+offset+for+the+record+with+the+largest+timestamp
@amuraru amuraru merged commit bff231e into main Sep 19, 2022
@amuraru amuraru deleted the maxts branch September 19, 2022 08:55
amuraru added a commit that referenced this pull request Dec 16, 2022
* Expose max timestamp for each topic and/or partition


Kafka 3.0+ added support to fetch offset with the max timestamp.
This is useful in monitoring the steady progress of producing to a topic/partion
but also to detect very high timestamps in the topic that can stuck topic retention.

This patch adds two new metrics:
- kafka_topic_partition_max_timestamp: for each topic partition reports the max timestamp in that partition
- kafka_topic_max_timestamp: for each topic reports the max timestamp in that topic, computed as the maximum timestamp across partitions


See: 
- https://issues.apache.org/jira/browse/KAFKA-12541
- https://cwiki.apache.org/confluence/display/KAFKA/KIP-734%3A+Improve+AdminClient.listOffsets+to+return+timestamp+and+offset+for+the+record+with+the+largest+timestamp

* Update prometheus/collect_topic_partition_offsets.go
amuraru added a commit that referenced this pull request Dec 16, 2022
* Expose max timestamp for each topic and/or partition


Kafka 3.0+ added support to fetch offset with the max timestamp.
This is useful in monitoring the steady progress of producing to a topic/partion
but also to detect very high timestamps in the topic that can stuck topic retention.

This patch adds two new metrics:
- kafka_topic_partition_max_timestamp: for each topic partition reports the max timestamp in that partition
- kafka_topic_max_timestamp: for each topic reports the max timestamp in that topic, computed as the maximum timestamp across partitions


See: 
- https://issues.apache.org/jira/browse/KAFKA-12541
- https://cwiki.apache.org/confluence/display/KAFKA/KIP-734%3A+Improve+AdminClient.listOffsets+to+return+timestamp+and+offset+for+the+record+with+the+largest+timestamp

* Update prometheus/collect_topic_partition_offsets.go
amuraru added a commit that referenced this pull request May 5, 2023
* Expose max timestamp for each topic and/or partition


Kafka 3.0+ added support to fetch offset with the max timestamp.
This is useful in monitoring the steady progress of producing to a topic/partion
but also to detect very high timestamps in the topic that can stuck topic retention.

This patch adds two new metrics:
- kafka_topic_partition_max_timestamp: for each topic partition reports the max timestamp in that partition
- kafka_topic_max_timestamp: for each topic reports the max timestamp in that topic, computed as the maximum timestamp across partitions


See: 
- https://issues.apache.org/jira/browse/KAFKA-12541
- https://cwiki.apache.org/confluence/display/KAFKA/KIP-734%3A+Improve+AdminClient.listOffsets+to+return+timestamp+and+offset+for+the+record+with+the+largest+timestamp

* Update prometheus/collect_topic_partition_offsets.go
amuraru added a commit that referenced this pull request May 5, 2023
* Expose max timestamp for each topic and/or partition


Kafka 3.0+ added support to fetch offset with the max timestamp.
This is useful in monitoring the steady progress of producing to a topic/partion
but also to detect very high timestamps in the topic that can stuck topic retention.

This patch adds two new metrics:
- kafka_topic_partition_max_timestamp: for each topic partition reports the max timestamp in that partition
- kafka_topic_max_timestamp: for each topic reports the max timestamp in that topic, computed as the maximum timestamp across partitions


See: 
- https://issues.apache.org/jira/browse/KAFKA-12541
- https://cwiki.apache.org/confluence/display/KAFKA/KIP-734%3A+Improve+AdminClient.listOffsets+to+return+timestamp+and+offset+for+the+record+with+the+largest+timestamp

* Update prometheus/collect_topic_partition_offsets.go
amuraru added a commit that referenced this pull request May 14, 2023
* Expose max timestamp for each topic and/or partition


Kafka 3.0+ added support to fetch offset with the max timestamp.
This is useful in monitoring the steady progress of producing to a topic/partion
but also to detect very high timestamps in the topic that can stuck topic retention.

This patch adds two new metrics:
- kafka_topic_partition_max_timestamp: for each topic partition reports the max timestamp in that partition
- kafka_topic_max_timestamp: for each topic reports the max timestamp in that topic, computed as the maximum timestamp across partitions


See: 
- https://issues.apache.org/jira/browse/KAFKA-12541
- https://cwiki.apache.org/confluence/display/KAFKA/KIP-734%3A+Improve+AdminClient.listOffsets+to+return+timestamp+and+offset+for+the+record+with+the+largest+timestamp

* Update prometheus/collect_topic_partition_offsets.go
amuraru added a commit that referenced this pull request Sep 13, 2025
* Expose max timestamp for each topic and/or partition


Kafka 3.0+ added support to fetch offset with the max timestamp.
This is useful in monitoring the steady progress of producing to a topic/partion
but also to detect very high timestamps in the topic that can stuck topic retention.

This patch adds two new metrics:
- kafka_topic_partition_max_timestamp: for each topic partition reports the max timestamp in that partition
- kafka_topic_max_timestamp: for each topic reports the max timestamp in that topic, computed as the maximum timestamp across partitions


See: 
- https://issues.apache.org/jira/browse/KAFKA-12541
- https://cwiki.apache.org/confluence/display/KAFKA/KIP-734%3A+Improve+AdminClient.listOffsets+to+return+timestamp+and+offset+for+the+record+with+the+largest+timestamp

* Update prometheus/collect_topic_partition_offsets.go
amuraru added a commit that referenced this pull request Oct 15, 2025
* Expose max timestamp for each topic and/or partition


Kafka 3.0+ added support to fetch offset with the max timestamp.
This is useful in monitoring the steady progress of producing to a topic/partion
but also to detect very high timestamps in the topic that can stuck topic retention.

This patch adds two new metrics:
- kafka_topic_partition_max_timestamp: for each topic partition reports the max timestamp in that partition
- kafka_topic_max_timestamp: for each topic reports the max timestamp in that topic, computed as the maximum timestamp across partitions


See: 
- https://issues.apache.org/jira/browse/KAFKA-12541
- https://cwiki.apache.org/confluence/display/KAFKA/KIP-734%3A+Improve+AdminClient.listOffsets+to+return+timestamp+and+offset+for+the+record+with+the+largest+timestamp

* Update prometheus/collect_topic_partition_offsets.go
amuraru added a commit that referenced this pull request Oct 16, 2025
* Expose max timestamp for each topic and/or partition

Kafka 3.0+ added support to fetch offset with the max timestamp.
This is useful in monitoring the steady progress of producing to a topic/partion
but also to detect very high timestamps in the topic that can stuck topic retention.

This patch adds two new metrics:
- kafka_topic_partition_max_timestamp: for each topic partition reports the max timestamp in that partition
- kafka_topic_max_timestamp: for each topic reports the max timestamp in that topic, computed as the maximum timestamp across partitions

See:
- https://issues.apache.org/jira/browse/KAFKA-12541
- https://cwiki.apache.org/confluence/display/KAFKA/KIP-734%3A+Improve+AdminClient.listOffsets+to+return+timestamp+and+offset+for+the+record+with+the+largest+timestamp

* Update prometheus/collect_topic_partition_offsets.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants