Skip to content

Conversation

@googs1025
Copy link
Member

@googs1025 googs1025 commented Dec 2, 2025

What type of PR is this?

/kind feature

What this PR does / why we need it:

Introduce SchedulerAttemptsTotal counter with "success"/"failure" status
labels. This improves observability of
the scheduler for monitoring, alerting, and debugging in production.

Which issue(s) this PR fixes:

Fixes None

Does this PR introduce a user-facing change?:

Added `scheduler_attempts_total` counter metric with `status` label to improve scheduler observability.

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Dec 2, 2025
@netlify
Copy link

netlify bot commented Dec 2, 2025

Deploy Preview for gateway-api-inference-extension ready!

Name Link
🔨 Latest commit 6b1988a
🔍 Latest deploy log https://app.netlify.com/projects/gateway-api-inference-extension/deploys/69357ec20282a20008aa607f
😎 Deploy Preview https://deploy-preview-1931--gateway-api-inference-extension.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Dec 2, 2025
// RecordSchedulingOutcome records metrics at the end of a scheduling attempt,
// including latency, attempt status.
func RecordSchedulingOutcome(duration time.Duration, err error) {
RecordSchedulerE2ELatency(duration)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this metric should be nested in here. Please remove this call.

Copy link
Member Author

Choose a reason for hiding this comment

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

removed


defer func() {
metrics.RecordSchedulerE2ELatency(time.Since(scheduleStart))
metrics.RecordSchedulingOutcome(time.Since(scheduleStart), err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please replace this line and the deleted line above with:

Suggested change
metrics.RecordSchedulingOutcome(time.Since(scheduleStart), err)
duration := time.Since(scheduleStart)
metrics.RecordSchedulerE2ELatency(duration)
metrics.RecordSchedulingOutcome(duration, err)

@googs1025 googs1025 force-pushed the metrics/scheduler_counter branch 2 times, most recently from f54475a to 6983812 Compare December 4, 2025 01:12
@googs1025 googs1025 changed the title feat(metrics): add scheduler attempt counter and outcome helper feat(metrics): add scheduler attempt counter Dec 4, 2025
@googs1025 googs1025 force-pushed the metrics/scheduler_counter branch from 6983812 to 1f791b7 Compare December 6, 2025 13:46
@googs1025 googs1025 requested a review from shmuelk December 6, 2025 14:09
@shmuelk
Copy link
Contributor

shmuelk commented Dec 7, 2025

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 7, 2025
before := time.Now()
result, err := s.profileHandler.ProcessResults(ctx, cycleState, request, profileRunResults)
metrics.RecordPluginProcessingLatency(framework.ProcessProfilesResultsExtensionPoint, s.profileHandler.TypedName().Type, s.profileHandler.TypedName().Name, time.Since(before))
metrics.RecordSchedulerAttempt(err)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not capturing correctly all error paths.
e.g., L82 is yet another path where the scheduler attempt fails.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for this catch, I've made some change.

Signed-off-by: CYJiang <googs1025@gmail.com>
@googs1025 googs1025 force-pushed the metrics/scheduler_counter branch from 1f791b7 to 6b1988a Compare December 7, 2025 13:18
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 7, 2025
@nirrozenbaum
Copy link
Contributor

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 7, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: googs1025, nirrozenbaum, shmuelk

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 7, 2025
@k8s-ci-robot k8s-ci-robot merged commit 79eaabe into kubernetes-sigs:main Dec 7, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants