Repository navigation
[Feature]: server-backed usage aggregation and permission-aware usage reporting #2308
Replies: 2 comments
|
OpenMAIC automated triage Feature request to make usage aggregation work across multiple application nodes and add permission-aware reporting. At this checkout (`ae5fd30`, which may differ from the reporter's version), `/api/usage` reads deployment-wide JSONL files without resolving an owner or checking the `admin` role, and usage rows contain no `node_id` or `user_id`; the dashboard appears in general user settings. Deployment documentation currently requires a shared data directory when several instances share a database. The proposal extends the earlier dashboard work rather than duplicating it, and no supplied open PR implements it. Maintainers need to decide the product, security, and storage design before implementation. Suggested next step: maintainer-review.
AI-generated assessment from the issue, discussion and source. No reproduction was executed; maintainers decide the next action. |
|
Thanks for the assessment. I’m willing to contribute an implementation and would like to confirm the intended design before starting. Our deployment has three application nodes sharing PostgreSQL and S3-compatible object storage for course files and media. Usage records, however, remain in separate node-local JSONL files, resulting in different totals depending on which node handles the dashboard request. I understand that the current deployment documentation requires a shared data directory. This proposal specifically aims to support consistent usage reporting without relying on shared log files; it does not assume that S3 replaces all shared-data-directory requirements. Would maintainers support the following approach? Permission-aware reporting: enforce authorization in /api/usage, using server-authenticated identity rather than client-supplied user IDs. Ordinary users could only access their own usage; administrators could view deployment-wide totals and filter by node or user. The dashboard would reflect those permissions. I would reuse existing authentication, owner-scoping, and role mechanisms where possible, keeping institution-specific SSO and role mapping outside the core implementation. Shared usage storage: extend the existing storage layer with PostgreSQL-backed usage records, including node_id and server-resolved user_id. Retain local JSONL logs for diagnostics and a documented local-storage fallback for deployments without PostgreSQL, while preserving existing usage categories and aggregation fields. Historical records without user identity would not be attributed to individual users or exposed as personal usage. The local-storage fallback would enforce the same authorization boundary, with its single-node reporting limitations documented. Database reporting would avoid double-counting records also retained in local logs. Is this direction acceptable? Are there existing storage or authorization interfaces I should extend? Would you prefer separate PRs for authorization and shared storage, or one coordinated change? I would also appreciate guidance on expectations for historical data migration and database-write failure handling. |
Uh oh!
There was an error while loading. Please reload this page.
Problem or Motivation
OpenMAIC currently records usage in node-local JSONL files and exposes a deployment-wide usage dashboard from
/api/usage.This works for a single-instance deployment, but it is incorrect for a multi-node deployment behind a load balancer. Each node reads only its own local usage files, so refreshing the dashboard can return different totals depending on which node handles the request.
The current dashboard also does not define an authorization boundary for deployment-wide usage. Ordinary users should not see aggregate usage for all users, while administrators may need global, per-node, and per-user reporting.
Proposed Solution
Provide a deployment-friendly usage storage and authorization seam:
node_id) with each usage record.user_id) when available.Acceptance Criteria
Alternatives Considered
Area
Deployment / infrastructure
Additional Context
The current usage dashboard was introduced by #784. Our deployment has three application nodes behind a load balancer, and each node currently maintains a different usage log.
The desired feature is a general multi-node and authorization capability. Institution-specific roles, SSO rules, and administrator definitions should remain deployment-specific.
All reactions