- Notifications
You must be signed in to change notification settings - Fork715
fix: vrl panic issues (#8355)#8366
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
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 fixes VRL (Vector Remap Language) panic issues by adding comprehensive null and type validation checks before calling theflatten function throughout the codebase. The changes target four critical files where VRL functions process JSON data:
Core Problem: Theflatten utility function expects JSON objects as input and returns errors for other types (null, arrays, primitives). The original code was callingflatten without proper type validation, causing runtime panics when VRL functions returned non-object values.
Changes Made:
- Multi-stream search handling (
multi_streams.rs): Added!item.is_null() && item.is_object()checks before flattening search results, replacing unsafe.unwrap()calls with.ok()for graceful error handling - Pipeline batch execution (
batch_execution.rs): Added validation checks throughout stream, condition, function, and remote stream nodes to prevent processing of null/non-object records - Function testing (
functions.rs): Enhanced the test runner with object type validation before flattening VRL function return values - Cluster search (
http.rs): Replaced error propagation patterns with graceful handling using.ok()and added explicit type checks before flatten operations
Integration Context: These changes align with OpenObserve's robust data processing pipeline, where VRL functions are used for data transformation across search, ingestion, and pipeline processing. The fixes ensure the system can handle diverse input data types without crashing, maintaining system stability when processing real-world data that may contain unexpected formats or null values. The defensive programming approach allows partial processing success rather than complete system failures.
Confidence score: 4/5
- This PR significantly improves system stability by preventing VRL-related panics with minimal risk
- Score reflects well-targeted fixes addressing a specific panic issue with consistent patterns across multiple files
- Pay close attention to the pipeline batch execution file for potential edge cases in complex data processing scenarios
4 files reviewed, 1 comment
| .map(|item|{ | ||
| config::utils::flatten::flatten(item.clone()).unwrap() | ||
| if !item.is_null() && item.is_object(){ | ||
| config::utils::flatten::flatten(item.clone()).unwrap() |
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: Still using.unwrap() here - consider using.ok() for consistency with the other flatten calls
PR Code Suggestions ✨Explore these optional code suggestions:
|
f5af0c8 toa0cb4a5Comparea0cb4a5 toc7a6394Compare49a6744 intomainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
PR Type
Bug fix, Enhancement
Description
Guard flattening for non-object JSON values
Prevent panics by checking null/object types
Improve timestamp handling on null values
Tighten pipeline flattening conditions
Diagram Walkthrough
File Walkthrough
multi_streams.rs
Safe flattening in multi-stream searchsrc/handler/http/request/search/multi_streams.rs
functions.rs
Guard VRL transform flatteningsrc/service/functions.rs
ingest.rs
Robust null timestamp handlingsrc/service/logs/ingest.rs
http.rs
Safe flattening in clustered searchsrc/service/search/cluster/http.rs
batch_execution.rs
Pipeline: guarded flattening and timestamp checkssrc/service/pipeline/batch_execution.rs