Documentation
¶
Overview ¶
Package normalize maps provider-family fields onto neutral V2 metering measures. It contains no provider-name branches and performs no pricing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidMapping = errors.New("metering/normalize: invalid provider mapping") ErrInvalidField = errors.New("metering/normalize: invalid provider field") )
Functions ¶
This section is empty.
Types ¶
type Field ¶
Field is one bounded provider source field. Lexeme is retained exactly and parsed without floating point; absent fields never become zero values.
type FieldSpec ¶
type FieldSpec struct {
Name string
EvidencePath string
Key metering.ComponentKey
Required bool
NotApplicable bool
}
FieldSpec binds one provider field to a neutral key. Name is the source field identity used for lookup; EvidencePath is the bounded safe location retained when the field maps to a V2 observation.
type Input ¶
Input is the pure normalizer input. No request body or provider SDK value is retained; only bounded field identity and economic lexemes are accepted.
type InputMode ¶
type InputMode string
InputMode declares whether a provider's input field is an inclusive total or an already-separated uncached component.
type Mapping ¶
type Mapping struct {
ID string
Family string
Version string
InputMode InputMode
InputTotal FieldSpec
InputUncached FieldSpec
CacheRead []FieldSpec
CacheWrite []FieldSpec
Output FieldSpec
Reasoning FieldSpec
ReasoningMode ReasoningMode
}
Mapping is a versioned provider-family mapping. The mapping is data, not a provider switch in generic metering code.
type OriginalField ¶
OriginalField is source-qualified evidence retained independently of the normalized measures. It preserves the provider field name and exact lexeme.
type ReasoningMode ¶
type ReasoningMode string
ReasoningMode declares whether reasoning is already contained by the output meter or is an explicitly disjoint output partition.
const ( ReasoningIncluded ReasoningMode = "included_in_output" ReasoningDisjoint ReasoningMode = "disjoint_output_partition" )
type Result ¶
type Result struct {
MappingRef string
Status Status
Measures []metering.Measure
Informational []metering.Measure
OriginalFields []OriginalField
Evidence []metering.SafeEvidenceField
Diagnostics []string
}
Result contains disjoint chargeable measures, informational aggregates and source evidence. No monetary amount is calculated here.
func Normalize ¶
Normalize converts provider fields according to a versioned mapping. It returns partial/conflict status for unknown or inconsistent partitions while returning an error only for malformed bounded input or mapping contracts.
func (Result) Attach ¶
func (r Result) Attach(base metering.Observation) (metering.Observation, error)
Attach adds normalized measures/evidence to a caller-supplied V2 envelope. Caller-owned identity, subject and source fields remain authoritative.