@firebase/performance-types

  • Version 0.2.0
  • Published
  • 5.36 kB
  • No dependencies
  • Apache-2.0 license

Install

npm i @firebase/performance-types
yarn add @firebase/performance-types
pnpm add @firebase/performance-types

Overview

@firebase/performance Types

Index

Interfaces

interface FirebasePerformance

interface FirebasePerformance {}
  • Copyright 2017 Google LLC

    Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

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.

method trace

trace: (traceName: string) => PerformanceTrace;
  • Creates an uninitialized instance of trace and returns it.

    Parameter traceName

    The name of trace instance. The trace instance.

interface PerformanceTrace

interface PerformanceTrace {}

    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 duraction 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 (1)

    Dependencies (0)

    No dependencies.

    Dev Dependencies (1)

    Peer Dependencies (0)

    No peer dependencies.

    Badge

    To add a badge like this onejsDocs.io badgeto 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-types.

    • Markdown
      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@firebase/performance-types)
    • HTML
      <a href="https://www.jsdocs.io/package/@firebase/performance-types"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>