Creates a HttpMetric instance for collecting network performance data for a single request/response
const metric = firebase.perf().newHttpMetric('https://api.com/user/1', 'GET');
await metric.start();
A valid url String, cannot be empty
One of the values GET, PUT, POST, DELETE, HEAD, PATCH, OPTIONS, TRACE, or CONNECT
Creates a ScreenTrace instance with the given identifier. Throws if hardware acceleration is disabled or if Android is 9.0 or 9.1.
try {
const trace = firebase.perf().newScreenTrace('FooScreen');
await trace.start();
} catch (e) {
}
Name of the trace, no leading or trailing whitespace allowed, no leading underscore '_' character allowed, max length is 100.
Creates a Trace instance with the given identifier.
const trace = firebase.perf().newTrace('user_profile');
await trace.start();
Name of the trace, no leading or trailing whitespace allowed, no leading underscore '_' character allowed, max length is 100.
Enables or disables performance monitoring.
// Disable performance monitoring collection
await firebase.perf().setPerformanceCollectionEnabled(false);
Should performance monitoring be enabled. For iOS only, this also toggles whether instrumentation is enabled. See: https://firebase.google.com/docs/reference/ios/firebaseperformance/api/reference/Classes/FIRPerformance#instrumentationenabled
Creates a ScreenTrace instance with the given identifier and immediately starts it. Throws if hardware acceleration is disabled or if Android is 9.0 or 9.1.
try {
const trace = await firebase.perf().startScreenTrace('FooScreen');
await trace.stop();
} catch (e) {
}
Name of the screen
Creates a Trace instance with the given identifier and immediately starts it.
const trace = await firebase.perf().startTrace('user_profile');
Name of the trace, no leading or trailing whitespace allowed, no leading underscore '_' character allowed, max length is 100.
The current FirebaseApp instance for this Firebase service.
Determines whether to collect 'out of the box' (i.e already setup for Firebase Performance) events. This can be set for iOS. Android will always return "true" as it has to be set at gradle level.
The Firebase Performance Monitoring service interface.
Example
Get the Performance Monitoring service for the default app: