Skip to content

Conversation

@klinch0
Copy link
Contributor

@klinch0 klinch0 commented Feb 3, 2025

Summary by CodeRabbit

  • New Features
    • Enhanced etcd monitoring with new metrics exposure, pod scraping configuration, and comprehensive alert rules for proactive observability.
    • Introduced a new VMPodScrape resource for improved pod metrics collection.
    • Added a new PrometheusRule configuration for monitoring etcd clusters with various alert conditions.
  • Chores
    • Upgraded the etcd release from version 2.4.0 to 2.5.0.
    • Consolidated and renamed monitoring dashboard references for better consistency.

@klinch0 klinch0 requested a review from kvaps as a code owner February 3, 2025 23:19
@dosubot dosubot bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Feb 3, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 3, 2025

Walkthrough

This pull request removes the obsolete Grafana dashboard configuration for etcd3 by deleting kube-etcd3.json and updates all related references to use kube-etcd. In addition, the dashboard download script has been modified to reflect the new file name. The update also bumps the etcd Chart version to 2.5.0, enhances the etcd cluster configuration by adding a dedicated metrics container, and introduces new monitoring resources including a VMPodScrape and Prometheus alert rules. Finally, the versions mapping for etcd has been updated to include a specific commit hash for version 2.4.0 and a new entry for 2.5.0.

Changes

Affected File(s) Change Summary
dashboards/.../kube-etcd3.json, hack/download-dashboards.sh, packages/.../monitoring/dashboards.list Deleted the obsolete kube-etcd3.json dashboard, updated the JSON file reference in the download script, and modified the dashboard listing to use kube-etcd.
packages/.../etcd/Chart.yaml, packages/.../etcd/templates/etcd-cluster.yaml, packages/.../etcd/templates/podscrape.yaml, packages/.../etcd/templates/prometheus-rules.yaml, packages/.../versions_map Updated etcd application version to 2.5.0; added a metrics container in the EtcdCluster configuration; introduced new VMPodScrape and PrometheusRule resources; updated version mappings with a specific commit hash for 2.4.0 and added a new entry for 2.5.0.

Possibly related PRs

  • Update dashboards #353: The deletion of kube-etcd3.json and the modification of the dashboard script indicate a direct relationship in terms of changes to the dashboard configurations for etcd.
  • Prepare release v0.16.3 #411: The deletion of the kube-etcd3.json file and the modification of the file path from kube-etcd3.json to kube-etcd.json indicate a direct relationship in terms of changes to the same file's naming and usage.
  • add grafana size configure #536: The changes involving the deletion of the kube-etcd3.json file are related to modifications that update references from kube-etcd3 to kube-etcd, indicating a direct connection in the context of Grafana dashboard configurations.

Suggested labels

size:L, lgtm

Suggested reviewers

  • kvaps

Poem

I'm a rabbit on a merry hop,
Code changes made my circuits pop!
Dashboards pruned and versions set anew,
With metrics ports shining bright and true,
I nibble on bugs, then dance in code delight 🐇✨!


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between a29b97f and 483d736.

📒 Files selected for processing (1)
  • packages/extra/etcd/templates/podscrape.yaml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/extra/etcd/templates/podscrape.yaml

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?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @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. (Beta)
  • @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.

@dosubot dosubot bot added the enhancement New feature or request label Feb 3, 2025
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 (1)
hack/download-dashboards.sh (1)

73-73: Reminder: Resolve TODOs and Check File Path Format

