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: make the command entry cleaner #3981

Merged
merged 5 commits into from
May 20, 2024

Conversation

zyy17
Copy link
Collaborator

@zyy17 zyy17 commented May 18, 2024

I hereby agree to the terms of the GreptimeDB CLA.

Refer to a related PR or issue link (optional)

What's changed and what's your intention?

NOTE: The PR is decoupled with draft PR #3941, and it's just a simple refactoring based on the original implementation.

  • Remove Options{} and some related methods, and all the building process of options can be in their app(for example, datanode.rs/metasrv.rs/...);

  • Remove SubCommand.build() and SubCommand.load_options() which are unnecessary;

  • Move common_telemetry::init_global_logging into <app>:build() which can be easy to receive the arguments;

  • Move start_app() into App and rename run();

  • Make common_telemetry::init_global_logging init once, or it will fail in integration test (what an ugly function...);

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR requires documentation updates.

@zyy17 zyy17 requested a review from a team as a code owner May 18, 2024 05:14
@github-actions github-actions bot added the docs-not-required This change does not impact docs. label May 18, 2024
Copy link

codecov bot commented May 18, 2024

Codecov Report

Attention: Patch coverage is 59.55882% with 110 lines in your changes are missing coverage. Please review.

Project coverage is 85.13%. Comparing base (11ad5b3) to head (74ae32c).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3981      +/-   ##
==========================================
- Coverage   85.40%   85.13%   -0.28%     
==========================================
  Files         978      977       -1     
  Lines      169100   169089      -11     
==========================================
- Hits       144427   143951     -476     
- Misses      24673    25138     +465     

@zyy17 zyy17 marked this pull request as draft May 18, 2024 07:56
@zyy17 zyy17 marked this pull request as ready for review May 18, 2024 08:11
Copy link
Contributor

@evenyag evenyag left a comment

Choose a reason for hiding this comment

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

LGTM

@evenyag evenyag added this pull request to the merge queue May 20, 2024
Merged via the queue into GreptimeTeam:main with commit 82c3eca May 20, 2024
32 of 39 checks passed
WenyXu pushed a commit to WenyXu/greptimedb that referenced this pull request May 21, 2024
* refactor: move run() in App trait

* refactor: introduce AppBuilder trait

* chore: remove AppBuilder

* refactor: remove Options struct and make the start() clean

* refactor: init once for common_telemetry::init_global_logging
@zyy17 zyy17 deleted the refactor/cli-entry branch May 26, 2024 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-not-required This change does not impact docs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants