Skip to content

metrics: Recommend better metrics for global produce/consume TP #1269

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

Merged
merged 1 commit into from
Aug 8, 2025

Conversation

StephanDollberg
Copy link
Member

We added these metrics a long while ago for better monitoring of global produce/consume throughput.

They don't suffer from various issues (prometheus bugs, including non-returned bytes) like the per partition metrics.

See redpanda-data/redpanda#14836 for more background.

Hence, recommend them for total produce/consume TP monitoring.

Description

Resolves https://redpandadata.atlassian.net/browse/
Review deadline:

Page previews

Checks

  • New feature
  • Content gap
  • Support Follow-up
  • Small fix (typos, links, copyedits, etc)

@StephanDollberg StephanDollberg requested a review from a team as a code owner August 1, 2025 12:14
Copy link
Contributor

coderabbitai bot commented Aug 1, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

The changes update documentation to replace references to the Kafka-specific metric redpanda_kafka_request_bytes_total with the more general Redpanda RPC metrics redpanda_rpc_sent_bytes and redpanda_rpc_received_bytes. Instructions and PromQL queries for monitoring producer and consumer throughput now use these new metrics, specifically filtered by the redpanda_server="kafka" label. No changes were made to logic, code, or control flow, and no public or exported entities were altered.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch stephan/fix-public-total-tp-metrics

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

netlify bot commented Aug 1, 2025

Deploy Preview for redpanda-docs-preview ready!

Name Link
🔨 Latest commit d4b56ce
🔍 Latest deploy log https://app.netlify.com/projects/redpanda-docs-preview/deploys/6894dad5055c190008e15bba
😎 Deploy Preview https://deploy-preview-1269--redpanda-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
modules/upgrade/partials/rolling-upgrades/check-metrics.adoc (1)

19-22: Describe counters accurately and remind users to wrap them in rate()

redpanda_rpc_received_bytes and redpanda_rpc_sent_bytes are monotonically-increasing counters (bytes received vs sent).
Calling them “Total bytes processed” is vague and, more importantly, the table omits the usual guidance to wrap counters in a rate() query. Consider tightening the wording and adding the rate() reminder so users don’t mis-interpret the raw counter values as throughput.

-| Total bytes processed for Kafka requests.
+| Counters for bytes **received from** (produce) and **sent to** (consume) Kafka clients.  
+Use `rate(<metric>[5m])` (or a similar interval) to convert these counters into per-second throughput.

Also double-check that the two new xrefs resolve—broken anchors will render as plain text.

modules/manage/partials/monitor-health.adoc (1)

92-93: Phrasing nit – reorder for clarity

“with the kafka redpanda_server label” reads awkwardly. Swapping the order clarifies that kafka is the label value:

-monitor … with the `kafka` `redpanda_server` label.
+monitor … with the label `redpanda_server="kafka"`.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f137bff and 79679bc.

📒 Files selected for processing (2)
  • modules/manage/partials/monitor-health.adoc (2 hunks)
  • modules/upgrade/partials/rolling-upgrades/check-metrics.adoc (1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: JakeSCahill
PR: redpanda-data/docs#1192
File: modules/deploy/partials/requirements.adoc:91-93
Timestamp: 2025-07-02T14:54:03.506Z
Learning: In Redpanda documentation, use GiB (binary units, powers of 2) for Kubernetes-specific memory requirements because Kubernetes treats memory units like Mi, Gi as binary units. Use GB (decimal units, powers of 10) for general broker memory requirements in non-Kubernetes contexts.
Learnt from: Feediver1
PR: redpanda-data/docs#1153
File: modules/reference/pages/properties/topic-properties.adoc:45-50
Timestamp: 2025-07-16T19:33:20.420Z
Learning: In the Redpanda documentation, topic property cross-references like <<max.compaction.lag.ms>> and <<min.compaction.lag.ms>> require corresponding property definition sections with anchors like [[maxcompactionlagms]] and [[mincompactionlagms]] to prevent broken links.
Learnt from: Feediver1
PR: redpanda-data/docs#1153
File: antora.yml:3-5
Timestamp: 2025-07-14T19:28:43.296Z
Learning: In Redpanda docs, during beta releases, the version metadata may intentionally show inconsistencies where the header displays the beta version (e.g., 25.2 Beta) while internal attributes like full-version, latest-redpanda-tag, operator-beta-tag still reference the stable version (e.g., 25.1). This is resolved during the GA merge process when all version references are synchronized.
Learnt from: paulohtb6
PR: redpanda-data/docs#0
File: :0-0
Timestamp: 2025-07-15T20:38:27.458Z
Learning: In Redpanda documentation, "Redpanda Data" refers to the company name, while "Redpanda" refers to the product name. These terms should be used appropriately based on context.
📚 Learning: in the redpanda documentation, topic property cross-references like <> and <<...
Learnt from: Feediver1
PR: redpanda-data/docs#1153
File: modules/reference/pages/properties/topic-properties.adoc:45-50
Timestamp: 2025-07-16T19:33:20.420Z
Learning: In the Redpanda documentation, topic property cross-references like <<max.compaction.lag.ms>> and <<min.compaction.lag.ms>> require corresponding property definition sections with anchors like [[maxcompactionlagms]] and [[mincompactionlagms]] to prevent broken links.

Applied to files:

  • modules/upgrade/partials/rolling-upgrades/check-metrics.adoc
  • modules/manage/partials/monitor-health.adoc
📚 Learning: in redpanda docs, during beta releases, the version metadata may intentionally show inconsistencies ...
Learnt from: Feediver1
PR: redpanda-data/docs#1153
File: antora.yml:3-5
Timestamp: 2025-07-14T19:28:43.296Z
Learning: In Redpanda docs, during beta releases, the version metadata may intentionally show inconsistencies where the header displays the beta version (e.g., 25.2 Beta) while internal attributes like full-version, latest-redpanda-tag, operator-beta-tag still reference the stable version (e.g., 25.1). This is resolved during the GA merge process when all version references are synchronized.

Applied to files:

  • modules/upgrade/partials/rolling-upgrades/check-metrics.adoc
📚 Learning: in redpanda documentation, use gib (binary units, powers of 2) for kubernetes-specific memory requir...
Learnt from: JakeSCahill
PR: redpanda-data/docs#1192
File: modules/deploy/partials/requirements.adoc:91-93
Timestamp: 2025-07-02T14:54:03.506Z
Learning: In Redpanda documentation, use GiB (binary units, powers of 2) for Kubernetes-specific memory requirements because Kubernetes treats memory units like Mi, Gi as binary units. Use GB (decimal units, powers of 10) for general broker memory requirements in non-Kubernetes contexts.

Applied to files:

  • modules/upgrade/partials/rolling-upgrades/check-metrics.adoc
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Redirect rules - redpanda-docs-preview
  • GitHub Check: Header rules - redpanda-docs-preview
  • GitHub Check: Pages changed - redpanda-docs-preview

Comment on lines +100 to 101
rate(redpanda_rpc_received_bytes{redpanda_server="kafka"}[$__rate_interval])
----

This comment was marked as spam.

Comment on lines +109 to 110
rate(redpanda_rpc_sent_bytes{redpanda_server="kafka"}[$__rate_interval])
----

This comment was marked as spam.

Copy link
Contributor

@Feediver1 Feediver1 left a comment

Choose a reason for hiding this comment

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

lgtm


==== Producer throughput

For the produce rate, create a query to get the produce rate across all topics:

[,promql]
----
sum(rate(redpanda_kafka_request_bytes_total{redpanda_request="produce"} [5m] )) by (redpanda_request)
rate(redpanda_rpc_received_bytes{redpanda_server="kafka"}[$__rate_interval])
Copy link
Member

Choose a reason for hiding this comment

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

Any comment on dropping sum? All series will be present in the result, I think it's consistent with line 96 right above?

Copy link
Member Author

Choose a reason for hiding this comment

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

All series will be present in the result

Just to clarify, there is no topic here so there will be one series per broker.

Any comment on dropping sum?

I mean this example query seems fairly arbitrary to me. You'll likely have to modify it anyway to add a cluster label or something.

We could just do any empty sum by which again would aggregate everything but that seems kinda wrong to me. No strong feelings though.

Copy link
Member

Choose a reason for hiding this comment

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

I like it how you have it, not sure what I was even thinking here (as it's consistent with the other queries I can see in the doc).

Copy link
Member

@travisdowns travisdowns left a comment

Choose a reason for hiding this comment

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

Review complete with comments.

@StephanDollberg StephanDollberg force-pushed the stephan/fix-public-total-tp-metrics branch from 79679bc to 0597cfe Compare August 4, 2025 08:24

==== Producer throughput

For the produce rate, create a query to get the produce rate across all topics:

[,promql]
----
sum(rate(redpanda_kafka_request_bytes_total{redpanda_request="produce"} [5m] )) by (redpanda_request)
rate(redpanda_rpc_received_bytes{redpanda_server="kafka"}[$__rate_interval])
Copy link
Member

Choose a reason for hiding this comment

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

I like it how you have it, not sure what I was even thinking here (as it's consistent with the other queries I can see in the doc).

We added these metrics a long while ago for better monitoring of global
produce/consume throughput.

They don't suffer from various issues (prometheus bugs, including
non-returned bytes) like the per partition metrics.

See redpanda-data/redpanda#14836 for more
background.

Hence, recommend them for total produce/consume TP monitoring.
@StephanDollberg StephanDollberg force-pushed the stephan/fix-public-total-tp-metrics branch from 0597cfe to d4b56ce Compare August 7, 2025 16:56
@StephanDollberg StephanDollberg merged commit 47f1c1d into main Aug 8, 2025
7 checks passed
@StephanDollberg StephanDollberg deleted the stephan/fix-public-total-tp-metrics branch August 8, 2025 08:20
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