OSS-first docs
These docs teach the open system first: contracts, generated surfaces, runtimes, governance, and incremental adoption. Studio shows up as the operating layer on top, not as the source of truth.
Define a new usage metric.
Goal
Create a new metric for tracking usage.
Context
Called when setting up metering.
Source Definition
import { defineCommand, defineQuery } from '@lssm-tech/lib.contracts-spec';
import { defineSchemaModel, ScalarTypeEnum } from '@lssm-tech/lib.schema';
export const DefineMetricContract = defineCommand({
meta: {
key: 'metric.define',
version: '1.0.0',
stability: 'stable',
owners: ['platform.metering'],
tags: ['metering', 'metric', 'define'],
description: 'Define a new usage metric.',
goal: 'Create a new metric for tracking usage.',
context: 'Called when setting up metering.',
},
io: {
input: DefineMetricInput,
output: MetricDefinitionModel,
errors: {
METRIC_KEY_EXISTS: {
description: 'Metric key already exists',
http: 409,
gqlCode: 'METRIC_KEY_EXISTS',
when: 'A metric with this key already exists',
},
},
},
policy: {
auth: 'admin',
},
});