Skip to content

feat(memory): wire usage_events table from dispatcher#2431

Merged
alekspetrov merged 1 commit intomainfrom
pilot/GH-2429
Apr 27, 2026
Merged

feat(memory): wire usage_events table from dispatcher#2431
alekspetrov merged 1 commit intomainfrom
pilot/GH-2429

Conversation

@alekspetrov
Copy link
Copy Markdown
Collaborator

Summary

  • Dispatcher worker now calls RecordTaskUsage after SaveExecutionMetrics, emitting task + token + compute events into usage_events for every completed execution.
  • Adds UserID field to the Execution struct as the pivot for future multi-tenant cost rollups (empty in single-tenant deployments).

Closes GH-2429.

Test plan

  • go build ./...
  • go test ./internal/memory/... ./internal/executor/...
  • After deploy: run a task, then SELECT * FROM usage_events ORDER BY timestamp DESC LIMIT 5 — expect 3 rows per execution.

The usage_events table was provisioned and the metering writers were
implemented, but no production code emitted events — leaving the
billing/per-user-cost pipeline dead. The dispatcher worker now calls
RecordTaskUsage after persisting execution metrics so each completed
execution emits task + token + compute events.

Also adds a UserID field to Execution for future multi-tenant rollups;
empty in single-tenant deployments.
@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/executor/dispatcher.go 77.77% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@alekspetrov alekspetrov merged commit 216b9f2 into main Apr 27, 2026
4 checks passed
@alekspetrov alekspetrov deleted the pilot/GH-2429 branch April 27, 2026 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(memory): wire usage_events table — billing pipeline scaffolded but never called

2 participants