Saved analytics views and dashboards
Last updated: 2026-11-21T09:54:10-03:00 (UTC-3)
A saved view keeps a set of analytics filters, a time range and up to eight dashboard widgets under your own console identity, so you can reopen the same slice later or share it read-only with one team. Flag: analytics_saved_views (default false).
A view stores the question, not the answer: it holds no usage data. Whoever opens it, owner or team member, the console asks the ordinary analytics report again with that reader’s own session, role, team scope and plan. Sharing a view therefore never shows anyone data they could not already see in Usage.
Enable it
Section titled “Enable it”features: usage_analytics: true # required analytics_saved_views: true # saved views and dashboardsThe flag is an operator control (it is not part of a team plan), changes at runtime through the feature API or Configuration → Features, and applies on the next request. It needs PostgreSQL (migration 134 creates gateway_analytics_views); without storage the API answers 503. Turning it off hides the panel and the API (404 feature_disabled) and keeps the stored views; turning it back on shows them again.
There is no other setting. The bounds below are compiled; views are user data, not operator configuration, so they have no YAML form. The flag itself has the usual YAML, API and console parity.
Use it in the console
Section titled “Use it in the console”Observability → Usage shows a Saved views / Dashboards panel under the filters.
- Choose filters and a time range, then click Apply analytics filters. A view saves the applied filters, not the draft. For a team role, the team the console selects by default is not saved: each reader of the view gets its own default team, so a view shared with team B does not stay pinned to your first team. Choose a team explicitly to save it.
- Click Save as new view. Give it a name (1–120 characters), an optional description (up to 500), and pick the sharing:
- Private (only you), the default.
- Read-only for team …: team roles choose one of their own teams; global admins and viewers type a team ID.
- Edit the widgets (1–8). Each has a title, a measure, a grouping and a chart:
| Field | Values |
|---|---|
| Measure | requests, tokens (reported input + output), error_rate, latency (P95) |
| Group by | time, model, provider, team, principal, key, operation |
| Chart | line for time; bar or table for any other grouping |
| Groups | 1–20, dimension widgets only (default 10) |
- Open view applies the view’s filters and draws its widgets above the usual tabs. A group’s name in a bar widget focuses the filters on it; Inspect requests in a table widget opens Request logs with the same slice (requires
request_logsandlogs:read). - Edit view saves changes to your own view; Delete removes it after a confirmation.
What the panel tells you:
- Yours · shared read-only with team t — the team sees it now.
- Yours · not visible to team t: you can no longer act for it — see When a share stops working.
- Shared by u with team t — a teammate’s view; you can open it but not change it.
If someone else saved the view since you opened it, saving answers a conflict: Reload view loads the current version, then you edit again. If it was deleted meanwhile, the panel closes it and refreshes the list. Editing a view shared with a team you have left starts with Private selected and says so.
How the numbers behave
Section titled “How the numbers behave”The widgets use exactly the same report as the Usage tabs, so every rule of reading the numbers applies:
- Dimension widgets rank the top 20 groups the report returns for the selection; a note says when more groups exist. They do not rank the full inventory.
- A value that was not measured shows as Not reported and sorts last; it is never drawn as zero (tokens without token reports, P95 from rollup days, error rate without requests).
- A team role opening a view with no team filter queries its own default team; a view whose team filter is outside the reader’s membership answers
403 team_forbiddenfrom the analytics report, exactly as typing that filter would. - The time range is relative (
24h,7d…) unless the view was saved with a custom range, which keeps its exact dates.
Who can do what
Section titled “Who can do what”| Action | Roles | Rule |
|---|---|---|
| List and open | admin, viewer, user, team_admin, team_viewer (analytics:read) |
Your own views, plus effective shares: every team for admin and viewer, your live teams for team roles |
| Save, edit, delete your own | the same roles (analytics_views:save) |
Owner only edits |
| Share | the same roles | Global roles: any existing team. Team roles: one of their live teams |
| Delete someone else’s | global admin | Only a view the admin can read (moderation) |
The operator role has neither permission. A user bound to a custom role keeps analytics:read when the role grants it, but never analytics_views:save (it is not part of the custom role catalog): such users can open views but not save them. With team feature plans on, a team role reads and writes views only for teams whose plan includes usage_analytics, the same ceiling as the report. Every create, update and delete is written to the control audit as analytics_view.create, analytics_view.update or analytics_view.delete with the target analytics_view:<id>, the actor, the request ID and the version.
The bootstrap administrator token owns its own views (bootstrap_admin). The shared viewer token reads every effective share like a global viewer but cannot save, edit or delete views (403): it names no person, so nothing it would publish could be attributed.
When a share stops working
Section titled “When a share stops working”A team share is effective only while its owner can still act for that team: the bootstrap administrator, a live global admin or viewer, or a live user, team admin or team viewer who is a member of the team; and the team is not deleted. When the owner leaves the team, is disabled, moves to a role without analytics (operator), or the team is deleted, the team stops seeing the view immediately. Nothing is rewritten: the owner still sees it, marked as not visible, and can make it private, share it with another of their teams, or delete it. A save cannot share again with a team the owner left (403). Making a view private (saving without a team) revokes the share at once.
Limits
Section titled “Limits”- 50 views per owner and 10,000 in total (
409 view_capacity). Creates are serialized, so concurrent saves cannot exceed either bound. - 1–8 widgets per view; definition JSON up to 16,384 bytes.
- The list returns at most 200 views (own first, then most recently updated) and says when it was shortened; it has no pagination yet, so in a deployment with more shares a global admin moderates the others by ID through the API.
- Names and widget titles refuse control and format characters (bidirectional overrides, zero-width), which could disguise a name shown to a team.
- Filters follow the analytics bounds: exact values up to 256 bytes without control characters, end user up to 128 characters, usage tag text up to 1,024 bytes, custom ranges of at most 90 days.
All routes are under /api/v1/admin, take the console session (or the admin bearer token) and answer Cache-Control: private, no-store. Writes need same-origin and the X-CSRF-Token header. The full schema is in the OpenAPI contract.
| Method and path | Purpose |
|---|---|
GET /analytics/views |
Your views and effective shares (no query parameters) |
POST /analytics/views |
Create (201) |
GET /analytics/views/{id} |
One view you can read; anything else is 404 |
PUT /analytics/views/{id} |
Replace your view at version (compare-and-set) |
DELETE /analytics/views/{id}?version=N |
Delete at version (204) |
Create a view shared with a team:
curl -sS -X POST "$GATEWAY/api/v1/admin/analytics/views" \ -H "Cookie: $SESSION" -H "X-CSRF-Token: $CSRF" -H "Content-Type: application/json" \ -d '{ "name": "Weekly traffic", "description": "Requests and top models", "team": "platform", "definition": { "schema": 1, "filters": {"range": "7d", "provider": "openai"}, "widgets": [ {"title": "Requests over time", "measure": "requests", "group_by": "time", "chart": "line"}, {"title": "Top models by tokens", "measure": "tokens", "group_by": "model", "chart": "bar", "limit": 10} ] } }'Response (201):
{ "id": "av_3f9c0d2e4b6a8c1e5f7a9b0c", "name": "Weekly traffic", "description": "Requests and top models", "owner": "usr_…", "own": true, "team": "platform", "share_effective": true, "definition": {"schema": 1, "filters": {"range": "7d", "provider": "openai"}, "widgets": ["…"]}, "version": 1, "created_at": "2026-11-14T06:35:00Z", "updated_at": "2026-11-14T06:35:00Z", "can_edit": true, "can_delete": true}PUT takes the same body plus "version" and replaces the view as a whole: leaving team out (or sending null) makes it private. The definition schema refuses unknown fields; filters.range is one of 15m, 1h, 24h, 7d, 30d, 90d or custom (then from and to in RFC 3339 are required).
| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_request, invalid_id |
Unknown field, version on create, missing or extra query parameter |
| 403 | role_forbidden, entitlement_forbidden |
Not the owner, share team not allowed, neither owner nor global admin on delete, the shared viewer token writing, or no team plan with usage analytics |
| 413 | request_too_large |
Body over 32 KiB |
| 404 | feature_disabled, view_not_found |
Flag off, or the view does not exist for you |
| 409 | version_conflict, view_capacity |
Stale version, or a bound reached |
| 422 | invalid_view, invalid_view_definition |
Name/description/team or definition out of bounds |
| 503 | storage_unavailable |
PostgreSQL unavailable |
Upgrade notes
Section titled “Upgrade notes”Migration 134 adds one table and runs automatically with the other migrations. As with every migration, an older binary refuses a database migrated by a newer release (database schema has migration 134, newer than this binary supports): roll out the new binary to every replica, and roll back only by restoring a backup taken before the upgrade. Views refer to teams by ID: deleting a team row clears the share target of its views, and a soft-deleted team stops the share without changing the view.
Admin API routes
Section titled “Admin API routes”Every route below needs a console session or an admin Bearer token, the role’s permission and, for writes, the X-CSRF-Token header; the full contract is in the API reference.
| Route | What it does |
|---|---|
GET /api/v1/admin/analytics/views/{id} |
Reads one saved view the caller may see |
PUT /api/v1/admin/analytics/views/{id} |
Replaces a saved view the caller owns, at its current version |
DELETE /api/v1/admin/analytics/views/{id} |
Deletes a saved view the caller owns |
GET /api/v1/admin/analytics/views |
Lists your own views and the team shares you may read |
POST /api/v1/admin/analytics/views |
Saves a new view owned by your session identity |
See also
Section titled “See also”- Analytics and its CSV export.
- m7 ai for any other grouping through the structured usage query.
- Access control and custom roles.