router
router copied to clipboard
[JSONSelection] Report better parsing error messages using `extra: X` field of `LocatedSpan<T, X = ()>`
The LocatedSpan<T, X = ()> type provided by the nom_locate crate (first introduced in PR #5987) supports an optional user-defined extra: X field, which we can use to smuggle meaningful custom error messages out of the parser.
It would be ideal if we could report multiple parsing errors and continue best-effort parsing after an error occurs, but that will have to wait for future PRs. Also, there are some cases where parsing fails because various alt(...) combinators ran out of options, and we can't (yet) determine which underlying error was "most" responsible for the failure, so the error message remains an opaque nom::error::ErrorKind code.
As a side benefit, I've attempted to stabilize the method signature of the public JSONSelection::parse method, so consumers don't depend on nom- and nom_locate-specific types, so we have the freedom to swap out implementation details in the future without breaking consumers. This primarily means continuing to accept a &str as input (rather than a LocatedSpan) and returning a custom JSONSelectionParseError type in case of failure.
While improving parsing error messages is still a work in progress, I think this PR meaningfully improves the situation, and is worth considering as a first step.
CI performance tests
- [ ] connectors-const - Connectors stress test that runs with a constant number of users
- [x] const - Basic stress test that runs with a constant number of users
- [ ] demand-control-instrumented - A copy of the step test, but with demand control monitoring and metrics enabled
- [ ] demand-control-uninstrumented - A copy of the step test, but with demand control monitoring enabled
- [ ] enhanced-signature - Enhanced signature enabled
- [ ] events - Stress test for events with a lot of users and deduplication ENABLED
- [ ] events_big_cap_high_rate - Stress test for events with a lot of users, deduplication enabled and high rate event with a big queue capacity
- [ ] events_big_cap_high_rate_callback - Stress test for events with a lot of users, deduplication enabled and high rate event with a big queue capacity using callback mode
- [ ] events_callback - Stress test for events with a lot of users and deduplication ENABLED in callback mode
- [ ] events_without_dedup - Stress test for events with a lot of users and deduplication DISABLED
- [ ] events_without_dedup_callback - Stress test for events with a lot of users and deduplication DISABLED using callback mode
- [ ] extended-reference-mode - Extended reference mode enabled
- [ ] large-request - Stress test with a 1 MB request payload
- [ ] no-tracing - Basic stress test, no tracing
- [ ] reload - Reload test over a long period of time at a constant rate of users
- [ ] step-jemalloc-tuning - Clone of the basic stress test for jemalloc tuning
- [ ] step-local-metrics - Field stats that are generated from the router rather than FTV1
- [ ] step-with-prometheus - A copy of the step test with the Prometheus metrics exporter enabled
- [x] step - Basic stress test that steps up the number of users over time
- [ ] xlarge-request - Stress test with 10 MB request payload
- [ ] xxlarge-request - Stress test with 100 MB request payload
✅ Docs Preview Ready
No new or changed pages found.