Skip to content

docs(instrument): describe provider-aware metric caches - #4178

Closed
chet wants to merge 1 commit into
NVIDIA:mainfrom
chet:gh-issue-4177-docs
Closed

docs(instrument): describe provider-aware metric caches#4178
chet wants to merge 1 commit into
NVIDIA:mainfrom
chet:gh-issue-4177-docs

Conversation

@chet

@chet chet commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

The Event guide still says each metric handle binds to the first global provider for the process lifetime, while #4176 makes those caches follow provider installation and replacement.

This companion updates the quick start to name the framework setter, explains how early observations and provider replacement behave, and revises the steady-path cost. It also makes the wrapper requirement explicit so callers do not bypass the cache-generation update with OpenTelemetry's global setter.

Related issues

This supports #4177

Parent code issue: #4174

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.)

Validation: git diff --check

Additional Notes

This PR is the documentation half of #4176 and must merge after that code PR. The generated docs/observability/core_metrics.md catalogue is intentionally unchanged because the code PR does not add or rename a metric.

@chet
chet requested a review from polarweasel as a code owner July 26, 2026 19:00

chet commented Jul 26, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full_review, thanks!

@coderabbitai

coderabbitai Bot commented Jul 26, 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: f35983bc-39a1-4836-a3d0-279c4429cf55

📥 Commits

Reviewing files that changed from the base of the PR and between fdb60c2 and 844f9bf.

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

Summary by CodeRabbit

  • Documentation
    • Updated the observability quick-start to install/replace the OpenTelemetry process-global meter provider using carbide_instrument::set_meter_provider.
    • Clarified behavior for metric observations made before the first provider installation, and during provider replacement (may route to either provider).
    • Updated derived-event instrument caching semantics after meter-provider installation/replacement and refreshed performance notes for metric-only emission.

Walkthrough

Updates NICo observability documentation for process-global meter-provider installation, provider replacement behavior, cached Event instruments, and steady-state metric emission costs.

Changes

Observability instrumentation documentation

Layer / File(s) Summary
Provider replacement and Event instrumentation guidance
docs/observability/instrumentation.md
Documents set_meter_provider usage, dropped early metric observations, replacement behavior, refreshed cached instruments, and the two-load-plus-add() steady-state cost.

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

Possibly related issues

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the documentation update about provider-aware metric caches.
Description check ✅ Passed The description is clearly aligned with the docs-only changes and explains the cache and setter behavior updates.
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.

@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

@chet: Starting a complete re-review of all changes in this pull request.

🐇✅

✅ 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 109-118: Add a concise staged-rollout warning to the provider
installation and replacement guidance, instructing operators to validate
experimental NICo behavior and production configurations in non-critical
environments before deploying to critical production systems. Keep the existing
provider behavior description unchanged.
🪄 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: 950fa530-5814-47cc-8a3a-6521ca3ed14f

📥 Commits

Reviewing files that changed from the base of the PR and between fdb60c2 and 38b9948.

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

@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: 2

🤖 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 319-321: Update the steady-state cost description near the Event
instrumentation discussion to avoid claiming only two lock-free loads and an
add; describe the path as a cached instrument lookup, label-array
materialization, and counter update.
- Around line 109-118: Update the provider-installation guidance around
carbide_instrument::set_meter_provider to retain the startup recommendation and
initial pre-install observation behavior, but remove claims that cached Event or
RED instruments follow later provider replacements or that overlapping
observations may reach either provider. State that these instruments remain
cached through provider swaps and only use the provider obtained when
initialized.
🪄 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: f6d48ea3-3ae1-4151-8324-5a3c48dd172b

📥 Commits

Reviewing files that changed from the base of the PR and between fdb60c2 and 38b9948.

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

Comment thread docs/observability/instrumentation.md
Comment thread docs/observability/instrumentation.md Outdated
The Event guide still said each metric handle bound to the first global provider for the process lifetime, while NVIDIA#4176 makes those caches follow provider installation and replacement.

Update the quick start to name the framework setter, explain early observations and the replacement boundary, and revise the steady-path cost. This is the documentation half of NVIDIA#4176.

No tests added; docs-only change.

This supports NVIDIA#4177

Signed-off-by: Chet Nichols III <chetn@nvidia.com>
@chet
chet force-pushed the gh-issue-4177-docs branch from 38b9948 to 844f9bf Compare July 26, 2026 19:19

chet commented Jul 26, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full_review, thanks!

@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

@chet: Starting a complete re-review of all changes in this pull request.

🐇✅

✅ Action performed

Full review finished.

chet commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

Closing this companion with #4176. It documents the generation-aware replacement contract from that code PR, so merging it on its own would describe behavior we are not landing. If we return to #4174 with the smaller one-shot readiness guard, we can document the contract that actually gets implemented then. Thanks!

@chet chet closed this Jul 27, 2026
@chet
chet deleted the gh-issue-4177-docs branch July 27, 2026 02:14
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