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.

metric.define

Define a new usage metric.

  • Type: operation (command)
  • Version: 1.0.0
  • Stability: stable
  • Owners: platform.metering
  • Tags: metering, metric, define
  • File: packages/libs/metering/src/contracts/index.ts
  • field.key.label
    metric.define
    field.version.label
    1.0.0
    field.type.label
    operation (command)
    field.title.label
    metric.define
    field.description.label

    Define a new usage metric.

  • Type: operation (command)
  • Version: 1.0.0
  • Stability: stable
  • Owners: platform.metering
  • Tags: metering, metric, define
  • File: packages/libs/metering/src/contracts/index.ts
  • field.tags.label
    metering,metric,define
    field.owners.label
    platform.metering
    field.stability.label
    stable

    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',
    	},
    });