Skip to content

Comments

Add prometheus metric reporting for ruby-kafka#15

Open
dhruvparanjape wants to merge 6 commits intov0.6-catawikifrom
prometheus_metrics
Open

Add prometheus metric reporting for ruby-kafka#15
dhruvparanjape wants to merge 6 commits intov0.6-catawikifrom
prometheus_metrics

Conversation

@dhruvparanjape
Copy link

copied as is from upstream https://github.com/zendesk/ruby-kafka

Copilot AI review requested due to automatic review settings July 30, 2025 12:48
@dhruvparanjape dhruvparanjape requested a review from a team as a code owner July 30, 2025 12:48

This comment was marked as outdated.

@dhruvparanjape dhruvparanjape requested a review from Copilot July 30, 2025 13:23
@dhruvparanjape dhruvparanjape self-assigned this Jul 30, 2025

This comment was marked as outdated.

This comment was marked as outdated.

@dhruvparanjape dhruvparanjape requested a review from Copilot July 30, 2025 13:33

This comment was marked as outdated.

@dhruvparanjape dhruvparanjape requested a review from Copilot July 30, 2025 13:39
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds Prometheus metric reporting support for the ruby-kafka library by implementing a comprehensive monitoring system. The implementation includes metrics tracking for various Kafka operations including producer, consumer, and connection activities.

  • Implements Prometheus metrics collection for Kafka operations using ActiveSupport subscribers
  • Adds comprehensive test coverage for all monitored Kafka events and metrics
  • Extends consumer batch processing to include last message create time for time lag calculations

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
lib/kafka/prometheus.rb Core implementation of Prometheus metrics collection with subscriber classes for different Kafka components
spec/prometheus_spec.rb Comprehensive test suite covering all Prometheus metrics and event scenarios
lib/kafka/consumer.rb Minor enhancement to include last message create time in batch processing payload
Gemfile Adds prometheus-client gem dependency for development/test environments

Copy link

@nithyanandankm nithyanandankm left a comment

Choose a reason for hiding this comment

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

Overall looks good, nice one!

Is there an easy way to generate some metrics in staging to make sure that it works as expected?

@fcbr
Copy link
Member

fcbr commented Jul 31, 2025

why are you only adding metrics to the consumer?

@dhruvparanjape
Copy link
Author

dhruvparanjape commented Jul 31, 2025

Overall looks good, nice one!

Is there an easy way to generate some metrics in staging to make sure that it works as expected?

I would have to create a pre-release gem which isn't the easiest for this gem. Since this is an opt-in feature I am not sure if it would break anything. LMK if I am missing anything

@dhruvparanjape
Copy link
Author

why are you only adding metrics to the consumer?

Um metrics are for both producers and consumers. The consumer was missing a data point so I added that.

Copy link
Member

@fcbr fcbr left a comment

Choose a reason for hiding this comment

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

LGTM but I strongly recommend manually publishing a pre-release version and testing this before merging this.

You can just use gem release and use semver to mark it as -alpha and it should work fine. I've done this in the past - here's some reference docs. You need a PAT with the proper permissions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants