Skip to content

docs(observability): document metric label-key aliases#3767

Open
chet wants to merge 1 commit into
NVIDIA:mainfrom
chet:gh-issue-3732-docs
Open

docs(observability): document metric label-key aliases#3767
chet wants to merge 1 commit into
NVIDIA:mainfrom
chet:gh-issue-3732-docs

Conversation

@chet

@chet chet commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

This is the documentation half of #3752.

Document the narrow #[label(name = "...")] compatibility form beside the instrumentation guide's label and reserved-field rules. It preserves a frozen Prometheus label key while generated logs keep the domain-specific Rust field name, with bare #[label] remaining the default.

Related issues

Type of Change

  • Add - New feature or capability
  • Change - Changes in existing functionality
  • Fix - Bug fixes
  • Remove - Removed features or deprecated functionality
  • Internal - Internal changes (refactoring, tests, docs, etc.)

Breaking Changes

  • This PR contains breaking changes

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • No testing required (docs, internal refactor, etc.)

Verified with:

  • cargo make format-nightly
  • git diff --check

The parser, rustdoc, guardrail tests, and first DSX use remain with #3752.

Additional Notes

This docs PR depends on #3752 and should merge after it so main does not advertise syntax before the implementation is available. The code-local rustdoc and guardrail tests stay with the implementation.

This is the documentation half of NVIDIA#3752.

Document the narrow `#[label(name = "...")]` compatibility form beside the instrumentation guide's label and reserved-field rules. It preserves a frozen Prometheus label key while generated logs keep the domain-specific Rust field name, with bare `#[label]` remaining the default.

This supports NVIDIA#3732

Signed-off-by: Chet Nichols III <chetn@nvidia.com>
@chet
chet requested a review from polarweasel as a code owner July 21, 2026 06:03
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 79f4c7cd-37dc-4390-afad-22c3eb1006ff

📥 Commits

Reviewing files that changed from the base of the PR and between 4ad44c6 and ced96bc.

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

Summary by CodeRabbit

  • Documentation
    • Clarified how to handle metric label keys that conflict with reserved Event-log fields.
    • Documented how compatibility aliases affect metric labels and generated log fields.
    • Added guidance for preserving existing metric-only label keys when events gain log output.

Walkthrough

The instrumentation documentation now explains how #[label(name = "...")] preserves metric label keys when they conflict with reserved Event-log fields, while generated logs continue using the Rust field name.

Changes

Observability Documentation

Layer / File(s) Summary
Document metric label-key compatibility
docs/observability/instrumentation.md
Documents metric-only label-key aliasing, Rust field-name usage in generated logs, and guidance for preserving metric contracts when logging is introduced.

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

Possibly related PRs

  • NVIDIA/infra-controller#3752: Implements Event derive macro support for the metric label-key aliasing described by these documentation updates.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the documentation update about metric label-key aliases.
Description check ✅ Passed The description is clearly aligned with the documentation-only change and its compatibility syntax scope.
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

chet commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full_review, thanks!

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

@chet: I’ll perform a complete re-review of the PR. 🐇

✅ Action performed

Full review finished.

chet added a commit that referenced this pull request Jul 21, 2026
The API state-change hook, managed-host republisher, and rack BMS worker
counted DSX publish outcomes separately from their matching diagnostics.

Typed sibling `Event`s now pair those signals while preserving the
frozen `{component,status}` series and each publisher's historical log
behavior. Operational detail remains log-only. The narrow `#[label(name
= "component")]` alias keeps the existing metric key without colliding
with the Event log's reserved `component` identity, and field-attribute
diagnostics reject unsupported metadata instead of silently ignoring it.

Table-driven tests cover the outcome matrix and alias guardrails.

## Related issues

- This supports #3732
- Documentation: #3767
- Part of #3169

## Type of Change

- [ ] **Add** - New feature or capability
- [ ] **Change** - Changes in existing functionality
- [ ] **Fix** - Bug fixes
- [ ] **Remove** - Removed features or deprecated functionality
- [x] **Internal** - Internal changes (refactoring, tests, docs, etc.)

## Breaking Changes

- [ ] **This PR contains breaking changes**

## Testing

- [x] Unit tests added/updated
- [x] Integration tests added/updated
- [ ] Manual testing performed
- [ ] No testing required (docs, internal refactor, etc.)

The bounded component/status mappings and publish-outcome metric/log
matrix use `value_scenarios!`; the proc-macro diagnostics use named
`check_values` rows. Stateful queue, republisher, and rack BMS behavior
remains covered by their existing focused tests.

Verified with:

- `cargo test -p carbide-instrument-macros -p carbide-instrument -p
carbide-mqtt-common`
- `cargo test -p carbide-api-core mqtt_state_change_hook --lib`
- `cargo test -p carbide-rack bms_client --lib`
- `cargo make format-nightly`
- `cargo make clippy`
- `cargo make carbide-lints`
- `cargo make check-event-names`
- `cargo xtask check-metric-docs`
- `cargo make check-workspace-deps`
- `cargo make check-licenses`
- `cargo make check-bans`

## Additional Notes

The `#[label(name = "component")]` guardrail tests and code-local
rustdoc stay with the implementation. The broader instrumentation-guide
update is split into #3767 and depends on this PR.

This PR and #3746 both extend Event field-attribute parsing. Merge
reconciliation must retain #3746's `#[context(value)]` mode and this
PR's bare-only `#[observation]` validation; metric-key aliases remain
exclusive to `#[label(name = "...")]`.

Signed-off-by: Chet Nichols III <chetn@nvidia.com>
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.

1 participant