258 lines · 6.3 KB
import { METER_PRICES } from "./pricing";

/** The meter catalog: every billable thing the platform records. Prices come from src/lib/pricing.ts. */
export type MeterKind = "counter" | "gauge";
export type MeterCategory = "storage" | "compute" | "network" | "ai" | "ops";

export type MeterDef = {
  id: string;
  label: string;
  category: MeterCategory;
  unit: "bytes" | "seconds" | "ms" | "count" | "tokens";
  kind: MeterKind;
  /** Price in micro-cents (1e-6 cent) per unit above the plan's included amount; 0 means free. */
  microCentsPerUnit: number;
};

export const METERS = [
  {
    id: "storage.artifacts",
    label: "Repository storage",
    category: "storage",
    unit: "bytes",
    kind: "gauge",
    microCentsPerUnit: METER_PRICES["storage.artifacts"],
  },
  {
    id: "storage.lfs",
    label: "LFS storage",
    category: "storage",
    unit: "bytes",
    kind: "gauge",
    microCentsPerUnit: METER_PRICES["storage.lfs"],
  },
  {
    id: "storage.ci_cache",
    label: "Actions cache",
    category: "storage",
    unit: "bytes",
    kind: "gauge",
    microCentsPerUnit: METER_PRICES["storage.ci_cache"],