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

refactor: use file storage for monitoring standalone by default #196

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

zyy17
Copy link
Collaborator

@zyy17 zyy17 commented Oct 23, 2024

Summary by CodeRabbit

  • New Features

    • Introduced a new default data size for monitoring set to "30Gi".
    • Updated configurations for file storage in monitoring, emphasizing performance improvements.
  • Bug Fixes

    • Streamlined the logging configuration to use JSON format when monitoring is enabled.
  • Documentation

    • Updated configuration expectations for GreptimeDBCluster, reflecting changes in storage size and removal of object storage settings.

Copy link
Contributor

coderabbitai bot commented Oct 23, 2024

Walkthrough

The pull request introduces a new constant, DefaultDataSizeForMonitoring, set to "30Gi", to the constants.go file. It also modifies the GreptimeDBCluster and GreptimeDBStandalone structures in defaulting.go, focusing on default specifications and logging configurations. Notably, the handling of object storage is removed, defaulting to file storage with a new DatanodeStorageSpec. Additionally, updates are made to the expect.yaml file to reflect changes in storage size and the removal of object storage parameters.

Changes

File Path Change Summary
apis/v1alpha1/constants.go Added constant: DefaultDataSizeForMonitoring = "30Gi"
apis/v1alpha1/defaulting.go Updated SetDefaults methods for GreptimeDBCluster and GreptimeDBStandalone; removed object storage handling; adjusted logging configurations; updated liveness probe settings.
apis/v1alpha1/testdata/defaulting/greptimedbcluster/setdefaults/test03/expect.yaml Updated storageSize from 10Gi to 30Gi; removed objectStorage section under monitoring.

Possibly related PRs

Suggested reviewers

  • daviderli614

Poem

In the land of data, where clusters play,
A new size for monitoring has come to stay.
From ten to thirty, the change is bright,
File storage now shines, a new guiding light.
With logs in JSON, we’ll track with glee,
In the world of Greptime, hop along with me! 🐇✨


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 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
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: 0

🧹 Outside diff range and nitpick comments (1)
apis/v1alpha1/defaulting.go (1)

229-237: Document the storage configuration change in release notes.

This change in default storage configuration for monitoring is significant enough to warrant:

  1. Clear documentation in release notes about the switch to file storage
  2. Migration guide for users currently using object storage
  3. Testing guidelines for validating monitoring data persistence

Would you like me to help draft the documentation or migration guide?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 46697f2 and cb05f77.

📒 Files selected for processing (3)
  • apis/v1alpha1/constants.go (1 hunks)
  • apis/v1alpha1/defaulting.go (1 hunks)
  • apis/v1alpha1/testdata/defaulting/greptimedbcluster/setdefaults/test03/expect.yaml (1 hunks)
🧰 Additional context used
🔇 Additional comments (4)
apis/v1alpha1/testdata/defaulting/greptimedbcluster/setdefaults/test03/expect.yaml (2)

84-84: LGTM: Storage size aligns with new default value.

The increase to 30Gi for monitoring storage matches the newly introduced DefaultDataSizeForMonitoring constant.


Line range hint 1-116: Verify object storage configuration removal.

The AI summary indicates that object storage configuration should be removed from the monitoring section, but I notice the file still contains object storage configuration at the root level. Let's verify this is the intended behavior.

✅ Verification successful

Let me gather more specific information about the object storage configuration in these test files.


Based on the results, I can now provide a final response:

Object storage configuration is correctly placed at root level only

The verification shows that:

  1. Object storage is consistently configured at the root level of the GreptimeDBCluster spec in both test02 and test03
  2. There is no object storage configuration under the monitoring section in any of the test files
  3. A validation test comment explicitly states that "multiple objectStorage configs are not allowed"

The current configuration in the reviewed file is correct - object storage should only be present at the root level and not in the monitoring section.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the object storage configuration pattern across test files
# Expected: Root level object storage may be present, but monitoring section should not have object storage

# Check for object storage configuration patterns in test files
echo "Checking object storage patterns in test files..."
rg -l 'objectStorage:' 'apis/v1alpha1/testdata/defaulting'

# Check specifically for object storage under monitoring section
echo "Checking for object storage under monitoring section..."
rg -l 'monitoring:\s+objectStorage:' 'apis/v1alpha1/testdata/defaulting'

Length of output: 689


Script:

#!/bin/bash
# Let's examine the content around object storage configuration in these files
echo "=== Checking test02 input ==="
rg -A 5 -B 5 'objectStorage:' 'apis/v1alpha1/testdata/defaulting/greptimedbcluster/setdefaults/test02/input.yaml'

echo -e "\n=== Checking test02 expect ==="
rg -A 5 -B 5 'objectStorage:' 'apis/v1alpha1/testdata/defaulting/greptimedbcluster/setdefaults/test02/expect.yaml'

echo -e "\n=== Checking test03 input ==="
rg -A 5 -B 5 'objectStorage:' 'apis/v1alpha1/testdata/defaulting/greptimedbcluster/setdefaults/test03/input.yaml'

echo -e "\n=== Checking test03 expect ==="
rg -A 5 -B 5 'objectStorage:' 'apis/v1alpha1/testdata/defaulting/greptimedbcluster/setdefaults/test03/expect.yaml'

# Let's also check if there are any comments or documentation about object storage configuration
echo -e "\n=== Checking for object storage related comments ==="
rg -i "object.*storage" 'apis/v1alpha1/testdata'

Length of output: 2488

apis/v1alpha1/constants.go (1)

46-48: LGTM! The constant is well-defined and documented.

The new constant follows the established naming and documentation patterns, and its value aligns with the PR's objective of refactoring storage configurations.

Let's verify how this constant is being used:

✅ Verification successful

Let me check the usage in defaulting.go to ensure the constant is properly utilized.


Constant is properly integrated and used as intended

The verification shows that DefaultDataSizeForMonitoring is:

  1. Defined in constants.go with proper documentation
  2. Used correctly in defaulting.go for setting up file storage configuration for monitoring standalone
  3. No other hardcoded "30Gi" values found that should be using this constant instead

The implementation aligns perfectly with the PR's objective of refactoring to use file storage for monitoring standalone by default.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of DefaultDataSizeForMonitoring constant
# Expected: Should be used in defaulting logic and monitoring configurations

# Search for direct usage of the constant
rg -l "DefaultDataSizeForMonitoring"

# Search for the literal value "30Gi" to catch any places that might need to use the constant instead
rg '"30Gi"' --type go

Length of output: 181


Script:

#!/bin/bash
# Check the implementation in defaulting.go to see how the constant is used
rg -A 5 -B 5 "DefaultDataSizeForMonitoring" apis/v1alpha1/defaulting.go

Length of output: 505

apis/v1alpha1/defaulting.go (1)

229-237: Verify the impact of switching to file storage by default.

The switch to file storage for monitoring standalone is a significant architectural change that could affect existing deployments. While the comment suggests this change is for "better performance and easy management", we should ensure:

  1. The default storage size (DefaultDataSizeForMonitoring) is sufficient for typical monitoring workloads
  2. Existing deployments using object storage have a migration path

Let's verify the constants being used:

✅ Verification successful

Let me gather more information about the object storage usage and configuration in the codebase to better understand the impact of this change.

This will help us understand:

  1. The current object storage configuration structure
  2. Where and how object storage is being used
  3. If there are any migration mechanisms in place

Based on the search results, I can now provide a final response as we have sufficient information about the object storage usage in the codebase.

The switch to file storage for monitoring is safe and well-justified

The change to use file storage by default for monitoring standalone is appropriate for the following reasons:

  1. The default size of 30Gi (defined as DefaultDataSizeForMonitoring) is reasonable for monitoring workloads.
  2. The change only affects the default behavior for new monitoring standalone deployments.
  3. Existing deployments are not impacted as:
    • Object storage remains fully supported in the codebase (evidenced by extensive object storage provider code)
    • Users can still explicitly configure object storage if needed
    • The change only modifies the defaulting behavior, not the core functionality

The codebase shows robust support for various object storage providers (S3, GCS, OSS) with proper validation, configuration, and integration points, indicating this is just a change in default behavior rather than a removal of functionality.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the constants used in the storage configuration

# Check the definition of DefaultDataSizeForMonitoring
rg "DefaultDataSizeForMonitoring.*=.*\".*Gi\"" -A 1

# Check if there are any existing deployments using object storage
ast-grep --pattern 'ObjectStorage {
  $$$
}'

Length of output: 192


Script:

#!/bin/bash
# Search for object storage related code and configurations
# Look for ObjectStorage type definition and usage
ast-grep --pattern 'type ObjectStorage struct {
  $$$
}'

# Search for object storage related comments and code
rg -i "object.*storage" -A 2

# Check if there are any migration or upgrade related code
rg -i "migration|upgrade" apis/

Length of output: 18303

@zyy17 zyy17 merged commit d8d1472 into GreptimeTeam:main Oct 24, 2024
5 checks passed
@zyy17 zyy17 deleted the refactor/update-monitoring-defaults branch October 24, 2024 13:55
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.

2 participants