Interface MetricsRecorder (2.36.0)

public interface MetricsRecorder

Interface to record specific metric operations.

Warning: This is intended to be an internal API and is not intended for external use. This is public solely for implementation purposes and does not promise any backwards compatibility.

Static Methods

getInstance(DatastoreOpenTelemetryOptions options)

public static MetricsRecorder getInstance(DatastoreOpenTelemetryOptions options)

Returns a MetricsRecorder instance based on the provided OpenTelemetry options.

Parameter
Name Description
options DatastoreOpenTelemetryOptions

The com.google.cloud.datastore.DatastoreOpenTelemetryOptions configuring telemetry.

Returns
Type Description
MetricsRecorder

An OpenTelemetryMetricsRecorder if metrics are enabled, otherwise a NoOpMetricsRecorder.

Methods

recordTransactionAttemptCount(long count, Map<String,String> attributes)

public abstract void recordTransactionAttemptCount(long count, Map<String,String> attributes)

Records the number of attempts a transaction took.

Parameters
Name Description
count long
attributes Map<String,String>

recordTransactionLatency(double latencyMs, Map<String,String> attributes)

public abstract void recordTransactionLatency(double latencyMs, Map<String,String> attributes)

Records the total latency of a transaction in milliseconds.

Parameters
Name Description
latencyMs double
attributes Map<String,String>