Go to console

Index

Methods

getAttribute

  • getAttribute(attr: string): string | undefined
  • Retrieves the value that the custom attribute is set to.

    Parameters

    • attr: string

      Name of the custom attribute.

    Returns string | undefined

getAttributes

  • getAttributes(): object
  • Returns a map of all custom attributes of a trace instance.

    Returns object

    • [key: string]: string

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 returns zero.

    Parameters

    • metricName: string

      Name of the custom metric.

    Returns number

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.

    Parameters

    • metricName: string

      The name of the custom metric.

    • Optional num: number

      The number to be added to the value of the custom metric. If not provided, it uses a default value of one.

    Returns void

putAttribute

  • putAttribute(attr: string, value: string): void
  • Set a custom attribute of a trace to a certain value.

    Parameters

    • attr: string

      Name of the custom attribute.

    • value: string

      Value of the custom attribute.

    Returns void

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.

    Parameters

    • metricName: string

      Name of the custom metric.

    • num: number

      Value to of the custom metric.

    Returns void

record

  • record(startTime: number, duration: number, options?: object)