Interface MetricsUtil.MetricsContext (3.30.0)

public static interface MetricsUtil.MetricsContext

A context for recording metrics in the Firestore SDK.

Methods

<T>recordCounterAtFuture(TelemetryConstants.MetricType metric, ApiFuture<T> futureValue)

public abstract void <T>recordCounterAtFuture(TelemetryConstants.MetricType metric, ApiFuture<T> futureValue)

Records the counter value for a metric type after the future has been completed. This method "appends" the metrics recording code at the completion of the given future.

Parameters
Name Description
metric TelemetryConstants.MetricType
futureValue ApiFuture<T>

<T>recordLatencyAtFuture(TelemetryConstants.MetricType metric, ApiFuture<T> futureValue)

public abstract void <T>recordLatencyAtFuture(TelemetryConstants.MetricType metric, ApiFuture<T> futureValue)

If the operation ends in the future, its relevant metrics should be recorded after the future has been completed. This method "appends" the metrics recording code at the completion of the given future.

Parameters
Name Description
metric TelemetryConstants.MetricType
futureValue ApiFuture<T>

incrementCounter()

public abstract void incrementCounter()

Increments the counter tracked inside the MetricsContext.

recordLatency(TelemetryConstants.MetricType metric)

public abstract void recordLatency(TelemetryConstants.MetricType metric)

Records specific type of latency for the current operation.

Parameter
Name Description
metric TelemetryConstants.MetricType

recordLatency(TelemetryConstants.MetricType metric, Throwable t)

public abstract void recordLatency(TelemetryConstants.MetricType metric, Throwable t)

Records specific type of latency for the current operation, which ended with a throwable.

Parameters
Name Description
metric TelemetryConstants.MetricType
t Throwable