Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Metric<InternalRepresentation, PayloadRepresentation>

The Metric class describes the shared behaviour amongst concrete metrics.

A concrete metric will always have two possible representations:

  • InternalRepresentation
    • Is the format in which this metric will be stored in memory.
    • This format may contain extra metadata, in order to allow deserializing of this data for testing purposes.
  • PayloadRepresentation
    • Is the format in which this metric will be represented in the ping payload.
    • This format must be the exact same as described in the Glean schema.

Type parameters

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor

  • new Metric<InternalRepresentation, PayloadRepresentation>(v: unknown): Metric<InternalRepresentation, PayloadRepresentation>

Properties

Protected _inner

_inner: InternalRepresentation

Methods

get

  • get(): InternalRepresentation
  • Gets this metrics value in its internal representation.

    Returns InternalRepresentation

    The metric value.

Abstract payload

  • payload(): PayloadRepresentation
  • Gets this metrics value in its payload representation.

    Returns PayloadRepresentation

    The metric value.

set

  • set(v: unknown): void
  • Sets this metrics value.

    throws

    In case the metric is not in the expected format.

    Parameters

    • v: unknown

      The value to set, must be in the exact internal representation of this metric.

    Returns void

Abstract validate

  • validate(v: unknown): v is InternalRepresentation
  • Validates that a given value is in the correct format for this metrics internal representation.

    Parameters

    • v: unknown

      The value to verify.

    Returns v is InternalRepresentation

    A special Typescript value (which compiles down to a boolean) stating whether v is of the correct type.

Generated using TypeDoc