Skip to content

Create usage-based billing package #814

@deansheather

Description

@deansheather

Part of phase 1 of Usage-based Billing RFC

We will add a new package called usage which contains all of the storage and publishing code for usage events.

  • Enterprise licensed code, using a collector interface defined in AGPL + a no-op stub
    type EventType string // enum
    type UsageEvent interface {
      usageEvent() // to enforce they must come from this package
      EventType() EventType
    }
    type UsageCollector interface {
      RecordUsage(ctx context.Context, event Event) error
    }
  • Adds a new usage_events table as per the RFC
  • All of the event structs must be versioned
  • CODEOWNERS should include @deansheather to prevent people from changing the structs unintentionally
  • Publishes to Tallyman with a goroutine as outlined in the RFC
    • Only if the deployment has any license with publish_usage_data=true
  • Generate an initial dc_ai_workspaces_v1_genesis event with existing data ONCE
  • Add code to the provisionerd server to record an event when new has_ai_task workspaces are built
  • Change the managed agent count function to count events from the new table rather than from the workspace_builds table

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions