Skip to content

feat(api): add static address operation metrics#3394

Draft
behroozrafii wants to merge 1 commit into
NVIDIA:mainfrom
behroozrafii:behrooz/837-static-address-metrics
Draft

feat(api): add static address operation metrics#3394
behroozrafii wants to merge 1 commit into
NVIDIA:mainfrom
behroozrafii:behrooz/837-static-address-metrics

Conversation

@behroozrafii

Copy link
Copy Markdown

Add outcome-based metrics for static address assignment, removal, and
preallocation operations.

The new events use the repository's carbide_instrument::Event framework
and record one counter event for each completed operation:

  • carbide_static_address_assignments_total
  • carbide_static_address_removals_total
  • carbide_static_address_preallocations_total

Each counter includes a bounded outcome label. Error outcomes also emit
a warning containing the error context, while successful outcomes only
update the corresponding metric.

The existing database and API behavior is unchanged. The public handlers
call the original operation logic, record its outcome, and return the
original result.

Related issues

Closes #837

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

Validated on Linux:

  • cargo check -p carbide-api-core
  • cargo test -p carbide-api-core --lib static_address_metrics::tests::events_count_all_outcomes_and_log_only_errors

The focused unit test verifies that every assignment, removal, and
preallocation outcome increments the expected counter and that only error
outcomes produce warning logs.

Additional Notes

The implementation follows the current repository instrumentation
guidelines by using bounded outcome labels and _total counter names.

Signed-off-by: Behrooz Rafii <brafii@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented Jul 11, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 64087b7e-d4cc-4c8e-9e80-8be8b0b7b728

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

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.

add metrics related to static IP reservation/assignment management

1 participant