-
Notifications
You must be signed in to change notification settings - Fork 83
feat(webui): Add logs to presto search routes. #1275
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
Conversation
WalkthroughAdds diagnostic logging to Presto search API routes by logging inbound arguments: queryString in POST /query and searchJobId in POST /cancel. No functional or control-flow changes. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related PRs
Suggested reviewers
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
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: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
components/webui/server/src/routes/api/presto-search/index.ts(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}
⚙️ CodeRabbit configuration file
- Prefer
false == <expression>rather than!<expression>.
Files:
components/webui/server/src/routes/api/presto-search/index.ts
| const {queryString} = request.body; | ||
| request.log.info({queryString}, "/api/presto-search/query args"); | ||
|
|
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.
💡 Verification agent
🧩 Analysis chain
Avoid logging full query text; truncate/redact and align message prefix.
Raw queries can contain PII/secrets and can bloat logs. Truncate before logging (and consider gating behind a debug level/feature flag). Also align message prefix with other routes (no leading slash).
const {queryString} = request.body;
-request.log.info({queryString}, "/api/presto-search/query args");
+const maxLen = 512;
+const qsLog =
+ ("string" === typeof queryString && queryString.length > maxLen)
+ ? `${queryString.slice(0, maxLen)}…(truncated)`
+ : queryString;
+request.log.info({queryString: qsLog}, "api/presto-search/query args");Please confirm this logging aligns with your privacy policy and production log size constraints.
🏁 Script executed:
#!/bin/bash
set -e
# Search for all logging calls in API routes to compare prefixes
rg -n -C2 'request\.log\.' components/webui/server/src/routes/api/**/*.tsLength of output: 12144
Truncate queryString and log at debug level
- Truncate
queryString(>512 chars) to${queryString.slice(0,512)}…(truncated)to avoid PII/excessive logs - Switch to
request.log.debug({ queryString: qsLog }, "/api/presto-search/query args")(debug-level, matching/api/search/query args)
Please confirm this meets our privacy policy and production log-size constraints.
🤖 Prompt for AI Agents
In components/webui/server/src/routes/api/presto-search/index.ts around lines 62
to 64, the handler currently logs the full queryString at info level; change
this to truncate any queryString longer than 512 characters to
`${queryString.slice(0,512)}…(truncated)` (or equivalent) into a local variable
(e.g., qsLog) and log that at debug level via request.log.debug({ queryString:
qsLog }, "/api/presto-search/query args") to avoid PII/excessive logs and match
the /api/search/query args logging level.
| const {searchJobId} = request.body; | ||
|
|
||
| request.log.info({searchJobId}, "api/presto-search/cancel args"); | ||
|
|
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.
🧹 Nitpick (assertive)
Keep log message prefixes consistent across endpoints.
This uses "api/presto-search/cancel args" (no leading slash) while the /query log uses a leading slash. Favour the no-slash form across all three endpoints for consistency.
🤖 Prompt for AI Agents
In components/webui/server/src/routes/api/presto-search/index.ts around lines
216 to 219, ensure log-message prefixes are consistent by using the
no-leading-slash form for all endpoints; find any request.log.* calls that use
paths like "/api/presto-search/..." (e.g. the /query endpoint) and remove the
leading slash so they match "api/presto-search/...", keeping the same
descriptive suffix (e.g. "args", "start", "cancel") and leaving the existing
structured meta (like {searchJobId}) unchanged.
junhaoliao
left a comment
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.
i can be wrong but the fastify logs should already include the route information (e.g. URL path)?
also, since this is developer facing (rather than user facing), i believe chore is more appropriate than feat in the title
|
|
||
| request.log.info({searchJobId}, "api/presto-search/cancel args"); |
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.
| request.log.info({searchJobId}, "api/presto-search/cancel args"); | |
| request.log.info({searchJobId}, "/api/presto-search/cancel args"); |
|
@junhaoliao - I actually didnt notice but it looks like the route url is printed in the object logged by fastify? Should we modify this PR to just remove all these logs then? From search as well? |
They are printed once for each incoming request, but I guess it doesn't hurts to add them in the logs. |
|
maybe we just close this and add and issue to remove logs from search route? |
I have no issue with that as well, as I don't really use those logs for debugging. |
|
@coderabbitai can you make an issue to remove uneccesary logs from search routes in webui? |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chainI'll help you create an issue to remove unnecessary logs from search routes in the webui. Let me first examine the current logging in the search routes to provide better context for the issue. Now let me create the GitHub issue: @davemarco I've created a GitHub issue to track the removal of unnecessary logs from search routes in the webui. The issue includes:
The issue will help track this cleanup work separately from the current PR, allowing you to close this PR if you decide the logging additions are indeed unnecessary. 🏁 Script executed: Length of output: 3346 🏁 Script executed: Length of output: 1312 Perfect! I've successfully created GitHub issue #1286 to track the removal of unnecessary logs from search routes in the webui. Based on my analysis of the codebase, I found that: Regular search routes (
Presto search routes (
The issue is now created at #1286 and assigned to you. This will allow you to proceed with closing this PR if you determine the logging additions are indeed unnecessary, and handle the cleanup separately through the new issue. |
Description
Added logs to match regular search routes.
Checklist
breaking change.
Validation performed
Summary by CodeRabbit