Repository navigation
feat: report quota exhaustion as its own quota_exceeded metrics event (1.7.3) - #81
Merged
Merged
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
The deployed metrics backend’s support for quota_exceeded on the cli channel remains unverified, and an HTTP 400 rejection would discard the entire queued batch, including unrelated events.
No open issues 🎉
What changed in this PR
This PR separates plan quota exhaustion from CLI failures in metrics, introducing a dedicated quota_exceeded event for version 1.8.0.
Changes:
- Emit
quota_exceededwithouterrorType, preserving shared event metadata. - Add tests for direct quota errors and quota errors followed by generic unwind errors.
- Document the event and bump the version to 1.8.0.
The metrics ingestion backend must accept the new event type before merging.
| File | Description |
|---|---|
src/modules/metrics/metrics.ts |
Emit a dedicated event for quota exhaustion. |
src/__tests__/modules/metrics.test.ts |
Test quota event classification and omission of errorType. |
README.md |
Document the new event and update the version badge. |
package.json |
Bump the package version to 1.8.0. |
Review effort: Balanced
… (1.7.3) A plan running out of characters is not the CLI failing. Commands that stop on an exhausted quota now queue eventType 'quota_exceeded' instead of 'call_error' with errorType 'quota_exceeded', so the error funnel only counts real failures. Metadata is unchanged.
Starllordz
force-pushed
the
feature/quota-exceeded-event
branch
from
November 3, 2026 15:30
fd051f1 to
8009dfa
Compare
Khalester
approved these changes
Nov 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What
When a command stops because the Lara plan quota is exhausted, metrics now queue a dedicated event:
{ "eventType": "quota_exceeded", "latencyMs": ..., "charsTranslated": ..., "metadata": { ... } }instead of
call_errorwitherrorType: "quota_exceeded".Why
Running out of plan characters is not the CLI failing. Keeping it out of
call_errorlets the error funnel count only real failures, and makes quota exhaustion trackable on its own.Details
finishCommand(src/modules/metrics/metrics.ts) reuseserrorTypeFor, so quota errors wrapped ascause(e.g. theHandledExitErrorthrown intranslate.ts) are still detected, and a quota error is not buried by a later generic error.command,feature,exitCode,httpStatus,laraErrorType, …).errorTypeis omitted on the new event.auth_failis unaffected (quota never arrives as 401/403).Before merging
The metrics ingestion backend must accept
eventType: "quota_exceeded"for theclichannel. If it validates event types against a closed list, it would reject the whole batch the event rides in.Tests
finishCommandtests: quota error →quota_exceededwith noerrorType; quota error followed by a generic unwind error → stillquota_exceeded.pnpm test(981 passing),pnpm run build, ESLint and Prettier on touched files.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.