Skip to content

Commit aed9a66

Browse files
piochelepiotrclaude
andcommitted
kafka_consumer: shorten get_partition_offsets docstring
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 1551963 commit aed9a66

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

  • kafka_consumer/datadog_checks/kafka_consumer

kafka_consumer/datadog_checks/kafka_consumer/client.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,7 @@ def consumer_get_cluster_id_and_list_topics(self, consumer_group):
148148
return (cluster_id, [(name, list(metadata.partitions)) for name, metadata in cluster_metadata.topics.items()])
149149

150150
def get_partition_offsets(self, partitions, offset=-1):
151-
"""Fetch latest (offset=-1) or earliest (offset=0) offsets for the given (topic, partition) pairs.
152-
153-
Uses AdminClient.list_offsets, which returns a future per partition, so a single
154-
unresolvable partition (e.g. a leaderless/offline topic that raises UNKNOWN_TOPIC_OR_PART)
155-
is skipped individually instead of failing the whole call.
156-
"""
151+
"""Return [(topic, partition, offset)] (latest, or earliest when offset=0), skipping partitions that can't be queried."""
157152
offset_spec = OffsetSpec.earliest() if offset == 0 else OffsetSpec.latest()
158153
request = {TopicPartition(topic=topic, partition=partition): offset_spec for topic, partition in partitions}
159154
if not request:

0 commit comments

Comments
 (0)