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

chore: disable TraceLayer on_failure log #4315

Merged
merged 1 commit into from
Jul 8, 2024

Conversation

paomian
Copy link
Contributor

@paomian paomian commented Jul 8, 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?

  • Disable the TraceLayer on_failure log because the logged message is not helpful.

Please explain IN DETAIL what the changes are in this PR and why they are needed:

  • Summarize your change (mandatory)
  • How does this PR work? Need a brief introduction for the changed logic (optional)
  • Describe clearly one logical change and avoid lazy messages (optional)
  • Describe any limitations of the current code (optional)

Checklist

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

Summary by CodeRabbit

  • New Features

    • Improved error handling with more detailed error messages and conditional error logging.
  • Refactor

    • Updated internal error management to use a new function for logging errors based on conditions.

Copy link
Contributor

coderabbitai bot commented Jul 8, 2024

Warning

Rate limit exceeded

@paomian has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 5 minutes and 16 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between 8527322 and 877f459.

Walkthrough

The updates primarily enhance error handling and HTTP tracing configuration within the server code. A new function log_error_if_necessary is introduced to streamline error logging, while the TraceLayer for HTTP processing is adjusted to disable failure tracing and improve error message clarity.

Changes

File Path Change Summary
src/servers/src/error.rs Restructured error handling logic with a new log_error_if_necessary function. Modified IntoResponse implementation.
src/servers/src/http.rs Updated TraceLayer configuration in HttpServer to disable tracing on failure and improve error messaging.

Poem

In the land of code where errors play,
We’ve found a new and clever way.
With logs to catch and messages clear,
Our server hums without a fear.
Tracing tweaks and errors neat,
Our code’s become a tidy feat! 🐇✨


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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.

@paomian paomian changed the title chore: disable TraceLayer on_failure log and print most http exceptio… chore: disable TraceLayer on_failure log Jul 8, 2024
@github-actions github-actions bot added the docs-not-required This change does not impact docs. label Jul 8, 2024
@paomian paomian requested review from sunng87 and evenyag July 8, 2024 08:29
@paomian paomian marked this pull request as ready for review July 8, 2024 08:29
@paomian paomian requested a review from a team as a code owner July 8, 2024 08:29
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: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 59afa70 and 380a55d.

Files selected for processing (2)
  • src/servers/src/error.rs (2 hunks)
  • src/servers/src/http.rs (1 hunks)
Additional comments not posted (3)
src/servers/src/error.rs (2)

748-751: LGTM!

The function log_error_and_return_internal_server_error_http_status correctly logs the error and returns the appropriate HTTP status code.


Line range hint 752-775: LGTM!

The IntoResponse implementation for Error correctly delegates error handling to the new logging functions.

src/servers/src/http.rs (1)

700-702: LGTM!

The modification to the TraceLayer configuration to disable tracing on failure aligns with the PR objective to reduce unnecessary log noise.

src/servers/src/error.rs Outdated Show resolved Hide resolved
@paomian
Copy link
Contributor Author

paomian commented Jul 8, 2024

@evenyag I didn't end up modifying the logging level here, we can control the printing of debug logs here with RUST_LOG at startup.

debug!("Failed to handle HTTP request: {self:?}");

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 380a55d and d04b71d.

Files selected for processing (2)
  • src/servers/src/error.rs (2 hunks)
  • src/servers/src/http.rs (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • src/servers/src/error.rs
  • src/servers/src/http.rs

src/servers/src/error.rs Outdated Show resolved Hide resolved
src/servers/src/error.rs Show resolved Hide resolved
src/servers/src/error.rs Outdated Show resolved Hide resolved
src/servers/src/error.rs Outdated Show resolved Hide resolved
Copy link

codecov bot commented Jul 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.87%. Comparing base (59afa70) to head (877f459).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4315      +/-   ##
==========================================
- Coverage   85.13%   84.87%   -0.27%     
==========================================
  Files        1060     1060              
  Lines      187669   187671       +2     
==========================================
- Hits       159777   159280     -497     
- Misses      27892    28391     +499     

@evenyag
Copy link
Contributor

evenyag commented Jul 8, 2024

@evenyag I didn't end up modifying the logging level here, we can control the printing of debug logs here with RUST_LOG at startup.

debug!("Failed to handle HTTP request: {self:?}");

I'm not sure if it is the proper level.

But we might set servers=debug to avoid logging debug logs from other crates.

@paomian
Copy link
Contributor Author

paomian commented Jul 8, 2024

I'm not sure if it is the proper level.

After my testing, adding RUST_LOG=info,servers::error=debug before the startup parameter makes the debug level logs printed here. The user can decide whether to turn it on or off as needed.

2024-07-08T08:27:09.389642Z DEBUG servers::error: Failed to handle HTTP request: 0: Pipeline management api error, at src/frontend/src/instance/log_handler.rs:68:14
1: Failed to parse pipeline: transform cannot be empty, at src/pipeline/src/manager/table.rs:205:61

@paomian paomian force-pushed the chore/log-improve branch 2 times, most recently from 8527322 to 9e4dfb0 Compare July 8, 2024 09:05
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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d04b71d and 8527322.

Files selected for processing (2)
  • src/servers/src/error.rs (2 hunks)
  • src/servers/src/http.rs (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • src/servers/src/error.rs
  • src/servers/src/http.rs

@sunng87 sunng87 enabled auto-merge July 8, 2024 09:29
@sunng87 sunng87 added this pull request to the merge queue Jul 8, 2024
Merged via the queue into GreptimeTeam:main with commit c0e9b3d Jul 8, 2024
52 checks passed
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.

4 participants