Performance

Struct Performance 

Source
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

Source

pub fn app(&self) -> &FirebaseApp

Returns the FirebaseApp that owns this performance instance.

Source

pub fn settings(&self) -> PerformanceRuntimeSettings

Resolves the currently effective runtime settings.

Source

pub fn apply_settings(&self, settings: PerformanceSettings)

Applies the provided settings, overwriting only the Some fields.

Source

pub fn set_data_collection_enabled(&self, enabled: bool)

Enables or disables manual/custom trace collection.

Source

pub fn set_instrumentation_enabled(&self, enabled: bool)

Enables or disables automatic instrumentation (network/OOB traces).

Source

pub fn data_collection_enabled(&self) -> bool

Returns whether manual/custom traces are currently recorded.

Source

pub fn instrumentation_enabled(&self) -> bool

Returns whether automatic instrumentation (network/OOB) is enabled.

Source

pub fn attach_app_check(&self, app_check: FirebaseAppCheckInternal)

Associates an App Check instance whose tokens will be attached to outgoing network trace records.

Source

pub fn clear_app_check(&self)

Removes any App Check integration.

Source

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).

Source

pub fn set_authenticated_user_id(&self, uid: Option<&str>)

Manually overrides the authenticated user ID attribute that will be stored with subsequent traces.

Source

pub fn clear_auth(&self)

Clears any stored authentication context.

Source

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?;
Source

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?;
Source

pub async fn recorded_trace(&self, name: &str) -> Option<PerformanceTrace>

Returns the most recently recorded trace with the provided name.

Source

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.

Source

pub fn configure_transport(&self, options: TransportOptions)

Overrides the transport configuration used for batching uploads.

Source

pub async fn flush_transport(&self) -> PerformanceResult<()>

Forces an immediate transport flush.

Trait Implementations§

Source§

impl Clone for Performance

Source§

fn clone(&self) -> Performance

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Performance

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,