pub struct AuditConfig {Show 14 fields
pub enabled: bool,
pub record_attempts: bool,
pub record_retries: bool,
pub record_success: bool,
pub record_failure: bool,
pub record_cancellation: bool,
pub record_timing: bool,
pub record_normalization: bool,
pub include_profile: bool,
pub include_sdk_request_id: bool,
pub include_provider_request_id: bool,
pub include_session_id: bool,
pub include_usage: bool,
pub sample_every: u64,
}Expand description
Controls which structured transport events are emitted.
Audit events never contain prompts, messages, reasoning, tool arguments, tool results, request bodies, or response bodies. Correlation identifiers and profile metadata require explicit opt-in.
Fields§
§enabled: boolMaster switch: when false, no audit events are emitted.
record_attempts: bool§record_retries: boolEmit retry and stream-reconnect scheduling events.
record_success: boolEmit success outcomes for attempts and requests.
record_failure: boolEmit failure outcomes for attempts and requests.
record_cancellation: boolEmit a final AuditEvent::RequestFinished with outcome
AuditOutcome::Cancelled when a stream is dropped before completion.
record_timing: boolEmit response-header and first-token timing events.
record_normalization: boolEmit context-free aggregate counts for normalization repairs.
include_profile: boolInclude the profile snapshot in AuditEvent::RequestStarted.
include_sdk_request_id: boolInclude the caller-supplied SDK request id in
AuditEvent::RequestStarted.
include_provider_request_id: boolInclude the provider’s request id in header, attempt, and completion events.
include_session_id: boolInclude the session id in AuditEvent::RequestStarted. Off by
default because session ids can be tenant-sensitive.
include_usage: boolInclude token usage in AuditEvent::RequestFinished.
sample_every: u64Sample one out of every N logical requests. 1 records every request.
Implementations§
Source§impl AuditConfig
impl AuditConfig
Sourcepub fn record_attempts(self, enabled: bool) -> Self
pub fn record_attempts(self, enabled: bool) -> Self
Sets whether attempt-level events are emitted.
Sourcepub fn record_retries(self, enabled: bool) -> Self
pub fn record_retries(self, enabled: bool) -> Self
Sets whether retry and reconnect scheduling events are emitted.
Sourcepub fn record_success(self, enabled: bool) -> Self
pub fn record_success(self, enabled: bool) -> Self
Sets whether success outcomes are emitted.
Sourcepub fn record_failure(self, enabled: bool) -> Self
pub fn record_failure(self, enabled: bool) -> Self
Sets whether failure outcomes are emitted.
Sourcepub fn record_cancellation(self, enabled: bool) -> Self
pub fn record_cancellation(self, enabled: bool) -> Self
Emit a final event when a stream is dropped before terminal completion.
Sourcepub fn record_timing(self, enabled: bool) -> Self
pub fn record_timing(self, enabled: bool) -> Self
Emit response-header and first-token timing events.
Sourcepub fn record_normalization(self, enabled: bool) -> Self
pub fn record_normalization(self, enabled: bool) -> Self
Emit context-free aggregate counts for normalization repairs.
Sourcepub fn include_profile(self, enabled: bool) -> Self
pub fn include_profile(self, enabled: bool) -> Self
Include the selected profile id, model-profile flag, and capability
snapshot in RequestStarted.
Sourcepub fn include_sdk_request_id(self, enabled: bool) -> Self
pub fn include_sdk_request_id(self, enabled: bool) -> Self
Sets whether the SDK request id is included in
AuditEvent::RequestStarted.
Sourcepub fn include_provider_request_id(self, enabled: bool) -> Self
pub fn include_provider_request_id(self, enabled: bool) -> Self
Sets whether the provider request id is included in events.
Sourcepub fn include_session_id(self, enabled: bool) -> Self
pub fn include_session_id(self, enabled: bool) -> Self
Session IDs can be tenant-sensitive. They are excluded by default.
Sourcepub fn include_usage(self, enabled: bool) -> Self
pub fn include_usage(self, enabled: bool) -> Self
Sets whether token usage is included in
AuditEvent::RequestFinished.
Sourcepub fn sample_every(self, sample_every: u64) -> Self
pub fn sample_every(self, sample_every: u64) -> Self
Sets the sampling rate; values below 1 are clamped to 1.
Trait Implementations§
Source§impl Clone for AuditConfig
impl Clone for AuditConfig
impl Copy for AuditConfig
Source§impl Debug for AuditConfig
impl Debug for AuditConfig
Source§impl Default for AuditConfig
impl Default for AuditConfig
impl Eq for AuditConfig
Source§impl PartialEq for AuditConfig
impl PartialEq for AuditConfig
impl StructuralPartialEq for AuditConfig
Auto Trait Implementations§
impl Freeze for AuditConfig
impl RefUnwindSafe for AuditConfig
impl Send for AuditConfig
impl Sync for AuditConfig
impl Unpin for AuditConfig
impl UnsafeUnpin for AuditConfig
impl UnwindSafe for AuditConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.