Class: MetricHelper
Helper class for performing common metric operations, swallowing any errors from the telemetry component.
Constructors
Constructor
new MetricHelper():
MetricHelper
Returns
MetricHelper
Methods
createMetrics()
staticcreateMetrics(telemetryComponent,metrics):Promise<void>
Create multiple metrics if they don't already exist, swallowing any already exists errors.
Parameters
telemetryComponent
ITelemetryComponent | undefined
The telemetry component to use for creating the metrics.
metrics
The telemetry metrics to create.
Returns
Promise<void>
A promise that resolves when all metrics have been created or confirmed to exist.
createMetric()
staticcreateMetric(telemetryComponent,metric):Promise<void>
Create a metric if it doesn't already exist, swallowing any already exists errors.
Parameters
telemetryComponent
ITelemetryComponent | undefined
The telemetry component to use for creating the metric.
metric
The telemetry metric to create.
Returns
Promise<void>
A promise that resolves when the metric has been created or confirmed to exist.
metricIncrement()
staticmetricIncrement(telemetryComponent,id,customData?):Promise<void>
Increment a metric counter, swallowing any telemetry errors.
Parameters
telemetryComponent
ITelemetryComponent | undefined
The telemetry component to use for incrementing the metric.
id
string
The metric ID.
customData?
Optional custom data for the increment.
Returns
Promise<void>
A promise that resolves when the increment has been recorded or the error swallowed.
metricDecrement()
staticmetricDecrement(telemetryComponent,id,customData?):Promise<void>
Decrement a metric counter, swallowing any telemetry errors.
Parameters
telemetryComponent
ITelemetryComponent | undefined
The telemetry component to use for decrementing the metric.
id
string
The metric ID.
customData?
Optional custom data for the decrement.
Returns
Promise<void>
A promise that resolves when the decrement has been recorded or the error swallowed.
metricValue()
staticmetricValue(telemetryComponent,id,value,customData?):Promise<void>
Set a metric value, swallowing any telemetry errors.
Parameters
telemetryComponent
ITelemetryComponent | undefined
The telemetry component to use for setting the metric value.
id
string
The metric ID.
value
number
The metric value to set.
customData?
Optional custom data for setting the value.
Returns
Promise<void>
A promise that resolves when the value has been recorded or the error swallowed.