caffeine_lang/linker/measurements

Types

A Measurement provides a partial set of inputs to the SLO param schema and declares any additional params the bound Expectation must satisfy. The phantom type parameter state tracks whether the measurement is Raw or MeasurementValidated.

pub type Measurement(state) {
  Measurement(
    name: String,
    params: dict.Dict(String, types.AcceptedTypes),
    inputs: dict.Dict(String, value.Value),
    external_indicator_types: dict.Dict(
      String,
      types.AcceptedTypes,
    ),
    expectation_type: option.Option(ast.ExpectationType),
  )
}

Constructors

  • Measurement(
      name: String,
      params: dict.Dict(String, types.AcceptedTypes),
      inputs: dict.Dict(String, value.Value),
      external_indicator_types: dict.Dict(String, types.AcceptedTypes),
      expectation_type: option.Option(ast.ExpectationType),
    )

    Arguments

    external_indicator_types

    Resolved type constraints on value: extractions for any external indicators in this measurement’s Provides { indicators: { ... } } block. Keyed by indicator name (same key used in inputs.indicators). Empty when no external indicators have value extraction. Populated by lowering because the type info would otherwise have nowhere to live — value.Value can’t carry AcceptedTypes without a circular import (types.gleam imports value.gleam).

    expectation_type

    Optional declared SLO type from "name" success_rate: / "name" time_slice: header. When None, downstream consumers fall back to inferring the type from the formula shape at codegen.

Marker type for measurements that have passed validation.

pub type MeasurementValidated

Marker type for measurements that have not yet been validated.

pub type Raw
Search Document