A TODO comment remains on line 73 alongside a file path containing a double slash (dashboards//kubernetes-cluster/nodes/ntp.json). Consider addressing the TODO and verifying that all file paths are correctly formed to avoid potential issues during dashboard downloads.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 835ee11 and a29b97f.

📒 Files selected for processing (8)
  • dashboards/control-plane/kube-etcd3.json (0 hunks)
  • hack/download-dashboards.sh (2 hunks)
  • packages/extra/etcd/Chart.yaml (1 hunks)
  • packages/extra/etcd/templates/etcd-cluster.yaml (1 hunks)
  • packages/extra/etcd/templates/podscrape.yaml (1 hunks)
  • packages/extra/etcd/templates/prometheus-rules.yaml (1 hunks)
  • packages/extra/monitoring/dashboards.list (1 hunks)
  • packages/extra/versions_map (1 hunks)
💤 Files with no reviewable changes (1)
  • dashboards/control-plane/kube-etcd3.json
✅ Files skipped from review due to trivial changes (3)
  • packages/extra/etcd/Chart.yaml
  • packages/extra/monitoring/dashboards.list
  • packages/extra/versions_map
🔇 Additional comments (3)
packages/extra/etcd/templates/podscrape.yaml (1)

1-11: Review: New VMPodScrape Resource Configuration

The YAML defines a new VMPodScrape resource for scraping etcd pod metrics. The API version (operator.victoriametrics.com/v1beta1), kind, metadata, and selector are correctly specified. Verify that your cluster’s operator supports this API version and consider whether "example-pod-scrape" should be renamed for production use.

packages/extra/etcd/templates/etcd-cluster.yaml (1)

43-48: Review: Metrics Container Addition in EtcdCluster Pod Template

The addition of the dedicated metrics container under the podTemplate is clear. Configuring the container with name etcd and exposing the metrics port on containerPort 2381 (TCP) aligns with the new monitoring strategy. Ensure this container definition integrates well with the rest of your workload specifications.

hack/download-dashboards.sh (1)

71-71: Review: Updated Dashboard JSON File Reference

The reference in line 71 has been updated from kube-etcd3.json to kube-etcd.json, which is consistent with the removal of the outdated Grafana dashboard configuration. Confirm that all downstream processes are updated to use the new filename.

Comment on lines +36 to +58
- alert: etcdHighNumberOfFailedGRPCRequests
annotations:
summary: "etcd cluster '{{`{{ $labels.job }}`}}': '{{`{{ $value }}`}}' of requests for '{{`{{ $labels.grpc_method }}`}}' failed on etcd instance '{{`{{ $labels.instance }}`}}'."
expr: |
100 * sum(rate(grpc_server_handled_total{job=~".*etcd.*", grpc_code!="OK"}[5m])) BY (job, instance, grpc_service, grpc_method)
/
sum(rate(grpc_server_handled_total{job=~".*etcd.*"}[5m])) BY (job, instance, grpc_service, grpc_method)
> 1
for: 10m
labels:
severity: warning

- alert: etcdHighNumberOfFailedGRPCRequests
annotations:
summary: "etcd cluster '{{`{{ $labels.job }}`}}': '{{`{{ $value }}`}}' of requests for '{{`{{ $labels.grpc_method }}`}}' failed on etcd instance '{{`{{ $labels.instance }}`}}'."
expr: |
100 * sum(rate(grpc_server_handled_total{job=~".*etcd.*", grpc_code!="OK"}[5m])) BY (job, instance, grpc_service, grpc_method)
/
sum(rate(grpc_server_handled_total{job=~".*etcd.*"}[5m])) BY (job, instance, grpc_service, grpc_method)
> 5
for: 5m
labels:
severity: critical
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Review: Duplicate GRPC Alert Rules Detected

Two alert rules named etcdHighNumberOfFailedGRPCRequests are defined with different thresholds and severity levels (one warning and one critical). Duplicate alert names can cause configuration conflicts or unexpected behavior in Prometheus. Consider renaming one of these alerts or consolidating the logic into a single rule with tiered thresholds.

Comment on lines +89 to +106
- alert: etcdHighNumberOfFailedHTTPRequests
annotations:
summary: "'{{`{{ $value }}`}}' of requests for '{{`{{ $labels.method }}`}}' failed on etcd instance '{{`{{ $labels.instance }}`}}'."
expr: |
sum(rate(etcd_http_failed_total{job=~".*etcd.*", code!="404"}[5m])) BY (method) / sum(rate(etcd_http_received_total{job=~".*etcd.*"}[5m])) BY (method) > 0.01
for: 10m
labels:
severity: warning

- alert: etcdHighNumberOfFailedHTTPRequests
annotations:
summary: "'{{`{{ $value }}`}}' of requests for '{{`{{ $labels.method }}`}}' failed on etcd instance '{{`{{ $labels.instance }}`}}'."
expr: |
sum(rate(etcd_http_failed_total{job=~".*etcd.*", code!="404"}[5m])) BY (method) / sum(rate(etcd_http_received_total{job=~".*etcd.*"}[5m])) BY (method) > 0.05
for: 10m
labels:
severity: critical

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Review: Duplicate HTTP Alert Rules Detected

Similarly, there are duplicate etcdHighNumberOfFailedHTTPRequests alerts with differing thresholds and severities. To maintain clarity and ensure correct alert evaluation, use unique alert names or combine the thresholds logically.

Copy link
Member

@lllamnyp lllamnyp left a comment

Choose a reason for hiding this comment

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

For 3m для etcdNotEnoughMembers многовато, а так аппрув

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Feb 5, 2025
Copy link
Member

@kvaps kvaps left a comment

Choose a reason for hiding this comment

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

LGTM

@kvaps kvaps merged commit 861e6c4 into cozystack:main Feb 5, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request lgtm This PR has been approved by a maintainer size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants