Skip to content

Add optional usage quotas for Explain Error provider calls #132

@shenxianpeng

Description

@shenxianpeng

Problem

Administrators may need to control plugin usage and provider cost, especially in shared Jenkins environments.

Goal

Allow optional quotas for real Explain Error provider calls.

Scope

V1 quota scope:

  • controller-level quota only
  • applies only to real provider calls
  • does not apply to cache hits
  • time-window based (for example hourly or daily)

V2 quota scope

  • Folder-level quotas
  • User-level quotas
  • Provider billing reconciliation
  • Automatic fallback to another model/provider

Proposed Behavior

When the configured quota is exceeded:

  • reject the request before the provider call
  • show a clear user-facing message
  • record a quota_rejected usage event
  • increment quota rejection metrics

Proposed Configuration

Add optional global settings such as:

  • enable quota
  • quota window
  • max provider calls per window

Acceptance Criteria

  • Requests are allowed until the configured quota is reached.
  • Cache hits do not consume quota.
  • Rejected requests do not call the provider.
  • Quota rejections are visible in usage tracking and metrics.
  • Existing behavior is unchanged when quotas are disabled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions