caffeine_lang/linker/ir

Types

Marker type for IRs with validated dependencies.

pub type DepsValidated

Internal representation of a parsed expectation with metadata and values. The phantom type parameter phase tracks pipeline progress:

  • Linked: freshly built by the linker
  • DepsValidated: dependencies have been validated
  • Resolved: indicators have been resolved by semantic analysis
pub type IntermediateRepresentation(phase) {
  IntermediateRepresentation(
    metadata: IntermediateRepresentationMetaData,
    unique_identifier: String,
    values: List(helpers.ValueTuple),
    slo: SloFields,
    vendor: option.Option(vendor.Vendor),
  )
}

Constructors

Metadata associated with an intermediate representation including organization and service identifiers. Fields use newtype wrappers to prevent accidental mixing of identifier kinds.

pub type IntermediateRepresentationMetaData {
  IntermediateRepresentationMetaData(
    friendly_label: identifiers.ExpectationLabel,
    org_name: identifiers.OrgName,
    service_name: identifiers.ServiceName,
    measurement_name: identifiers.MeasurementName,
    team_name: identifiers.TeamName,
    misc: dict.Dict(String, List(String)),
  )
}

Constructors

Marker type for IRs freshly built by the linker.

pub type Linked

Marker type for IRs with resolved indicators.

pub type Resolved

Structured SLO artifact fields extracted from raw values.

description is the SLO description text (sourced from ### doc comments preceding the expectation in the source file). Datadog codegen renders it into the description attribute, optionally combined with the runbook link.

pub type SloFields {
  SloFields(
    threshold: Float,
    indicators: dict.Dict(String, String),
    window_in_days: Int,
    evaluation: option.Option(String),
    tags: List(#(String, String)),
    runbook: option.Option(String),
    depends_on: option.Option(
      dict.Dict(dependency.DependencyRelationType, List(String)),
    ),
    description: option.Option(String),
    below_ms: option.Option(Float),
    expectation_type: option.Option(ast.ExpectationType),
  )
}

Constructors

  • SloFields(
      threshold: Float,
      indicators: dict.Dict(String, String),
      window_in_days: Int,
      evaluation: option.Option(String),
      tags: List(#(String, String)),
      runbook: option.Option(String),
      depends_on: option.Option(
        dict.Dict(dependency.DependencyRelationType, List(String)),
      ),
      description: option.Option(String),
      below_ms: option.Option(Float),
      expectation_type: option.Option(ast.ExpectationType),
    )

    Arguments

    below_ms

    Latency threshold in milliseconds, sourced from a Guarantees N% below <duration> clause. Valid only on time_slice-shaped SLOs; codegen errors if present on a metric SLO.

    expectation_type

    Declared SLO type from the measurement header (success_rate or time_slice). None when the measurement uses the legacy untyped header — semantic checks that need the type (E10 alignment, F13 latency monotonicity) skip pairs where either side is None.

Search Document