Kuadrant / Kuadrant/kuadrant-console-plugin

OIDCPolicy View: Metrics Tab with Perses Panels

Open
#686 0 comments 0 reactions 0 assignees View on GitHub
triage/accepted
Dominant language
TypeScript
Stars
10
Forks
65
Avg merge
2d 8h
Merged PRs (30d)
44

Description

## Context

Add a Metrics tab to the OIDCPolicy details page showing OIDC authentication metrics using embedded Perses panels. This answers: "Are OIDC auth flows succeeding? Are users being redirected correctly? What's the auth latency?"

Depends on the shared Perses infrastructure established in #220.

## Requirements

### New Metrics tab

Add a `console.tab/horizontalNav` on `OIDCPolicy` (`extensions.kuadrant.io/v1alpha1`):
- Tab name: "Metrics"
- Tab href: `metrics`

**Panels:**

| Panel | Metric | Panel Type |
|-------|--------|-----------|
| Auth Decisions Over Time | `sum(rate(auth_server_authconfig_response_status{authconfig=~"\|-callback", namespace=""}[5m])) by (status)` | TimeSeriesChart stacked (OK / UNAUTHENTICATED / PERMISSION_DENIED) |
| Auth Latency | `histogram_quantile(0.50, rate(auth_server_authconfig_duration_seconds_bucket{authconfig=~"\|-callback", namespace=""}[5m]))` (repeat for p95, p99) | TimeSeriesChart (3 lines: p50, p95, p99) |
| Total Evaluations | `sum(rate(auth_server_authconfig_total{authconfig=~"\|-callback", namespace=""}[5m]))` | StatChart (evaluations/s) |
| Main vs Callback Split | `sum(rate(auth_server_authconfig_total{authconfig="", namespace=""}[5m]))` and `sum(rate(auth_server_authconfig_total{authconfig="-callback", namespace=""}[5m]))` | TimeSeriesChart (2 series) |

**Controls:**
- Time range selector: 15m, 1h, 6h, 24h, 7d (default: 1h)

### AuthConfig name mapping

OIDCPolicy creates **two AuthPolicy resources** under the hood, resulting in two AuthConfigs in Authorino:
1. `` — main flow (JWT auth + redirect to IDP login)
2. `-callback` — callback flow (code-for-token exchange)

Both produce `auth_server_authconfig_*` metrics. Queries should match both using regex: `authconfig=~"|-callback"`.

### Deep metrics (opt-in)

With `--deep-metrics-enabled` on Authorino or `metrics: true` on individual evaluators, additional evaluator-level metrics are available:
- `auth_server_evaluator_total{evaluator_type="IDENTITY_JWT"}` — JWT validation counts
- `auth_server_evaluator_denied{evaluator_type="IDENTITY_JWT"}` — JWT validation failures
- `auth_server_evaluator_duration_seconds{evaluator_type="IDENTITY_JWT"}` — JWT validation latency

### Empty states
- No OIDC data: "No OIDC metrics available. Metrics will appear once requests are evaluated by this policy."
- Authorino metrics not available: "OIDC metrics require Authorino to be configured with metrics enabled."
- Prometheus unavailable: shared `EmptyMetricsState` component from #220

## Notes
- Requires React 18 upgrade (OCP 4.22+ only)

Contributor guide

Open the contributing guide

Research direction

Locate the OIDCPolicy details page and the shared Perses infrastructure from #220, then review the EmptyMetricsState component and the React 18 upgrade requirements. Implement the Metrics tab, its four panels, time-range controls, AuthConfig name mapping, and the specified empty states; done means the tab renders the requested OIDC metrics and handles unavailable data and Prometheus cleanly.

Written by the indexing model from the issue text.

Assessment

Tech stack
prometheus, react, typescript
Domain
frontend, observability
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.