pub struct Performance { /* private fields */ }Expand description
Firebase Performance Monitoring entry point tied to a FirebaseApp.
This struct intentionally mirrors the behaviour of the JS SDK’s
FirebasePerformance controller: it holds runtime toggles, orchestrates
trace/HTTP instrumentation, and can be retrieved via get_performance.
Implementations§
Source§impl Performance
impl Performance
Sourcepub fn app(&self) -> &FirebaseApp
pub fn app(&self) -> &FirebaseApp
Returns the FirebaseApp that owns this performance instance.
Sourcepub fn settings(&self) -> PerformanceRuntimeSettings
pub fn settings(&self) -> PerformanceRuntimeSettings
Resolves the currently effective runtime settings.
Sourcepub fn apply_settings(&self, settings: PerformanceSettings)
pub fn apply_settings(&self, settings: PerformanceSettings)
Applies the provided settings, overwriting only the Some fields.
Sourcepub fn set_data_collection_enabled(&self, enabled: bool)
pub fn set_data_collection_enabled(&self, enabled: bool)
Enables or disables manual/custom trace collection.
Sourcepub fn set_instrumentation_enabled(&self, enabled: bool)
pub fn set_instrumentation_enabled(&self, enabled: bool)
Enables or disables automatic instrumentation (network/OOB traces).
Sourcepub fn data_collection_enabled(&self) -> bool
pub fn data_collection_enabled(&self) -> bool
Returns whether manual/custom traces are currently recorded.
Sourcepub fn instrumentation_enabled(&self) -> bool
pub fn instrumentation_enabled(&self) -> bool
Returns whether automatic instrumentation (network/OOB) is enabled.
Sourcepub fn attach_app_check(&self, app_check: FirebaseAppCheckInternal)
pub fn attach_app_check(&self, app_check: FirebaseAppCheckInternal)
Associates an App Check instance whose tokens will be attached to outgoing network trace records.
Sourcepub fn clear_app_check(&self)
pub fn clear_app_check(&self)
Removes any App Check integration.
Sourcepub fn attach_auth(&self, auth: FirebaseAuth)
pub fn attach_auth(&self, auth: FirebaseAuth)
Associates a FirebaseAuth instance so recorded traces can capture
the active user ID (mirrors the JS SDK’s setUserId).
Sourcepub fn set_authenticated_user_id(&self, uid: Option<&str>)
pub fn set_authenticated_user_id(&self, uid: Option<&str>)
Manually overrides the authenticated user ID attribute that will be stored with subsequent traces.
Sourcepub fn clear_auth(&self)
pub fn clear_auth(&self)
Clears any stored authentication context.
Sourcepub fn new_trace(&self, name: &str) -> PerformanceResult<TraceHandle>
pub fn new_trace(&self, name: &str) -> PerformanceResult<TraceHandle>
Creates a new manual trace. Call TraceHandle::start /
stop to record the timing metrics.
§Examples
let perf = get_performance(Some(app)).await?;
let mut trace = perf.new_trace("warmup")?;
trace.start()?;
let _ = trace.stop().await?;Sourcepub fn new_network_request(
&self,
url: &str,
method: HttpMethod,
) -> PerformanceResult<NetworkTraceHandle>
pub fn new_network_request( &self, url: &str, method: HttpMethod, ) -> PerformanceResult<NetworkTraceHandle>
Creates a manual network trace, mirroring the JS SDK’s
performance.traceNetworkRequest helper.
§Examples
let perf = get_performance(Some(app)).await?;
let mut req = perf.new_network_request("https://example.com", HttpMethod::Get)?;
req.start()?;
let _record = req.stop().await?;Sourcepub async fn recorded_trace(&self, name: &str) -> Option<PerformanceTrace>
pub async fn recorded_trace(&self, name: &str) -> Option<PerformanceTrace>
Returns the most recently recorded trace with the provided name.
Sourcepub async fn recorded_network_request(
&self,
url: &str,
) -> Option<NetworkRequestRecord>
pub async fn recorded_network_request( &self, url: &str, ) -> Option<NetworkRequestRecord>
Returns the latest network trace captured for the given URL (without query parameters), if any.
Sourcepub fn configure_transport(&self, options: TransportOptions)
pub fn configure_transport(&self, options: TransportOptions)
Overrides the transport configuration used for batching uploads.
Sourcepub async fn flush_transport(&self) -> PerformanceResult<()>
pub async fn flush_transport(&self) -> PerformanceResult<()>
Forces an immediate transport flush.
Trait Implementations§
Source§impl Clone for Performance
impl Clone for Performance
Source§fn clone(&self) -> Performance
fn clone(&self) -> Performance
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more