Package com.google.api.gax.tracing
Class OpenTelemetryMetricsRecorder
java.lang.Object
com.google.api.gax.tracing.OpenTelemetryMetricsRecorder
- All Implemented Interfaces:
MetricsRecorder
@BetaApi
@InternalApi
public class OpenTelemetryMetricsRecorder
extends Object
implements MetricsRecorder
OpenTelemetry implementation of recording metrics. This implementation collections the
measurements related to the lifecyle of an RPC.
For the Otel implementation, an attempt is a single RPC invocation and an operation is the collection of all the attempts made before a response is returned (either as a success or an error). A single call (i.e. `EchoClient.echo()`) should have an operation_count of 1 and may have an attempt_count of 1+ (depending on the retry configurations).
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionOpenTelemetryMetricsRecorder(io.opentelemetry.api.OpenTelemetry openTelemetry, String serviceName) Creates the following instruments for the following metrics: Attempt Latency: Histogram Operation Latency: Histogram Attempt Count: Counter Operation Count: Counter -
Method Summary
Modifier and TypeMethodDescriptionvoidrecordAttemptCount(long count, Map<String, String> attributes) Record an attempt made.voidrecordAttemptLatency(double attemptLatency, Map<String, String> attributes) Record the latency for an individual attempt.voidrecordOperationCount(long count, Map<String, String> attributes) Record an operation made.voidrecordOperationLatency(double operationLatency, Map<String, String> attributes) Record the latency for the entire operation.
-
Field Details
-
GAX_METER_NAME
- See Also:
-
-
Constructor Details
-
OpenTelemetryMetricsRecorder
public OpenTelemetryMetricsRecorder(io.opentelemetry.api.OpenTelemetry openTelemetry, String serviceName) Creates the following instruments for the following metrics:- Attempt Latency: Histogram
- Operation Latency: Histogram
- Attempt Count: Counter
- Operation Count: Counter
- Parameters:
openTelemetry- OpenTelemetry instanceserviceName- Service Name
-
-
Method Details
-
recordAttemptLatency
Record the latency for an individual attempt. Data is stored in a Histogram.- Specified by:
recordAttemptLatencyin interfaceMetricsRecorder- Parameters:
attemptLatency- Attempt Latency in msattributes- Map of the attributes to store
-
recordAttemptCount
Record an attempt made. The attempt count number is stored in a LongCounter.The count should be set as 1 every time this is invoked (each retry attempt)
- Specified by:
recordAttemptCountin interfaceMetricsRecorder- Parameters:
count- The number of attempts madeattributes- Map of the attributes to store
-
recordOperationLatency
Record the latency for the entire operation. This is the latency for the entire RPC, including all the retry attempts- Specified by:
recordOperationLatencyin interfaceMetricsRecorder- Parameters:
operationLatency- Operation Latency in msattributes- Map of the attributes to store
-
recordOperationCount
Record an operation made. The operation count number is stored in a LongCounter.The operation count should always be 1 and this should be invoked once.
- Specified by:
recordOperationCountin interfaceMetricsRecorder- Parameters:
count- The number of operations madeattributes- Map of the attributes to store
-