Skip to content

feat: add metrics for capacity recommendation provider - #1908

Merged
Matthew Christopher (matthchr) merged 5 commits into
Azure:mainfrom
matthchr:matthchr/capacity-rec-metrics
Sep 15, 2026
Merged

Matthew Christopher (matthchr) merged 5 commits into
Azure:mainfrom
matthchr:matthchr/capacity-rec-metrics

Conversation

@matthchr

Copy link
Copy Markdown
Member

Description

How was this change tested?

  • Unit tests

Does this change impact docs?

  • Yes, PR includes docs updates
  • Yes, issue opened: #
  • No

Release Note


Copilot AI lite review requested due to automatic review settings September 14, 2026 18:17

Copilot AI 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.

🟢 Approval recommended

No unresolved blocking issues were identified.

Pull request overview

Adds Prometheus metrics for capacity recommendation API requests, latency, results, and cache hits.

Changes:

  • Instruments SKU Mix Placement API calls.
  • Records request outcomes, durations, and cache hits.
  • Adds shared metric labels and unit tests.
File summaries
File Description
pkg/providers/capacityrecommendation/metrics.go Defines capacity recommendation metrics.
pkg/providers/capacityrecommendation/capacity_recommendation.go Integrates API and cache-hit instrumentation.
pkg/providers/capacityrecommendation/capacity_recommendation_test.go Tests emitted metrics.
pkg/metrics/constants.go Adds shared metric label constants.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread pkg/metrics/constants.go Outdated
Comment thread pkg/providers/capacityrecommendation/metrics.go Outdated

Copilot AI 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.

🟢 Approval recommended

No unresolved blocking issues were identified.

Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI 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.

🔵 Needs a closer look

A moderate performance issue remains in the cache-hit metric label path.

Review details

Suppressed comments (1)

pkg/providers/capacityrecommendation/metrics.go:96

  • Medium · Performance — On every cache lookup, including hits, this rebuilds the complete SDK request (allocating VM-size and zone pointer slices) solely to derive the metric labels. GetRecommendations is called once per recommendation group and the cache-hit path is intended to avoid this work; derive the same labels directly from RankingInput (ideally via a dedicated input-label helper) instead of calling toSKUMixPlacementRequest here.
	labels := requestMetricLabels(toSKUMixPlacementRequest(input))
  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI 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.

🟢 Approval recommended

No unresolved review issues were identified.

Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@matthchr
Matthew Christopher (matthchr) merged commit 59a1096 into Azure:main Sep 15, 2026
14 checks passed
@matthchr
Matthew Christopher (matthchr) deleted the matthchr/capacity-rec-metrics branch September 15, 2026 00:45
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.

4 participants