usage

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package usage reports what a tenant consumed per calendar month (UTC). It shows quantities; prices come later.

Index

Constants

This section is empty.

Variables

View Source
var Units = map[string]string{
	"video_minutes_encoded":   "minutes",
	"video_minutes_stored":    "minutes",
	"video_delivery_bytes":    "bytes",
	"video_delivery_requests": "requests",
}

Units is each meter's unit. An application built on ulka-vms adds its own meters at start.

View Source
var Used = map[string]func(ctx context.Context, q core.TenantTx) (float64, error){

	"encode_minutes": func(ctx context.Context, q core.TenantTx) (float64, error) {
		return video.MinutesCommitted(ctx, q, pgtype.UUID{})
	},
}

Used counts what a workspace has of something its limits cap, by the name /v1/limits shows it under. An application built on ulka-vms adds its own at start.

Functions

func PeriodicJobs

func PeriodicJobs() []*river.PeriodicJob

func Routes

func Routes(mux *http.ServeMux, d *core.Deps)

func Workers

func Workers(w *river.Workers, d *core.Deps, clickhouseURL string)

Workers registers the log meter; clickhouseURL is where the rollups are.

Types

type LogMeterArgs

type LogMeterArgs struct{}

LogMeterArgs copies video delivered from the origin, counted from its access logs in ClickHouse, into each tenant's usage records.

func (LogMeterArgs) InsertOpts

func (LogMeterArgs) InsertOpts() river.InsertOpts

func (LogMeterArgs) Kind

func (LogMeterArgs) Kind() string

type StorageMeterArgs

type StorageMeterArgs struct{}

StorageMeterArgs records each tenant's stored video minutes for the current hour. Each hour's record is minutes ÷ hours in the month, so a month's total is the average minutes stored across it. ponytail: an hour no run lands in isn't billed; deleted videos leave no history to recompute it from.

func (StorageMeterArgs) InsertOpts

func (StorageMeterArgs) InsertOpts() river.InsertOpts

func (StorageMeterArgs) Kind

func (StorageMeterArgs) Kind() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL