-
Notifications
You must be signed in to change notification settings - Fork 715
feat: logs page highlighting #8059
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
3df1c5a to
aada5a0
Compare
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.
Greptile Summary
This PR introduces text highlighting functionality for the logs page along with a critical bug fix in the useLogs composable. The changes include:
-
Bug Fix in useLogs: Corrects a critical error on line 3530 where
indexOfwas being called without the required parameter. The fix changesstream.settings.full_text_search_keys.indexOf > -1tostream.settings.full_text_search_keys.indexOf(field) > -1, ensuring proper detection of full-text search keys. -
New Text Highlighting Composable: Adds
useTextHighlighter.tsthat provides comprehensive text highlighting and semantic colorization for log content. This composable combines:- Keyword highlighting by extracting search terms from SQL patterns (match_all, fuzzy_match)
- Semantic colorization for different text types (IPs, URLs, timestamps, file paths)
- Smart tokenization with quote merging to handle complex log formats
- HTML escaping for security when rendering highlighted content
The text highlighter uses sophisticated pattern recognition to automatically colorize various technical content types commonly found in logs, making them more visually scannable. The implementation includes comprehensive tokenization logic that intelligently merges quoted strings and handles edge cases in log formatting. This enhancement integrates with the existing logs infrastructure through the useLogs composable to provide real-time highlighting based on current search queries and filters.
Confidence score: 4/5
- This PR combines a critical bug fix with new functionality, making it generally safe but requiring attention to the new complexity
- Score reflects the solid bug fix but concerns about unused imports, missing error handling in regex operations, and potential performance impacts with complex patterns
- Pay close attention to the new
useTextHighlighter.tsfile for potential performance and error handling issues
2 files reviewed, 1 comment
| * @param text - Text segment to analyze | ||
| * @returns Object containing analysis results with boolean flags and counts for various text patterns | ||
| */ | ||
| function analyzeSegment(text: string): any { |
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.
style: return type should be properly typed instead of any for better type safety
| function analyzeSegment(text: string): any { | |
| function analyzeSegment(text: string): { | |
| length: number; | |
| wordCount: number; | |
| hasUppercase: boolean; | |
| hasLowercase: boolean; | |
| hasDigits: boolean; | |
| hasSpecialChars: boolean; | |
| hasDots: boolean; | |
| hasAtSymbol: boolean; | |
| hasColons: boolean; | |
| hasSlashes: boolean; | |
| hasHyphens: boolean; | |
| hasParentheses: boolean; | |
| dotSeparatedNumbers: number; | |
| startsWithUppercase: boolean; | |
| isThreeDigitStatusCode: boolean; | |
| isLargeNumber: boolean; | |
| hasDateTimePattern: boolean; | |
| hasVersionPattern: boolean; | |
| hasCommonHttpVerb: boolean; | |
| isUuidPattern: boolean; | |
| isFilePath: boolean; | |
| } { |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
aada5a0 to
b2b769f
Compare
4925797 to
46ac50d
Compare
46ac50d to
381c80e
Compare
User description
This PR helps to highlight text in logs page and also adds a left border for each depending upon the status of the logs
PR Type
Enhancement
Description
Add LogsHighLighting component for semantic highlighting
Highlight query terms across logs and JSON
Visual status indicators via colored borders/lines
FTS-aware coloring for selected columns
Diagram Walkthrough
File Walkthrough
8 files
New component for semantic JSON/log highlightingAdd status top border and inline highlightingUse highlighter for key/value renderingProvide highlight query and FTS keys downstreamIntegrate highlighter and add status stripeNew composable for text highlighting logicTheme-aware color palette utilitiesDerive log severity and colors2 files
Fix column update timeout scopingCorrect FTS key detection logic