Skip to content

docs(observability): document message = dynamic in the instrumentation guide#3707

Merged
chet merged 1 commit into
NVIDIA:mainfrom
chet:gh-issue-3169-docs
Jul 24, 2026
Merged

docs(observability): document message = dynamic in the instrumentation guide#3707
chet merged 1 commit into
NVIDIA:mainfrom
chet:gh-issue-3169-docs

Conversation

@chet

@chet chet commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Documents the message = dynamic knob added in #3705, next to the existing log = dynamic section in the instrumentation guide.

message = dynamic lets an event choose its log message per instance (typically a match on a #[label] enum) by implementing the new DynamicMessage trait. The entry shows the pattern and adds the guidance to prefer a static message plus 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).

@chet
chet requested a review from polarweasel as a code owner July 18, 2026 16:43
@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Summary by CodeRabbit

  • Documentation
    • Added guidance for handling event messages that vary by outcome.
    • Included a Rust example demonstrating dynamic message selection.
    • Clarified that dynamic log levels and dynamic messages are independent choices.
    • Recommended using a static message with a label when the label already describes the case.

Walkthrough

The instrumentation guide adds guidance for message = dynamic, including a DynamicMessage example with outcome-specific text and clarification that dynamic levels and messages are independent.

Changes

Observability documentation

Layer / File(s) Summary
Dynamic message guidance
docs/observability/instrumentation.md
Documents implementing Event::message() through DynamicMessage, demonstrates conditional messages based on outcome, and recommends static messages with #[label] when labels already represent the case.

Estimated code review effort: 1 (Trivial) | ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the doc-only change and matches the added guidance for message = dynamic.
Description check ✅ Passed The description accurately explains the new instrumentation guidance and its rationale.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

…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>
@chet
chet force-pushed the gh-issue-3169-docs branch from e8a277e to 670136c Compare July 23, 2026 20:48
@chet

chet commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full_review, thanks!

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@chet Understood — I’ll perform a full review of the PR.

🐇🔍

✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 58959fc and 670136c.

📒 Files selected for processing (1)
  • docs/observability/instrumentation.md

Comment on lines +142 to +154
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",
}
}
}
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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.rs

Repository: 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.

@chet
chet merged commit cae264b into NVIDIA:main Jul 24, 2026
63 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants