Skip to content

Fix: Downgrade NTPOT metrics error to verbose info to reduce noise#2435

Merged
k8s-ci-robot merged 1 commit intokubernetes-sigs:mainfrom
ycjiang50:fix-ntpot-log-noise-clean
Mar 2, 2026
Merged

Fix: Downgrade NTPOT metrics error to verbose info to reduce noise#2435
k8s-ci-robot merged 1 commit intokubernetes-sigs:mainfrom
ycjiang50:fix-ntpot-log-noise-clean

Conversation

@ycjiang50
Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind bug

What this PR does / why we need it:
This PR downgrades the log level of the error "Output token count must be positive for NTPOT calculation" from Error to V(logutil.VERBOSE).Info.

Currently, when a client performs a streaming request without explicitly setting stream_options: {"include_usage": true}, the vLLM backend (and likely others) does not return usage statistics (token counts) in the final chunk.

The EPP relies on Usage.CompletionTokens to calculate the Normalized Time Per Output Token (NTPOT) metric. When this usage data is missing (0 tokens), EPP logs an error for every single request, causing significant log noise. For example, when I was using inference-perf to run some benchmark, which doesn't specify stream_options, the epp logs were completely overwhelmed by this error, making it hard to see any other useful output.
image

Which issue(s) this PR fixes:

Fixes #

Does this PR introduce a user-facing change?:

NONE

@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Feb 27, 2026
@netlify
Copy link
Copy Markdown

netlify Bot commented Feb 27, 2026

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

Name Link
🔨 Latest commit 74bc5f9
🔍 Latest deploy log https://app.netlify.com/projects/gateway-api-inference-extension/deploys/69a4ef015e9de7000826c1bd
😎 Deploy Preview https://deploy-preview-2435--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 Feb 27, 2026
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Feb 27, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Hi @ycjiang50. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Feb 27, 2026
@ycjiang50 ycjiang50 changed the title Fix: Downgrade NTPOT error to verbose info to reduce noise Fix: Downgrade NTPOT metrics error to verbose info to reduce noise Feb 27, 2026
@LukeAVanDrie
Copy link
Copy Markdown
Contributor

Currently, when a client performs a streaming request without explicitly setting stream_options: {"include_usage": true}, the vLLM backend (and likely others) does not return usage statistics (token counts) in the final chunk.

If this is somewhat expected behavior, I wonder if we should even log this case. I noticed this while running and inference-perf too.

Comment thread pkg/epp/metrics/metrics.go Outdated

if outputTokenCount <= 0 {
log.FromContext(ctx).Error(nil, "Output token count must be positive for NTPOT calculation",
log.FromContext(ctx).V(logutil.VERBOSE).Info("Output token count must be positive for NTPOT calculation",
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.

+1 to luke's comment, lets return early at the beginning of the func if the value is 0 or less

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks. I've updated the pr.

@ycjiang50 ycjiang50 force-pushed the fix-ntpot-log-noise-clean branch from d4ec18b to 74bc5f9 Compare March 2, 2026 01:59
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Mar 2, 2026
@ahg-g
Copy link
Copy Markdown
Contributor

ahg-g commented Mar 2, 2026

/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 Mar 2, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahg-g, ycjiang50

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

The pull request process is described here

Details 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 Mar 2, 2026
@nirrozenbaum
Copy link
Copy Markdown
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 2, 2026
@k8s-ci-robot k8s-ci-robot merged commit 8bcdc82 into kubernetes-sigs:main Mar 2, 2026
11 checks passed
RyanRosario pushed a commit to RyanRosario/gateway-api-inference-extension that referenced this pull request Mar 9, 2026
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/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

5 participants