Context
Add a Metrics tab to the TokenRateLimitPolicy details page showing token-based rate limiting metrics using embedded Perses panels. This answers: "Are consumers hitting token limits? How many tokens are being consumed?"
Depends on the shared Perses infrastructure established in #220.
Requirements
New Metrics tab
Add a console.tab/horizontalNav on TokenRateLimitPolicy (kuadrant.io/v1alpha1):
- Tab name: "Metrics"
- Tab href:
metrics
Panels:
| Panel |
Metric |
Panel Type |
| Token Consumption Over Time |
sum(rate(authorized_hits{limitador_namespace="<ns>/<route>"}[5m])) |
TimeSeriesChart |
| Requests vs Tokens |
sum(rate(authorized_calls{limitador_namespace="<ns>/<route>"}[5m])) and sum(rate(authorized_hits{limitador_namespace="<ns>/<route>"}[5m])) |
TimeSeriesChart (2 series: requests, tokens) |
| Rejected Requests |
sum(rate(limited_calls{limitador_namespace="<ns>/<route>"}[5m])) |
TimeSeriesChart |
| Token Reports |
sum(rate(report_calls{limitador_namespace="<ns>/<route>"}[5m])) |
StatChart (reports/s) |
| Rejection Rate |
sum(rate(limited_calls[5m])) / (sum(rate(authorized_calls[5m])) + sum(rate(limited_calls[5m]))) * 100 scoped to this policy |
GaugeChart |
Controls:
- Time range selector: 15m, 1h, 6h, 24h, 7d (default: 1h)
Token vs counter rate limiting
TokenRateLimitPolicy uses Limitador's report RPC instead of check_rate_limit. Key differences from RateLimitPolicy (#639):
authorized_hits reflects actual token counts (e.g. LLM usage.total_tokens) — much larger than authorized_calls
report_calls tracks token reporting operations (unique to token-based limiting)
- The
report endpoint always returns OK — enforcement happens at the prior check_rate_limit call
Limitador namespace scoping
The limitador_namespace label format is "{k8s_namespace}/{route_name}". To scope to a specific TokenRateLimitPolicy, the target HTTPRoute's namespace and name must be resolved from the policy's targetRef.
With telemetry: exhaustive on the Limitador CR, limited_calls includes a limit_name label for per-limit breakdown.
Empty states
Notes
- Requires React 18 upgrade (OCP 4.22+ only)
Context
Add a Metrics tab to the TokenRateLimitPolicy details page showing token-based rate limiting metrics using embedded Perses panels. This answers: "Are consumers hitting token limits? How many tokens are being consumed?"
Depends on the shared Perses infrastructure established in #220.
Requirements
New Metrics tab
Add a
console.tab/horizontalNavonTokenRateLimitPolicy(kuadrant.io/v1alpha1):metricsPanels:
sum(rate(authorized_hits{limitador_namespace="<ns>/<route>"}[5m]))sum(rate(authorized_calls{limitador_namespace="<ns>/<route>"}[5m]))andsum(rate(authorized_hits{limitador_namespace="<ns>/<route>"}[5m]))sum(rate(limited_calls{limitador_namespace="<ns>/<route>"}[5m]))sum(rate(report_calls{limitador_namespace="<ns>/<route>"}[5m]))sum(rate(limited_calls[5m])) / (sum(rate(authorized_calls[5m])) + sum(rate(limited_calls[5m]))) * 100scoped to this policyControls:
Token vs counter rate limiting
TokenRateLimitPolicy uses Limitador's
reportRPC instead ofcheck_rate_limit. Key differences from RateLimitPolicy (#639):authorized_hitsreflects actual token counts (e.g. LLMusage.total_tokens) — much larger thanauthorized_callsreport_callstracks token reporting operations (unique to token-based limiting)reportendpoint always returns OK — enforcement happens at the priorcheck_rate_limitcallLimitador namespace scoping
The
limitador_namespacelabel format is"{k8s_namespace}/{route_name}". To scope to a specific TokenRateLimitPolicy, the target HTTPRoute's namespace and name must be resolved from the policy'stargetRef.With
telemetry: exhaustiveon the Limitador CR,limited_callsincludes alimit_namelabel for per-limit breakdown.Empty states
EmptyMetricsStatecomponent from Overview Page: Migrate to Perses Metrics Panels and Add Observability Tab #220Notes