OperationMetricsCollector

OperationMetricsCollector

A class for tracing and recording client-side metrics related to Bigtable operations.

Constructor

new OperationMetricsCollector(tabularApiSurface, metricsHandlers, methodName, streamingOperation)

Parameters:
Name Type Description
tabularApiSurface ITabularApiSurface

Information about the Bigtable table being accessed.

metricsHandlers Array.<IMetricsHandler>

The metrics handlers used for recording metrics.

methodName MethodName

The name of the method being traced.

streamingOperation StreamingState

Whether or not the call is a streaming operation.

Methods

onAttemptComplete(projectId, attemptStatus)

Called when an attempt (e.g., an RPC attempt) completes. Records attempt latencies.

Parameters:
Name Type Description
projectId string

The id of the project.

attemptStatus grpc.status

The grpc status for the attempt.

onAttemptStart()

Called when a new attempt starts. Records the start time of the attempt.

onMetadataReceived(metadata)

Called when metadata is received. Extracts server timing information if available.

Parameters:
Name Type Description
metadata object

The received metadata.

onOperationComplete(projectId, finalOperationStatus)

Called when an operation completes (successfully or unsuccessfully). Records operation latencies, retry counts, and connectivity error counts.

Parameters:
Name Type Description
projectId string

The id of the project.

finalOperationStatus grpc.status

Information about the completed operation.

onOperationStart()

Called when the operation starts. Records the start time.

onResponse()

Called when the first response is received. Records first response latencies.

onRowReachesUser()

Called when a row from the Bigtable stream reaches the application user.

This method is used to calculate the latency experienced by the application when reading rows from a Bigtable stream. It records the time between the previous row being received and the current row reaching the user. These latencies are then collected and reported as applicationBlockingLatencies when the operation completes.

onStatusMetadataReceived(status)

Called when status information is received. Extracts zone and cluster information.

Parameters:
Name Type Description
status object

The received status information.