@firebase/performance
- Version 0.6.11
- Published
- 425 kB
- 5 dependencies
- Apache-2.0 license
Install
npm i @firebase/performance
yarn add @firebase/performance
pnpm add @firebase/performance
Overview
The Firebase Performance Monitoring Web SDK. This SDK does not work in a Node.js environment.
Index
Functions
Interfaces
Functions
function getPerformance
getPerformance: (app?: FirebaseApp) => FirebasePerformance;
Returns a FirebasePerformance instance for the given app.
Parameter app
The @firebase/app#FirebaseApp to use.
Modifiers
@public
function initializePerformance
initializePerformance: ( app: FirebaseApp, settings?: PerformanceSettings) => FirebasePerformance;
Returns a FirebasePerformance instance for the given app. Can only be called once.
Parameter app
The @firebase/app#FirebaseApp to use.
Parameter settings
Optional settings for the FirebasePerformance instance.
Modifiers
@public
function trace
trace: (performance: FirebasePerformance, name: string) => PerformanceTrace;
Returns a new
PerformanceTrace
instance.Parameter performance
The FirebasePerformance instance to use.
Parameter name
The name of the trace.
Modifiers
@public
Interfaces
interface FirebasePerformance
interface FirebasePerformance {}
The Firebase Performance Monitoring service interface.
Modifiers
@public
property app
app: FirebaseApp;
The @firebase/app#FirebaseApp this
FirebasePerformance
instance is associated with.
property dataCollectionEnabled
dataCollectionEnabled: boolean;
Controls the logging of custom traces.
property instrumentationEnabled
instrumentationEnabled: boolean;
Controls the logging of automatic traces and HTTP/S network monitoring.
interface PerformanceSettings
interface PerformanceSettings {}
Defines configuration options for the Performance Monitoring SDK.
Modifiers
@public
property dataCollectionEnabled
dataCollectionEnabled?: boolean;
Whether to collect custom events.
property instrumentationEnabled
instrumentationEnabled?: boolean;
Whether to collect out of the box events.
interface PerformanceTrace
interface PerformanceTrace {}
The interface representing a
Trace
.Modifiers
@public
method getAttribute
getAttribute: (attr: string) => string | undefined;
Retrieves the value which a custom attribute is set to.
Parameter attr
Name of the custom attribute.
method getAttributes
getAttributes: () => { [key: string]: string };
Returns a map of all custom attributes of a trace instance.
method getMetric
getMetric: (metricName: string) => number;
Returns the value of the custom metric by that name. If a custom metric with that name does not exist will return zero.
Parameter metricName
Name of the custom metric.
method incrementMetric
incrementMetric: (metricName: string, num?: number) => void;
Adds to the value of a custom metric. If a custom metric with the provided name does not exist, it creates one with that name and the value equal to the given number. The value will be floored down to an integer.
Parameter metricName
The name of the custom metric.
Parameter num
The number to be added to the value of the custom metric. If not provided, it uses a default value of one.
method putAttribute
putAttribute: (attr: string, value: string) => void;
Set a custom attribute of a trace to a certain value.
Parameter attr
Name of the custom attribute.
Parameter value
Value of the custom attribute.
method putMetric
putMetric: (metricName: string, num: number) => void;
Sets the value of the specified custom metric to the given number regardless of whether a metric with that name already exists on the trace instance or not. The value will be floored down to an integer.
Parameter metricName
Name of the custom metric.
Parameter num
Value to of the custom metric.
method record
record: ( startTime: number, duration: number, options?: { metrics?: { [key: string]: number }; attributes?: { [key: string]: string }; }) => void;
Records a trace from given parameters. This provides a direct way to use trace without a need to start/stop. This is useful for use cases in which the trace cannot directly be used (e.g. if the duration was captured before the Performance SDK was loaded).
Parameter startTime
trace start time since epoch in millisec.
Parameter duration
The duration of the trace in millisec.
Parameter options
An object which can optionally hold maps of custom metrics and custom attributes.
method removeAttribute
removeAttribute: (attr: string) => void;
Removes the specified custom attribute from a trace instance.
Parameter attr
Name of the custom attribute.
method start
start: () => void;
Starts the timing for the trace instance.
method stop
stop: () => void;
Stops the timing of the trace instance and logs the data of the instance.
Package Files (2)
Dependencies (5)
Dev Dependencies (5)
Peer Dependencies (1)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@firebase/performance
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@firebase/performance)
- HTML<a href="https://www.jsdocs.io/package/@firebase/performance"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 1853 ms. - Missing or incorrect documentation? Open an issue for this package.