docs(observability): document message = dynamic in the instrumentation guide#3707
Conversation
Summary by CodeRabbit
WalkthroughThe instrumentation guide adds guidance for ChangesObservability documentation
Estimated code review effort: 1 (Trivial) | ~3 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
🌿 Preview your docs: https://nvidia-preview-pull-request-3707.docs.buildwithfern.com/infra-controller |
…n guide Add a `message = dynamic` entry to the instrumentation guide, next to the existing `log = dynamic` section: declare it, implement `DynamicMessage`, and the derive routes `Event::message()` through it. Includes the guidance to prefer a static `message` plus a label where the label already names the case, and to use `message = dynamic` only where the wording says something the label does not. Documents the framework capability added in NVIDIA#3705; kept as its own PR so the code and docs can land on independent timelines. Signed-off-by: Chet Nichols III <chetn@nvidia.com>
|
@coderabbitai full_review, thanks! |
|
🐇🔍 ✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/observability/instrumentation.md`:
- Around line 142-154: Revise the instrumentation documentation example to use
only the supported static message path, removing the `message = dynamic` and
`DynamicMessage` guidance unless that macro support is implemented first. Ensure
the `Event::message()` behavior described matches the derive’s current
compile-time message handling.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 27f31137-ceeb-46e8-8d81-10ea500d9378
📒 Files selected for processing (1)
docs/observability/instrumentation.md
| When the per-case *wording* matters, not just the level, declare `message = dynamic` | ||
| and implement `DynamicMessage`; the derive routes `Event::message()` through it: | ||
|
|
||
| ```rust | ||
| impl DynamicMessage for CallFinished { | ||
| fn message(&self) -> &'static str { | ||
| match self.outcome { | ||
| Outcome::Error => "outbound call failed", | ||
| Outcome::Ok => "outbound call finished", | ||
| } | ||
| } | ||
| } | ||
| ``` |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the documentation segment and the macro implementation around the cited lines.
sed -n '130,170p' docs/observability/instrumentation.md
printf '\n--- MACRO IMPLEMENTATION ---\n'
sed -n '560,690p' crates/instrument-macros/src/lib.rsRepository: NVIDIA/infra-controller
Length of output: 6516
Remove or implement message = dynamic support
The generated Event::message() still returns the compile-time message value, so this example describes behavior the derive does not provide. Either add the macro support first or revise the text/example to match the supported static message path.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/observability/instrumentation.md` around lines 142 - 154, Revise the
instrumentation documentation example to use only the supported static message
path, removing the `message = dynamic` and `DynamicMessage` guidance unless that
macro support is implemented first. Ensure the `Event::message()` behavior
described matches the derive’s current compile-time message handling.
Documents the
message = dynamicknob added in #3705, next to the existinglog = dynamicsection in the instrumentation guide.message = dynamiclets an event choose its log message per instance (typically a match on a#[label]enum) by implementing the newDynamicMessagetrait. The entry shows the pattern and adds the guidance to prefer a staticmessageplus a label where the label already names the case.Split from the code PR (#3705) so the documentation can be reviewed on its own timeline. Part of the instrumentation-coherency initiative (#3169).