feat: rfc0018.6 green — preserve out-of-range severity + error.type - #269
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthroughRFC0018.6 changes out-of-range OTLP ChangesRFC0018.6 — out-of-range severity preservation and OTel error attribution
Sequence Diagram(s)sequenceDiagram
participant Client as OTLP Client
participant materialize as materialize_record / severity_to_u8
participant pipeline as IngestPipeline
participant metrics as IngestMetrics
participant counter as ourios.ingest.records
Client->>materialize: LogRecord { severity_number: i32 }
materialize-->>pipeline: MinedRecord { severity_number: u8 (preserved or 0) }
pipeline->>pipeline: count records where severity_is_out_of_range(severity_number)
pipeline->>metrics: record_batch(total, out_of_range_count, elapsed)
metrics->>counter: add(in_range_count) — no error.type
metrics->>counter: add(out_of_range_count) — error.type = "severity_out_of_range"
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Pull request overview
Updates RFC 0018.6 behavior so the receiver preserves out-of-range-but-u8-storable OTLP SeverityNumber values (25–255) instead of clamping them to 0, and surfaces the anomaly via the existing ourios.ingest.records counter using the standard error.type attribute.
Changes:
- Preserve
SeverityNumberwire values inseverity_to_u8for the fullu8range; only non-u8extremes narrow to0. - Record out-of-range severity occurrences by splitting
ourios.ingest.recordsdatapoints usingerror.type=severity_out_of_range. - Add/adjust RFC acceptance tests to cover severity preservation, metric attribution, and querier monotonic severity comparisons.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/rfcs/0018-otlp-log-spec-compliance.md | Updates RFC text for severity preservation and error.type metric attribution. |
| crates/ourios-querier/tests/rfc0018_severity.rs | New test ensuring severity >= error matches preserved out-of-range severities. |
| crates/ourios-ingester/tests/rfc0018_otlp_compliance.rs | Implements RFC0018.6 receiver + metrics test logic (and updates imports/helpers). |
| crates/ourios-ingester/tests/rfc0003_9_edge_otlp_fields.rs | Updates RFC0003.9 contract test to assert preservation of 25/200 and narrowing of non-u8 extremes. |
| crates/ourios-ingester/tests/perf_metrics.rs | Updates perf-metrics test for new IngestMetrics::record_batch signature. |
| crates/ourios-ingester/src/receiver/pipeline.rs | Computes out-of-range severity count per batch and passes it into ingest metrics recording. |
| crates/ourios-ingester/src/receiver/materialize.rs | Changes severity narrowing to preserve u8 wire values and adds severity_is_out_of_range. |
| crates/ourios-ingester/src/receiver.rs | Re-exports severity_is_out_of_range from receiver. |
| crates/ourios-ingester/src/metrics.rs | Extends record_batch to split ourios.ingest.records by standard error.type attribute. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| //! remain `#[ignore]`d stubs until those receiver changes land (`green`). | ||
| //! | ||
| //! See `docs/rfcs/0018-otlp-log-spec-compliance.md` §5/§6. | ||
|
|
||
| use std::time::Duration; |
… ingest counter Faithful-witness fix (RFC 0018 §3.5/§3.0): the receiver clamped any out-of-`0..=24` SeverityNumber to 0 (`severity_to_u8`), silently inverting a monotonic scale (25 = most-severe → UNSPECIFIED). Preserve it instead. - severity_to_u8 now preserves the wire value (u8 0..=255); only the non-u8-storable extremes (negative, >255) narrow to 0 (storage invariant). - Surface the anomaly via the OTel "recording errors on metrics" convention, per maintainer steer: NOT a bespoke counter, but the standard `error.type` attribute on the existing `ourios.ingest.records` counter (error.type=severity_out_of_range on out-of-range records; absent on in-range). error.type is upstream OTel — used as a code constant, kept OUT of the Ourios weaver registry. - The pipeline tags out-of-range records post-materialise (severity_is_out_of_range on the preserved u8); the rare non-u8→0 extremes aren't separately attributed (accepted §3.5 limitation). Greens RFC0018.6 across three arms: preserve + non-u8 (the overturned rfc0003_9 contract test, now asserting preservation), error.type metric (ingester rfc0018, in-memory meter), and monotonicity (querier rfc0018_severity: `severity >= error` matches a preserved 25). RFC 0018 §3.5/§5/§6 amended from the bespoke metric to the error.type pattern. RFC 0018: 4 of 6 §5 scenarios green (.1/.2/.4/.6). Remaining: .3, .5. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot review: - severity_is_out_of_range is crate-internal (only the pipeline calls it); make it pub(crate) and drop the public re-export — call it via super::materialize::. Keeps it off the public receiver API surface. - remove the orphaned RFC0018.6 scenario doc (old ingest.severity_out_of_range wording) the stub→green rewrite left above the ingest_records_sum helper; the accurate scenario doc sits on the test fn. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
46176d9 to
4b86a28
Compare
RFC 0018 green (4/6) — preserve out-of-range severity +
error.type(RFC0018.6)Faithful-witness fix (RFC 0018 §3.5 / §3.0): the receiver clamped any out-of-
0..=24SeverityNumberto0(severity_to_u8), silently inverting a monotonic scale (25 = most-severe → UNSPECIFIED). Now it preserves the wire value (u80..=255); only the non-u8-storable extremes (negative,>255) narrow to0(storage invariant).The metric — OTel convention, not a bespoke counter
Per the maintainer steer ("doesn't weaver provide means? check the OTel docs"), the anomaly is surfaced via the "recording errors on metrics" convention: the standard
error.typeattribute on the existingourios.ingest.recordscounter (error.type=severity_out_of_rangeon out-of-range records; absent on in-range) — one counter, low-cardinality reason, no new metric name.error.typeis upstream OTel, used as a documented code constant and kept out of the Ourios weaver registry (it's not ours to vendor). RFC 0018 §3.5/§5/§6 amended accordingly.Verification (RFC0018.6, three arms)
u8— the overturnedrfc0003_9contract test now asserts preservation (25→25, 200→200, 1000→0, -5→0); a §6.2 contract change the RFC authorizes.error.typemetric —ourios-ingester/tests/rfc0018_otlp_compliance.rs(in-memory meter): a 4-record/2-out-of-range batch splits 2 (noerror.type) + 2 (error.type=severity_out_of_range).ourios-querier/tests/rfc0018_severity.rs:severity >= errormatches the preserved 25/200 (25 >= 17), excludes INFO(9).clippy --all-targets,fmt,mdbook, semconv no-diff all clean.RFC 0018: 4 of 6 §5 scenarios green (.1/.2/.4/.6). Remaining: .3 (retryable errors), .5 (non-finite doubles).
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Documentation