-
Notifications
You must be signed in to change notification settings - Fork 6
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
refactor: add slow query logging options #191
Conversation
WalkthroughThe changes involve an update to the Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (4)
charts/greptimedb-cluster/templates/cluster.yaml (1)
488-493
: LGTM! Consider adding value validation.The slow query logging configuration is well-structured and properly integrated into the existing logging section. The implementation follows Helm best practices with proper conditional checks and consistent formatting.
Consider adding validation for the input values:
- Ensure the threshold format is valid (e.g., "10s", "1m")
- Verify sampleRatio is between 0 and 1
Example validation using Helm's
required
andfail
functions:{{- if .Values.logging.slowQuery.enabled }} slowQuery: enabled: {{ .Values.logging.slowQuery.enabled }} + {{- if not (regexMatch "^[0-9]+(ns|us|ms|s|m|h)$" .Values.logging.slowQuery.threshold) }} + {{- fail "slowQuery.threshold must be a valid duration (e.g., 10s, 1m)" }} + {{- end }} threshold: {{ .Values.logging.slowQuery.threshold }} + {{- $ratio := float64 .Values.logging.slowQuery.sampleRatio }} + {{- if or (lt $ratio 0.0) (gt $ratio 1.0) }} + {{- fail "slowQuery.sampleRatio must be between 0 and 1" }} + {{- end }} sampleRatio: {{ .Values.logging.slowQuery.sampleRatio | quote }} {{- end }}charts/greptimedb-cluster/values.yaml (2)
781-782
: Consider adding units documentation for threshold.While "10s" implies seconds, it would be helpful to explicitly document the supported duration units (e.g., "ms", "s", "m") in the comment.
- # -- The threshold of slow query log in seconds. + # -- The threshold of slow query log. Supported units: ms, s, m (e.g., "100ms", "10s", "1m").
784-785
: Consider adding validation range for sample ratio.The comment should specify that the sample ratio must be between 0.0 and 1.0.
- # -- Sample ratio of slow query log. + # -- Sample ratio of slow query log (must be between 0.0 and 1.0).charts/greptimedb-cluster/README.md (1)
216-225
: Documentation could be enhanced with parameter constraints.The slow query logging configuration is well-documented, but consider adding:
- Valid range for
sampleRatio
(e.g., 0.0 to 1.0)- Minimum/maximum values for
threshold
| logging.slowQuery | object | `{"enabled":false,"sampleRatio":"1.0","threshold":"10s"}` | The slow query log configuration. | | logging.slowQuery.enabled | bool | `false` | Enable slow query log. | -| logging.slowQuery.sampleRatio | string | `"1.0"` | Sample ratio of slow query log. | -| logging.slowQuery.threshold | string | `"10s"` | The threshold of slow query log in seconds. | +| logging.slowQuery.sampleRatio | string | `"1.0"` | Sample ratio of slow query log (range: 0.0 to 1.0). | +| logging.slowQuery.threshold | string | `"10s"` | The threshold of slow query log (minimum: 1s). |
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (4)
charts/greptimedb-cluster/Chart.yaml
(1 hunks)charts/greptimedb-cluster/README.md
(2 hunks)charts/greptimedb-cluster/templates/cluster.yaml
(1 hunks)charts/greptimedb-cluster/values.yaml
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- charts/greptimedb-cluster/Chart.yaml
🔇 Additional comments (2)
charts/greptimedb-cluster/values.yaml (1)
776-786
: LGTM! Well-structured slow query logging configuration.
The new slow query logging configuration is well-organized and properly documented. The parameters are sensible with good default values:
enabled: false
- Safe default that requires explicit opt-inthreshold: "10s"
- Reasonable default thresholdsampleRatio: "1.0"
- Full sampling by default
Let's verify the integration with Grafana dashboards since the configuration mentions a slow queries dashboard:
charts/greptimedb-cluster/README.md (1)
5-5
: LGTM: Version update is consistent.
The version badge has been correctly updated to reflect the new version 0.2.26.
Summary by CodeRabbit