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.

Hierarchy (view full)

  • Metric<string, string>
    • UrlMetric

Constructors

Properties

Methods

Constructors

Properties

inner: string

Methods

  • Validates that a given value is a valid URL metric value.

    1. The URL must be a string.
    2. The URL must not be a data URL.
    3. Every URL must start with a valid scheme.

    Note: We explicitly do not validate if the URL is fully spec compliant, the above validations are all that is done.

    Parameters

    • v: unknown

      The value to validate.

    Returns MetricValidationResult

    Whether or not v is a valid URL-like string.

  • Validates a given value using the validation function and throws in case it is not valid.

    Parameters

    • v: unknown

      The value to verify.

    Returns string

    v if it is valid.

Generated using TypeDoc