Add export, blocklist, tenant budgets, Responses API, and Grafana dashboard#9
Merged
Add export, blocklist, tenant budgets, Responses API, and Grafana dashboard#9
Conversation
…sponses API, and Grafana dashboard - CLI `agentledger export` and REST `/api/dashboard/export` for CSV/JSON cost export - API key blocklist with glob patterns, TTL cache, and admin CRUD endpoints - Per-tenant budget enforcement (tenant-scoped spend lookups, stricter result wins) - OpenAI Responses API (`/v1/responses`) request/response/stream parsing - Grafana 10.x dashboard template with 10 panels across 4 rows - Example config updates for tenant budget rules
… fixes - Add provider donut chart (Chart.js doughnut) with cost breakdown - Add most expensive requests table with /api/dashboard/expensive endpoint - Add error breakdown panel with /api/dashboard/stats endpoint - Add avg cost/request and error rate summary cards - Set Chart.js global default color for dark theme compatibility - Add QueryRecentExpensive and QueryErrorStats to Ledger interface - Implement new queries for SQLite and Postgres backends - Redesign dashboard layout with 2-column grid panels - Auto-select chart interval (hourly/daily/area) based on time range - Update all test mocks for new Ledger interface methods
- Add 30min and 1hr options to timeseries dropdown - Add minute-level bucketing to SQLite and Postgres backends - Support fractional hours in timeseries handler - Switch all time ranges to line/area chart (no more bar charts) - Auto-select interval: minute for ≤6h, hourly for ≤24h, daily for >24h
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.
Summary
agentledger exportCLI command andGET /api/dashboard/exportREST endpoint with--format csv/json,--last,--by, and--tenantfiltersGET/POST/DELETE /api/admin/api-keys/block), returns 403 for blocked keystenant_idfield; enforcement checks both per-key and per-tenant spend, stricter result wins/v1/responsesendpoint — request parsing (max_output_tokens), response parsing (input_tokens/output_tokens), andresponse.completedSSE stream eventsTest plan
go test -race ./...)golangci-lint run)agentledger export --format csv --last 24houtputs valid CSVcurl /api/dashboard/export?format=jsonreturns JSON arraydeploy/grafana/agentledger.jsoninto Grafana, verify panels load