fix(lading): surface remote-input parsing failures as errors#1903
Draft
goxberry wants to merge 1 commit into
Draft
fix(lading): surface remote-input parsing failures as errors#1903goxberry wants to merge 1 commit into
goxberry wants to merge 1 commit into
Conversation
The Splunk HEC ack-id parser and the ad-hoc Prometheus scrape parser
both panicked on malformed remote responses. Convert them to recover
without aborting the process.
splunk_hec::send_hec_request now adds Error::ResponseParse (from
serde_json::Error) and propagates parse failures with `?` instead of
`.expect()`. The fn-level FIXME `#[expect(clippy::expect_used)]` is
removed.
target_metrics::prometheus::parse_prometheus_metrics is called for
side effects from a scrape loop; redesigning the caller to take a
Result was out of scope. Each former `.expect()` is now a
`let Some(..) else { warn!; continue; }` (or `match` for the
MetricType `FromStr` parse) so malformed lines are logged and
skipped rather than crashing the scraper. The regex-capture sites
move from `.map(|c| c.expect(..))` to `.filter_map(|c| ..)` with the
same warn-and-skip pattern. The fn-level FIXME `#[expect]` is
removed.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This was referenced May 23, 2026
Contributor
Author
This was referenced May 23, 2026
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Second PR in the FIXME-conversion stack. Addresses two sites where
malformed remote input — the Splunk HEC ack-id response and the
Prometheus scrape body — caused lading to crash.
generator/splunk_hec.rs::send_hec_requestAdd
Error::ResponseParse(#[from] serde_json::Error)and propagatethe JSON parse failure with
?instead of.expect(). Drop thefn-level
#[expect]. A malformed ack-id body is now a recoverablegenerator error rather than a panic.
target_metrics/prometheus.rs::parse_prometheus_metricsThis is an ad-hoc Prometheus parser called for side effects from a
scrape loop. Returning a
Resultwould require redesigning thecaller; the FIXME asked for recoverable errors, so we recover at
the line granularity: each former
.expect()becomes alet Some(...) else { warn!; continue; }(or amatchfor theMetricTypeFromStrparse), so malformed lines are logged andskipped rather than crashing the scraper. The two regex-capture
sites inside the label
.map(|cap| ..)become.filter_map(|cap| ..)with the same warn-and-skip pattern.
8 former
.expect()sites in this function are now non-fatal logpoints. The fn-level
#[expect]is removed.Test plan
./ci/validatepassesgrep -n 'FIXME' lading/src/generator/splunk_hec.rs lading/src/target_metrics/prometheus.rsis emptycargo build --workspace --all-targets --all-features🤖 Generated with Claude Code