Skip to content

RSPEED-3017: use custom buckets for response duration histogram#1702

Merged
tisnik merged 1 commit into
lightspeed-core:mainfrom
major:rspeed-3017-fix-response-duration-buckets
May 8, 2026
Merged

RSPEED-3017: use custom buckets for response duration histogram#1702
tisnik merged 1 commit into
lightspeed-core:mainfrom
major:rspeed-3017-fix-response-duration-buckets

Conversation

@major
Copy link
Copy Markdown
Contributor

@major major commented May 8, 2026

Description

Add custom bucket boundaries to the response_duration_seconds Prometheus histogram. The default prometheus_client buckets max out at 10s, which caps Grafana histogram_quantile calculations for requests that take longer. This reuses the existing LLM_INFERENCE_DURATION_BUCKETS tuple (0.1-120s) already used by llm_inference_duration_seconds.

Type of change

  • Refactor
  • New feature
  • Bug fix
  • CVE fix
  • Optimization
  • Documentation Update
  • Configuration Update
  • Bump-up service version
  • Bump-up dependent library
  • Bump-up library or tool used for development (does not change the final image)
  • CI configuration change
  • Konflux configuration change
  • Unit tests improvement
  • Integration tests improvement
  • End to end tests improvement
  • Benchmarks improvement

Tools used to create PR

  • Assisted-by: Claude (opencode)
  • Generated by: N/A

Related Tickets & Documents

Checklist before requesting a review

  • I have performed a self-review of my code.
  • PR has passed all pre-merge test jobs.
  • If it is a core feature, I have added thorough tests.

Testing

  • All 16 existing metrics unit tests pass (uv run make test-unit).
  • Verified response_duration_seconds histogram now uses the custom buckets (0.1, 0.5, 1.0, 2.5, 5.0, 10.0, 20.0, 30.0, 60.0, 120.0, +Inf) matching the llm_inference_duration_seconds histogram.
  • uv run make verify passes cleanly.

The response_duration_seconds histogram used prometheus_client default buckets which max out at 10s, causing histogram_quantile in Grafana to appear capped for requests exceeding 10 seconds. Reuse the existing LLM_INFERENCE_DURATION_BUCKETS (0.1-120s) to cover the full expected response time range.

Signed-off-by: Major Hayden <major@redhat.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 8, 2026

Warning

Rate limit exceeded

@major has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 34 minutes and 12 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 502efd67-2eb5-4a7e-8b74-32e42695db1b

📥 Commits

Reviewing files that changed from the base of the PR and between d15d37d and 047091b.

📒 Files selected for processing (1)
  • src/metrics/__init__.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Copy Markdown
Contributor

@tisnik tisnik left a comment

Choose a reason for hiding this comment

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

LGTM

@tisnik tisnik merged commit 4feeaed into lightspeed-core:main May 8, 2026
29 of 30 checks passed
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.

2 participants