-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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: added errorcode and exception to http_server_requests for better slo #38892
base: release
Are you sure you want to change the base?
Conversation
WalkthroughA new Changes
Possibly related PRs
Suggested Labels
Suggested Reviewers
Poem
✨ Finishing Touches
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
Documentation and Community
|
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
🧹 Nitpick comments (2)
app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/ObservationConfig.java (1)
15-34
: Consider adding documentation for the custom convention.While the implementation is solid, adding JavaDoc would help explain the purpose of this custom observation convention and its error handling capabilities.
Add documentation like:
+ /** + * Customizes the server request observation convention to include error details. + * Adds error code and exception title as low cardinality key values when an + * AppsmithException occurs. + * + * @return CustomServerRequestObservationConvention + */ @Bean public ServerRequestObservationConvention customObservationConvention() {app/server/appsmith-server/src/main/java/com/appsmith/server/exceptions/GlobalExceptionHandler.java (1)
89-93
: Add error handling for observation context operations.The context operations could potentially throw exceptions if the context is not properly initialized. Consider adding a try-catch block.
- ServerRequestObservationContext.findCurrent(exchange.getAttributes()).ifPresent(context -> { - context.setError(e); - context.addLowCardinalityKeyValue(KeyValue.of("errorCode", e.getAppErrorCode())); - context.addLowCardinalityKeyValue(KeyValue.of("exception", e.getTitle())); - }); + try { + ServerRequestObservationContext.findCurrent(exchange.getAttributes()).ifPresent(context -> { + context.setError(e); + context.addLowCardinalityKeyValue(KeyValue.of("errorCode", e.getAppErrorCode())); + context.addLowCardinalityKeyValue(KeyValue.of("exception", e.getTitle())); + }); + } catch (Exception observationError) { + log.warn("Failed to set observation context for error: {}", e.getAppErrorCode(), observationError); + }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/ObservationConfig.java
(1 hunks)app/server/appsmith-server/src/main/java/com/appsmith/server/exceptions/GlobalExceptionHandler.java
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: perform-test / client-build / client-build
- GitHub Check: perform-test / server-build / server-unit-tests
- GitHub Check: server-unit-tests / server-unit-tests
- GitHub Check: server-spotless / spotless-check
🔇 Additional comments (2)
app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/ObservationConfig.java (1)
12-14
: LGTM! Well-structured configuration class.The class is properly annotated and follows Spring configuration conventions.
app/server/appsmith-server/src/main/java/com/appsmith/server/exceptions/GlobalExceptionHandler.java (1)
13-13
: LGTM! Appropriate imports added.The new imports are correctly placed and necessary for the observation context functionality.
Also applies to: 21-21
...rver/appsmith-server/src/main/java/com/appsmith/server/configurations/ObservationConfig.java
Outdated
Show resolved
Hide resolved
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.
Minor comment added.
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
🧹 Nitpick comments (1)
app/server/appsmith-server/src/main/java/com/appsmith/server/constants/ce/FieldNameCE.java (1)
206-206
: Add Javadoc to document the constant's purpose.The constant follows the class's naming conventions. Consider adding a Javadoc comment to document its purpose in error handling contexts.
+ /** Represents a "none" state in error handling contexts. */ public static final String NONE = "none";
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/ObservationConfig.java
(1 hunks)app/server/appsmith-server/src/main/java/com/appsmith/server/constants/ce/FieldNameCE.java
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/ObservationConfig.java
⏰ Context from checks skipped due to timeout of 90000ms (5)
- GitHub Check: perform-test / rts-build / build
- GitHub Check: perform-test / client-build / client-build
- GitHub Check: perform-test / server-build / server-unit-tests
- GitHub Check: server-spotless / spotless-check
- GitHub Check: server-unit-tests / server-unit-tests
Description
Tip
Add a TL;DR when the description is longer than 500 words or extremely technical (helps the content, marketing, and DevRel team).
Please also include relevant motivation and context. List any dependencies that are required for this change. Add links to Notion, Figma or any other documents that might be relevant to the PR.
Fixes #
Issue Number
or
Fixes
Issue URL
Warning
If no issue exists, please create an issue first, and check with the maintainers if the issue is valid.
Automation
/ok-to-test tags="@tag.All"
🔍 Cypress test results
Caution
🔴 🔴 🔴 Some tests have failed.
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/13072022902
Commit: cc763a7
Cypress dashboard.
Tags: @tag.All
Spec:
The following are new failures, please fix them before merging the PR:
Fri, 31 Jan 2025 12:45:31 UTC
Communication
Should the DevRel and Marketing teams inform users about this change?
Summary by CodeRabbit