-
Notifications
You must be signed in to change notification settings - Fork 710
feat: Expose license status, limits, and features in diagnose output #23885
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 license information to RisingWave's diagnostic output, enabling operators to easily view license status, resource limits, and available features when troubleshooting or monitoring the system.
Key Changes:
- Adds license status, tier, expiration, and resource limits (RWU, CPU cores, memory) to diagnostic reports
- Includes formatted list of available features based on license tier
- Handles both valid and invalid license states with appropriate error messaging
| let expires_at = if license.exp == u64::MAX { | ||
| "never".to_owned() | ||
| } else if license.exp > i64::MAX as u64 { | ||
| format!("invalid ({})", license.exp) |
Copilot
AI
Nov 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The magic number check i64::MAX for timestamp validation is duplicated. Consider extracting the timestamp formatting logic into a helper function that handles both validation and formatting to improve code reusability and reduce duplication.
| let mut row = Row::new(); | ||
| row.add_cell("status".into()); | ||
| row.add_cell("valid".into()); | ||
| table.add_row(row); | ||
|
|
||
| let mut row = Row::new(); | ||
| row.add_cell("tier".into()); | ||
| row.add_cell(format!("{:?}", license.tier).into()); | ||
| table.add_row(row); | ||
|
|
||
| let mut row = Row::new(); | ||
| row.add_cell("expires_at".into()); | ||
| row.add_cell(expires_at.into()); | ||
| table.add_row(row); | ||
|
|
||
| let mut row = Row::new(); | ||
| row.add_cell("rwu_limit".into()); | ||
| row.add_cell(fmt_option(license.rwu_limit.map(|v| v.get())).into()); | ||
| table.add_row(row); | ||
|
|
||
| let mut row = Row::new(); | ||
| row.add_cell("cpu_core_limit".into()); | ||
| row.add_cell(fmt_option(license.cpu_core_limit()).into()); | ||
| table.add_row(row); | ||
|
|
||
| let mut row = Row::new(); | ||
| row.add_cell("memory_limit_bytes".into()); | ||
| row.add_cell(fmt_option(license.memory_limit()).into()); | ||
| table.add_row(row); |
Copilot
AI
Nov 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The repetitive pattern of creating rows and adding cells can be refactored into a helper function. Consider creating a helper that takes a label and value to reduce code duplication and improve maintainability.
BugenZhao
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest LGTM
| } else if license.exp > i64::MAX as u64 { | ||
| format!("invalid ({})", license.exp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also treat this case as "never".
|
|
||
| let mut row = Row::new(); | ||
| row.add_cell("tier".into()); | ||
| row.add_cell(format!("{:?}", license.tier).into()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the debug repr might be verbose. Given that we already have the "feature_summary" row, shall we add a fn name to Tier to only obtain the tier name, like
- free
- paid
- all
<custom name>
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
as title
Checklist
Documentation
Release note