Skip to content

Conversation

nirrozenbaum
Copy link
Contributor

I've been asked several times about the ability to debug specific scorers when running EPP.
to help debug, this PR adds logging (in trace level) of a score per pod of a scorer.

Copy link

netlify bot commented Aug 18, 2025

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

Name Link
🔨 Latest commit cc9903e
🔍 Latest deploy log https://app.netlify.com/projects/gateway-api-inference-extension/deploys/68a57bfde0a5b90008f50bfa
😎 Deploy Preview https://deploy-preview-1395--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 the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 18, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nirrozenbaum

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 approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Aug 18, 2025
@nirrozenbaum
Copy link
Contributor Author

fix #1170

func (p *SchedulerProfile) runScorerPlugins(ctx context.Context, request *types.LLMRequest, cycleState *types.CycleState, pods []types.Pod) map[types.Pod]float64 {
loggerDebug := log.FromContext(ctx).V(logutil.DEBUG)
logger := log.FromContext(ctx)
loggerTrace := logger.V(logutil.TRACE)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit/nonblocking: I keep noticing this pattern, and I'm honestly not sure it actually provides greater value than just explicitly setting the level per log?

Not necessarily a crusade I'll start on this PR but its worth mentioning. Why cant we just set the log level per log?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, sure. we can set log level per log.
I don't see any advantage of current approach.
sounds like a new good-first-issue is on the way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed it but only in the scope of this PR.
I can do a quick pass over the code and change it or we can open a good-first-issue.
I would try to change the logging package by package and not the whole repo at once which will touch too many files at once.
this is yet another practice that newcomers would use when they push PRs.

scores := scorer.Score(ctx, cycleState, request, pods)
metrics.RecordPluginProcessingLatency(ScorerExtensionPoint, scorer.TypedName().Type, scorer.TypedName().Name, time.Since(before))
for pod, score := range scores { // weight is relative to the sum of weights
if loggerTrace.Enabled() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this conditional necessary? I think this check is done internally

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right. no necessary.
fixing.

@kfswain
Copy link
Collaborator

kfswain commented Aug 18, 2025

Couple small comments.

One thing to note: this should only be used for light debugging, our Trace logs are breathtakingly verbose and will introduce a high amount of lock contention if used with higher concurrency. I'll have a public doc to share later today about this topic, but just wanted to share.

/lgtm
/hold
Holding if you want to address comments

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 18, 2025
@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Aug 18, 2025
@nirrozenbaum
Copy link
Contributor Author

Couple small comments.

One thing to note: this should only be used for light debugging, our Trace logs are breathtakingly verbose and will introduce a high amount of lock contention if used with higher concurrency. I'll have a public doc to share later today about this topic, but just wanted to share.

/lgtm /hold Holding if you want to address comments

addressed your comments.
about the point you raised - IMO trace logs should be disabled when having higher concurrently.
more generally, trace level logging is meant to be used for debug purposes when testing a new feature/plugin.
this is not to be used in high scale or in production.
I don't know any project/system that recommends running large scale scenarios with trace level logging verbosity.
this should be obvious to anyone running IGW, don't think we need to clearly document that point.

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 18, 2025
Signed-off-by: Nir Rozenbaum <[email protected]>
@kfswain
Copy link
Collaborator

kfswain commented Aug 21, 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 Aug 21, 2025
@k8s-ci-robot k8s-ci-robot merged commit ad489ac into kubernetes-sigs:main Aug 21, 2025
9 of 10 checks passed
@nirrozenbaum nirrozenbaum deleted the log-scores branch August 21, 2025 07:20
@nirrozenbaum nirrozenbaum linked an issue Aug 22, 2025 that may be closed by this pull request
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve logging for plugin selection and scoring in GIE
3 participants