Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Measure kafka queue in consumer with better exactitude #3423

Merged
merged 6 commits into from
Mar 13, 2018

Conversation

vvraskin
Copy link
Contributor

Measure kafka queue metric directly in the consumer by comparing the offsets instead of relying on the built-in consumer metrics. This method provides more precision compared to the old approach, it was observed that the built-in metrics show certain lagging in case of burst.
Additionally make kamon flush cadency configurable in the application.conf.

My changes affect the following components

  • [x ] Message Bus (e.g., Kafka)

Types of changes

  • [x ] Enhancement or new feature (adds new functionality).

consumer.poll(duration.toMillis).map(r => (r.topic, r.partition, r.offset, r.value))
val response = consumer.poll(duration.toMillis).map(r => (r.topic, r.partition, r.offset, r.value))
response.lastOption.foreach {
case (_, _, newOffset, _) => offset = newOffset + 1
Copy link
Member

Choose a reason for hiding this comment

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

Can you fold this into the previous map instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean updating the offset each time new message arrives?

Copy link
Contributor

@markusthoemmes markusthoemmes left a comment

Choose a reason for hiding this comment

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

LGTM, thank you 👍 🎉

@markusthoemmes markusthoemmes merged commit 24d10fb into apache:master Mar 13, 2018
@vvraskin vvraskin deleted the kafka_queue_update branch April 6, 2018 05:37
BillZong pushed a commit to BillZong/openwhisk that referenced this pull request Nov 18, 2019
Measure kafka queue metric directly in the consumer by comparing the offsets instead of relying on the built-in consumer metrics. This method provides more precision compared to the old approach, it was observed that the built-in metrics show certain lagging in case of burst.
Additionally make kamon flush cadency configurable in the application.conf.
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