Options
All
  • Public
  • Public/Protected
  • All
Menu

A string list metric.

This allows appending a string value with arbitrary content to a list. The list is length-limited to MAX_LIST_LENGTH. Strings are length-limited to MAX_STRING_LENGTH characters.

Hierarchy

Index

Constructors

constructor

Properties

Readonly category

category: string

Readonly disabled

disabled: boolean

Optional dynamicLabel

dynamicLabel?: string

Readonly lifetime

lifetime: Lifetime

Readonly name

name: string

Readonly sendInPings

sendInPings: string[]

Readonly type

type: string

Methods

add

  • add(value: string): void
  • Adds a new string value to the list.

    Note

    • If the list is already of length MAX_LIST_LENGTH, record an error.
    • Truncates the value if it is longer than MAX_STRING_LENGTH characters and records an error.

    Parameters

    • value: string

      The string to add.

    Returns void

baseIdentifier

  • baseIdentifier(): string
  • The metric's base identifier, including the category and name, but not the label.

    Returns string

    The generated identifier. If category is empty, it's ommitted. Otherwise, it's the combination of the metric's category and name.

identifier

  • identifier(): Promise<string>
  • The metric's unique identifier, including the category, name and label.

    Returns Promise<string>

    The generated identifier. If category is empty, it's ommitted. Otherwise, it's the combination of the metric's category, name and label.

set

  • set(value: string[]): void
  • Sets to the specified string list value.

    Note

    Truncates the list if it is longer than MAX_LIST_LENGTH and records an error.

    Truncates the value if it is longer than MAX_STRING_LENGTH characters and records an error.

    Parameters

    • value: string[]

      The list of strings to set the metric to.

    Returns void

shouldRecord

  • shouldRecord(uploadEnabled: boolean): boolean
  • Verify whether or not this metric instance should be recorded.

    Parameters

    • uploadEnabled: boolean

      Whether or not global upload is enabled or disabled.

    Returns boolean

    Whether or not this metric instance should be recorded.

testGetNumRecordedErrors

  • testGetNumRecordedErrors(errorType: string, ping?: string): Promise<number>
  • Returns the number of errors recorded for the given metric.

    Parameters

    • errorType: string

      The type of the error recorded.

    • ping: string = ...

      represents the name of the ping to retrieve the metric for. Defaults to the first value in sendInPings.

    Returns Promise<number>

    the number of errors recorded for the metric.

testGetValue

  • testGetValue(ping?: string): Promise<undefined | string[]>
  • Test-only API**

    Gets the currently stored value as a string array.

    This doesn't clear the stored value.

    Parameters

    • ping: string = ...

      the ping from which we want to retrieve this metrics value from. Defaults to the first value in sendInPings.

    Returns Promise<undefined | string[]>

    The value found in storage or undefined if nothing was found.

Generated using TypeDoc