metrics

package
v1.801.113 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package metrics is the fleet SaaS-operations god-view (/v1/admin/metrics) — the operator's business dashboard: MRR/ARR, net-new vs churned MRR, the plan/category mix, the top customers, and the recent subscription movements. SuperAdmin only (core.Guard).

It OWNS no aggregation. The whole snapshot is computed IN commerce (the system of record for subscriptions + the usage ledger) by its cross-org SaaS-metrics engine (GET /v1/metrics/saas), which admin PROXIES with the SAME admin-scoped S2S service token finance uses for COGS. The engine is ALREADY fleet-wide — it walks every org namespace itself — so this is a SINGLE upstream read, no per-org fan-out, exactly as finance consumes commerce Costs. An unwired or unreachable commerce degrades to an honest empty snapshot (real zeros, `[]` not null) with a not-ok source, never a fabricated number.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Metrics

func Metrics(s *cloud.Service[core.State], c *zip.Ctx) error

Metrics answers GET /v1/admin/metrics by proxying the commerce SaaS-metrics engine (already a fleet-wide cross-org aggregate). SuperAdmin only.

GET /v1/admin/metrics?window=30d&limit=20

func Routes

func Routes(app *zip.App, s *cloud.Service[core.State])

Routes registers the SaaS-metrics god-view (SuperAdmin only, cross-tenant business aggregate).

Types

type MetricsData

type MetricsData struct {
	commerce.SaaSMetrics
	GeneratedAt string              `json:"generatedAt"`
	Sources     []core.SourceStatus `json:"sources"`
}

MetricsData is the GET /v1/admin/metrics payload: the commerce SaaS snapshot, flat, plus the admin read time and the upstream freshness strip every god-view carries.

Jump to

Keyboard shortcuts

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