Skip to content

fix(observability): report failure rate as a percentage - #6019

Merged
mmabrouk merged 1 commit into
Agenta-AI:release/v0.112.1from
iamhaseebn:fix/5967-usage-failure-rate
Aug 13, 2026
Merged

mmabrouk merged 1 commit into
Agenta-AI:release/v0.112.1from
iamhaseebn:fix/5967-usage-failure-rate

Conversation

@iamhaseebn

@iamhaseebn iamhaseebn commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #5967.

The usage card treated the failure rate as a ratio even though the UI appends %, so 1 failed request out of 6 displayed as 0.17%. The analytics transform now returns a percentage, so the card displays 16.67%.

Testing

Verified locally

  • pnpm --filter @agenta/oss exec vitest run src/services/tracing/lib/helpers.test.ts
  • Full OSS unit suite: 575 passed, 1 skipped
  • OSS and EE TypeScript checks
  • Formatting and linting

Added or updated tests

Added a regression test for 1 failure in 6 requests, expecting 16.67.

QA follow-up

Confirm the Requests card shows 16.67% for 1 failed request out of 6.

Demo

Agenta Requests card showing a 16.67% failure rate

Checklist

  • I have included a screenshot for this UI change
  • Relevant tests pass locally
  • Relevant linting and formatting pass locally
  • I have signed the CLA, or I will sign it when the bot prompts me

Contributor Resources

@vercel

vercel Bot commented Aug 13, 2026

Copy link
Copy Markdown

@iamhaseebn is attempting to deploy a commit to the agenta projects Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Aug 13, 2026
@CLAassistant

CLAassistant commented Aug 13, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@coderabbitai

coderabbitai Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Enhancements
    • Failure rates in tracing analytics are now represented as percentages from 0% to 100%, making results easier to interpret.
    • Analytics calculations now accurately communicate the proportion of failed traces within the selected time window.

Walkthrough

The tracing analytics helper now returns failure_rate as a percentage from 0 to 100. Vitest coverage verifies that one error across six traces produces approximately 16.67%.

Changes

Failure rate correction

Layer / File(s) Summary
Percentage calculation and validation
web/oss/src/services/tracing/lib/helpers.ts, web/oss/src/services/tracing/lib/helpers.test.ts
analyticsToGeneration multiplies the error ratio by 100. Tests cover trace and cumulative-error metric paths and expect approximately 16.67% for one error across six traces.

Estimated code review effort: 2 (Simple) | ~10 minutes

Mergeability Score: ⚪ Minimal · up to 35827

This change makes the Requests card display failure rates as percentages, such as 16.67% instead of 0.17%. The calculation is localized and covered by regression tests, with no actionable merge-blocking risk remaining after normal checks.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The change satisfies issue #5967 by converting the failure-rate ratio to a percentage and adding regression coverage.
Out of Scope Changes check ✅ Passed The code and test changes are limited to the failure-rate calculation and its regression test.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly and concisely describes the main change: reporting observability failure rates as percentages.
Description check ✅ Passed The description directly explains the failure-rate bug, the percentage fix, the regression test, and validation results.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
web/oss/src/services/tracing/lib/helpers.test.ts (1)

8-26: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add boundary-case assertions for the percentage contract.

The test covers one error out of six traces. Add cases for an all-failure input returning 100 and an empty input returning 0. These cases protect the remaining failure_rate branches and the all-failure behavior described in the PR objective.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 8c539c0f-d9cc-4b7d-b59e-037310088234

📥 Commits

Reviewing files that changed from the base of the PR and between 5826af7 and 3582748.

📒 Files selected for processing (2)
  • web/oss/src/services/tracing/lib/helpers.test.ts
  • web/oss/src/services/tracing/lib/helpers.ts

@mmabrouk mmabrouk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @iamhaseebn for your contribution!

@mmabrouk

Copy link
Copy Markdown
Member

@all-contributors please add @iamhaseebn for code

@mmabrouk
mmabrouk merged commit af8fb0a into Agenta-AI:release/v0.112.1 Aug 13, 2026
4 of 5 checks passed
@allcontributors

Copy link
Copy Markdown
Contributor

@mmabrouk

I've put up a pull request to add @iamhaseebn! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug size:XS This PR changes 0-9 lines, ignoring generated files. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants