Class BigQuerySinkMetrics
- java.lang.Object
-
- org.apache.beam.sdk.io.gcp.bigquery.BigQuerySinkMetrics
-
public class BigQuerySinkMetrics extends java.lang.ObjectHelper class to create perworker metrics for BigQuery Sink stages.In general metrics be in the namespace 'BigQuerySink' and have their name formatted as:
'{baseName}*{metricLabelKey1}:{metricLabelVal1};...{metricLabelKeyN}:{metricLabelValN};'
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBigQuerySinkMetrics.RpcMethod
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringMETRICS_NAMESPACEstatic java.lang.StringOKstatic java.lang.StringPAYLOAD_TOO_LARGEstatic java.lang.StringTHROTTLED_TIMEstatic java.lang.StringUNKNOWN
-
Constructor Summary
Constructors Constructor Description BigQuerySinkMetrics()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.apache.beam.sdk.metrics.CounterappendRowsRowStatusCounter(org.apache.beam.sdk.io.gcp.bigquery.BigQuerySinkMetrics.RowStatus rowStatus, java.lang.String rpcStatus, java.lang.String tableId)static voidreportFailedRPCMetrics(org.apache.beam.sdk.io.gcp.bigquery.RetryManager.Operation.Context<?> c, BigQuerySinkMetrics.RpcMethod method)Records RpcRequests counter and RpcLatency histogram for this RPC call.static voidreportFailedRPCMetrics(org.apache.beam.sdk.io.gcp.bigquery.RetryManager.Operation.Context<?> c, BigQuerySinkMetrics.RpcMethod method, java.lang.String tableId)Records RpcRequests counter and RpcLatency histogram for this RPC call.static voidreportSuccessfulRpcMetrics(org.apache.beam.sdk.io.gcp.bigquery.RetryManager.Operation.Context<?> c, BigQuerySinkMetrics.RpcMethod method)Records RpcRequests counter and RpcLatency histogram for this RPC call.static voidreportSuccessfulRpcMetrics(org.apache.beam.sdk.io.gcp.bigquery.RetryManager.Operation.Context<?> c, BigQuerySinkMetrics.RpcMethod method, java.lang.String tableId)Records RpcRequests counter and RpcLatency histogram for this RPC call.static voidsetSupportMetricsDeletion(boolean supportMetricsDeletion)static voidsetSupportStreamingInsertsMetrics(boolean supportStreamingInsertsMetrics)static org.apache.beam.sdk.metrics.CounterthrottledTimeCounter(BigQuerySinkMetrics.RpcMethod method)static java.lang.StringthrowableToGRPCCodeString(java.lang.Throwable t)Converts a Throwable to a gRPC Status code.
-
-
-
Field Detail
-
METRICS_NAMESPACE
public static final java.lang.String METRICS_NAMESPACE
- See Also:
- Constant Field Values
-
UNKNOWN
public static final java.lang.String UNKNOWN
-
OK
public static final java.lang.String OK
-
PAYLOAD_TOO_LARGE
public static final java.lang.String PAYLOAD_TOO_LARGE
- See Also:
- Constant Field Values
-
THROTTLED_TIME
public static final java.lang.String THROTTLED_TIME
- See Also:
- Constant Field Values
-
-
Method Detail
-
appendRowsRowStatusCounter
public static org.apache.beam.sdk.metrics.Counter appendRowsRowStatusCounter(org.apache.beam.sdk.io.gcp.bigquery.BigQuerySinkMetrics.RowStatus rowStatus, java.lang.String rpcStatus, java.lang.String tableId)- Parameters:
rowStatus- Status of these BigQuery rows.rpcStatus- rpcStatustableId- Table pertaining to the write method. Only included in the metric key if 'supportsMetricsDeletion' is enabled.- Returns:
- Metric that tracks the status of BigQuery rows after making an AppendRows RPC call.
-
throttledTimeCounter
public static org.apache.beam.sdk.metrics.Counter throttledTimeCounter(BigQuerySinkMetrics.RpcMethod method)
- Parameters:
method- StorageWriteAPI write method.- Returns:
- Counter that tracks throttled time due to RPC retries.
-
throwableToGRPCCodeString
public static java.lang.String throwableToGRPCCodeString(@Nullable java.lang.Throwable t)Converts a Throwable to a gRPC Status code.- Parameters:
t- Throwable.- Returns:
- gRPC status code string or 'UNKNOWN' if 't' is null or does not map to a gRPC error.
-
reportSuccessfulRpcMetrics
public static void reportSuccessfulRpcMetrics(@Nullable org.apache.beam.sdk.io.gcp.bigquery.RetryManager.Operation.Context<?> c, BigQuerySinkMetrics.RpcMethod method)Records RpcRequests counter and RpcLatency histogram for this RPC call. If 'SupportMetricsDeletion' is enabled, RpcRequests counter will have tableId label set toUNKNOWN. RpcRequets counter will have RpcStatus label set toOK.- Parameters:
c- Context of successful RPC call.method- StorageWriteAPI method associated with this metric.
-
reportSuccessfulRpcMetrics
public static void reportSuccessfulRpcMetrics(@Nullable org.apache.beam.sdk.io.gcp.bigquery.RetryManager.Operation.Context<?> c, BigQuerySinkMetrics.RpcMethod method, java.lang.String tableId)Records RpcRequests counter and RpcLatency histogram for this RPC call. RpcRequets counter will have RpcStatus label set toOK.- Parameters:
c- Context of successful RPC call.method- StorageWriteAPI method associated with this metric.tableId- Table pertaining to the write method. Only included in the metric key if 'supportsMetricsDeletion' is enabled.
-
reportFailedRPCMetrics
public static void reportFailedRPCMetrics(@Nullable org.apache.beam.sdk.io.gcp.bigquery.RetryManager.Operation.Context<?> c, BigQuerySinkMetrics.RpcMethod method)Records RpcRequests counter and RpcLatency histogram for this RPC call. If 'SupportMetricsDeletion' is enabled, RpcRequests counter will have tableId label set toUNKNOWN. RpcRequets counter will have a RpcStatus label set from the gRPC error.- Parameters:
c- Context of successful RPC call.method- StorageWriteAPI method associated with this metric.
-
reportFailedRPCMetrics
public static void reportFailedRPCMetrics(@Nullable org.apache.beam.sdk.io.gcp.bigquery.RetryManager.Operation.Context<?> c, BigQuerySinkMetrics.RpcMethod method, java.lang.String tableId)Records RpcRequests counter and RpcLatency histogram for this RPC call. RpcRequets counter will have a RpcStatus label set from the gRPC error.- Parameters:
c- Context of successful RPC call.method- StorageWriteAPI method associated with this metric.tableId- Table pertaining to the write method. Only included in the metric key if 'supportsMetricsDeletion' is enabled.
-
setSupportStreamingInsertsMetrics
public static void setSupportStreamingInsertsMetrics(boolean supportStreamingInsertsMetrics)
-
setSupportMetricsDeletion
public static void setSupportMetricsDeletion(boolean supportMetricsDeletion)
-
-