Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 20 additions & 10 deletions arroyo/backends/kafka/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,20 +273,30 @@ def __on_commit_callback(
tags = {"status": "error"}
if self.__group_id:
tags["group_id"] = self.__group_id
self.__metrics.increment(
name="arroyo.consumer.commit_status",
value=1,
tags=tags,
)
try:
self.__metrics.increment(
name="arroyo.consumer.commit_status",
value=1,
tags=tags,
)
except Exception as e:
logger.debug(
"Failed to record commit status metric: %s", e, exc_info=False
)
Comment on lines +276 to +285
Copy link
Member

Choose a reason for hiding this comment

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

Should we consolidate the try/except and metrics.increment() call as both sides of the branch have the same logic.

else:
tags = {"status": "success"}
if self.__group_id:
tags["group_id"] = self.__group_id
self.__metrics.increment(
name="arroyo.consumer.commit_status",
value=1,
tags=tags,
)
try:
self.__metrics.increment(
name="arroyo.consumer.commit_status",
value=1,
tags=tags,
)
except Exception as e:
logger.debug(
"Failed to record commit status metric: %s", e, exc_info=False
)

def __resolve_partition_offset_earliest(
self, partition: ConfluentTopicPartition
Expand Down