docs(observed): align documentation with the runtime contract - #710
docs(observed): align documentation with the runtime contract#710Evgenii (Vaiz) wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Updates observed crate documentation to accurately reflect the runtime behavior and contracts around redaction, routing/interest checks, disabled events semantics, laziness costs, enrichment scoping/transfer ordering, event identity, timestamps, and the thread-wide recursion guard. Changes are prose-only (doc comments / markdown / comments), with crates/observed/README.md updated as a regeneration from src/lib.rs.
Changes:
- Clarifies redaction guarantees and explicitly scopes what is (and is not) redacted by the library (e.g.,
#[unredacted], unclassified enrichment, dynamic adaptor values). - Aligns documented routing/interest behavior (event construction and dispatch only when processors are interested; disabled is processor-interpreted metadata).
- Refines documentation of laziness costs, enrichment terminology (“untargeted” vs “global”), transfer-order caveats, and runtime-vs-compile-time event identity.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| crates/observed/src/text.rs | Refines Text variant documentation to match actual storage/clone tradeoffs. |
| crates/observed/src/sink/core.rs | Updates Sink docs to reflect interest-gated construction/dispatch and “untargeted vs targeted” enrichment terminology. |
| crates/observed/src/processing/event_view.rs | Clarifies laziness/overhead semantics and corrects timestamp/severity/description wording. |
| crates/observed/src/metadata/metric.rs | Generalizes instrument-kind wording to match supported kinds. |
| crates/observed/src/metadata/event.rs | Updates EventDescription docs to cover runtime-constructed descriptions and optional type identity; clarifies disabled-event semantics. |
| crates/observed/src/lib.rs | Aligns crate-level docs and attribute-table semantics (redaction, disabled, log body placeholder rules). |
| crates/observed/src/event.rs | Re-scopes the redaction “single pipeline” claim to match actual extraction/bypass behavior. |
| crates/observed/src/enrichment/entry.rs | Clarifies classified vs unclassified enrichment handling and untargeted scoping semantics. |
| crates/observed/src/context/transferred.rs | Refines wrapper-order caveat wording to describe when enrichment may be lost. |
| crates/observed/src/context/transfer.rs | Renames “global” to “untargeted” in transfer enrichment docs and clarifies scope. |
| crates/observed/README.md | Regenerated README content to reflect updated src/lib.rs documentation. |
| crates/observed/FEATURES.md | Updates feature documentation for interest-based dispatch, enrichment scoping, and redaction bypasses. |
| crates/observed/DESIGN.md | Aligns design document with actual behavior (redaction scope, disabled semantics, enrichment isolation/transfer caveats, recursion guard). |
| crates/observed_testing/tests/disabled_events.rs | Updates test documentation to match processor-controlled disabled-event behavior. |
| crates/observed_testing/Cargo.toml | Corrects comment about automation::INTERNAL_CRATES consumers (external-types + mutation orchestration). |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| //! they need. Skipped getters never evaluate, convert, or redact their values | ||
| //! and avoid the associated allocations, while field enumeration and visitor | ||
| //! work still occur. |
There was a problem hiding this comment.
🤖 Clawpilot here! Posted automatically by Clawpilot (an AI agent), not by a human. Please verify before acting.
Declining: the subject here is compound — "field enumeration and visitor work" — so the plural "occur" is the correct agreement. "occurs" would only be right if "visitor work" stood alone.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #710 +/- ##
=======================================
Coverage 100.0% 100.0%
=======================================
Files 563 563
Lines 61068 61068
=======================================
Hits 61068 61068
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Public documentation described guarantees the implementation does not make. Restate them as the code behaves: - redaction is applied by the processor-supplied redactor at extraction time, and #[unredacted] fields and unclassified enrichments bypass it - routing is decided by is_interested() before the event is built, so a sink dispatches only to interested processors - the disabled flag is processor-controlled metadata, not sink-enforced suppression, and severity is metadata a processor may remap - skipping a getter avoids value evaluation, conversion, redaction and their allocations, but enumeration still happens; drop "zero cost" - enrichment entries are scoped to a sink slot; "global" only meant untargeted - EventDescription may be built at runtime by dynamic events and then carries no Rust type identity - timestamp() is the event-associated time, which synthetic views supply - the transfer wrapper-order caveat applies to overlapping captured slots, not every sink combination - Text::Static is not "almost every field", and the instrument-kind list was missing UpDownCounter - document the log-body placeholder keys and brace grammar the macro actually validates - correct the INTERNAL_CRATES consumer comment and the recursion-guard exception to the no-globals rule Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The CI dictionary carries "adaptor" but not the plural inflection, so the new wording tripped cargo spellcheck on two doc comments.
3278ecd to
27f7759
Compare
|
🤖 Clawpilot here! Posted automatically by Clawpilot (an AI agent), not by a human. Please verify before acting.
Problem
Public documentation for
observedstates guarantees the implementation does not make. Each statement below was checked against the code onmainand found to be wrong, not merely imprecise. A reader who trusts them writes a processor that pays costs it expects to avoid, or that relies on an invariant nothing enforces.What changes
Only prose changes. No code, no public API, no test behavior.
#[unredacted]fields plus unclassified enrichment values bypass it entirely. The guarantee is now scoped to classified values.Sink::emitsaid it emits to every registered processor. It builds the event only when a processor is interested and dispatches only to interested processors.is_interested.EventDescriptionwas described as compile-time only. Dynamic events build it at runtime and then carry no RustTypeId, so name matching is the portable choice.EventView::timestampwas documented as captured at view creation; synthetic views supply their own.Text::Staticis not "almost every field"; the instrument-kind list omittedUpDownCounter; the log-body placeholder keys and brace grammar were undocumented; theINTERNAL_CRATEScomment named the wrong consumer; the no-globals rule did not admit the recursion guard.crates/observed/README.mdis regenerated fromsrc/lib.rs, not hand-edited.Effects
#[unredacted]values are protected.Validation
just anvil-readme-check,just anvil-fmt,just anvil-clippy,cargo +1.96.1 doc --no-deps, andcargo +1.96.1 test -p observed -p observed_testingall pass.Work items
Closes ADO 7757572, 7757577, 7757578, 7757584, 7757602, 7757605, 7757607, 7757608, 7757610, 7757611, 7757613, 7757614, 7757616, 7757618, 7757621 (feature 7757535).