pub enum ForwardEvent {
RequestStarted {
meta: EventMeta,
request_id: String,
endpoint: String,
model: String,
is_stream: bool,
},
RequestCompleted {
meta: EventMeta,
request_id: String,
status_code: u16,
status: ForwardStatus,
usage: Option<TokenUsage>,
latency_ms: u64,
error: Option<String>,
},
}Expand description
Events emitted when forwarding requests to upstream APIs.
These events track HTTP proxy operations when the system forwards requests to external API providers like OpenAI, Anthropic, or other LLM services. They enable monitoring of API usage, costs, and performance.
§Event Lifecycle
A typical forward operation produces events in this order:
RequestStarted- When a request is initiated to the upstream APIRequestCompleted- When the response is received (or an error occurs)
§Use Cases
These events support:
- API cost tracking via token consumption
- Performance monitoring (latency, success rates)
- Error rate analysis per endpoint
- Load balancing and capacity planning
- Compliance and audit logging
Variants§
RequestStarted
Emitted when a request is initiated to an upstream API.
This marks the beginning of a forwarded HTTP request to an external service provider.
Fields
RequestCompleted
Emitted when a forwarded request completes or fails.
Contains comprehensive information about the request outcome, including HTTP status, token usage, latency, and any errors.
Fields
status: ForwardStatusStatus classification (success, error, or timeout)
usage: Option<TokenUsage>Token usage if available from the API response
Trait Implementations§
Source§impl Clone for ForwardEvent
impl Clone for ForwardEvent
Source§fn clone(&self) -> ForwardEvent
fn clone(&self) -> ForwardEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more