caffeine_lang/linker/ir
Types
Marker type for IRs with validated dependencies.
pub type DepsValidated
Resolved value-extraction spec on an ExternalSignal indicator. path is
the dotted path into the source event (e.g. “value” for a Langfuse score’s
numeric value); type_ is the resolved type constraint the extracted
value must satisfy.
pub type ExternalValueExtraction {
ExternalValueExtraction(
path: String,
type_: types.AcceptedTypes,
)
}
Constructors
-
ExternalValueExtraction(path: String, type_: types.AcceptedTypes)
An indicator’s source — either an inline query string (the existing form) or an external signal contract that the relay materializes into a metric the vendor codegen then queries.
LiteralQuery carries a query string (e.g. "sum:requests{...}") with
possible $$var$$ template variables; this is the pre-6.x shape.
ExternalSignal carries the routing info for a runtime relay (Langfuse
today). At codegen time the DD pipeline rewrites it into a LiteralQuery
referencing a synthesized metric name (caffeine.<measurement>.<indicator>),
and the relay codegen emits a matching entry in signals.json.
pub type IndicatorSource {
LiteralQuery(query: String)
ExternalSignal(
source: String,
match: dict.Dict(String, value.Value),
value_extraction: option.Option(ExternalValueExtraction),
)
}
Constructors
-
LiteralQuery(query: String) -
ExternalSignal( source: String, match: dict.Dict(String, value.Value), value_extraction: option.Option(ExternalValueExtraction), )
Internal representation of a parsed expectation with metadata and values.
The phantom type parameter phase tracks pipeline progress:
Linked: freshly built by the linkerDepsValidated: dependencies have been validatedResolved: 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
-
IntermediateRepresentation( metadata: IntermediateRepresentationMetaData, unique_identifier: String, values: List(helpers.ValueTuple), slo: SloFields, vendor: option.Option(vendor.Vendor), )
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
-
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)), )Arguments
- misc
-
Metadata specific to any given expectation.
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, IndicatorSource),
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, IndicatorSource), 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 ontime_slice-shaped SLOs; codegen errors if present on a metric SLO. - expectation_type
-
Declared SLO type from the measurement header (
success_rateortime_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.