pub struct UsageObservation {
pub event_id: UsageEventId,
pub subject: BillingSubject,
pub meter_set: MeterSet,
pub model_ref: ModelRef,
pub provider_ref: Option<ProviderRef>,
pub source: UsageSource,
pub outcome: UsageOutcome,
pub timing: UsageTiming,
pub correlation: CorrelationIds,
pub attributes: Attributes,
}Expand description
Raw usage observation - an immutable fact.
This is the primary input to the billing system. Once created, observations should never be modified - only rated to produce derived records.
Fields§
§event_id: UsageEventIdUnique identifier for this observation (idempotency key).
subject: BillingSubjectWho is being billed for this usage.
meter_set: MeterSetThe actual meter readings (token counts, image counts, etc.).
model_ref: ModelRefWhich model/pricing dimension this observation applies to.
provider_ref: Option<ProviderRef>Which provider handled this request (if applicable).
source: UsageSourceWhere this observation came from (provider API response, stream accumulation, etc.).
outcome: UsageOutcomeThe final state of the request (success/error/timeout).
timing: UsageTimingTiming information for this observation.
correlation: CorrelationIdsCorrelation IDs for tracing across systems.
attributes: AttributesExtensible attributes: is_fallback, step_type, estimated_reason, etc.
Trait Implementations§
Source§impl Clone for UsageObservation
impl Clone for UsageObservation
Source§fn clone(&self) -> UsageObservation
fn clone(&self) -> UsageObservation
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for UsageObservation
impl Debug for UsageObservation
Source§impl<'de> Deserialize<'de> for UsageObservation
impl<'de> Deserialize<'de> for UsageObservation
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for UsageObservation
impl RefUnwindSafe for UsageObservation
impl Send for UsageObservation
impl Sync for UsageObservation
impl Unpin for UsageObservation
impl UnsafeUnpin for UsageObservation
impl UnwindSafe for UsageObservation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more