Search in sources :

Example 1 with ScanMetrics

use of org.apache.hadoop.hbase.shaded.protobuf.generated.MapReduceProtos.ScanMetrics in project hbase by apache.

the class ResponseConverter method getScanMetrics.

public static Map<String, Long> getScanMetrics(ScanResponse response) {
    Map<String, Long> metricMap = new HashMap<>();
    if (response == null || !response.hasScanMetrics()) {
        return metricMap;
    }
    ScanMetrics metrics = response.getScanMetrics();
    int numberOfMetrics = metrics.getMetricsCount();
    for (int i = 0; i < numberOfMetrics; i++) {
        NameInt64Pair metricPair = metrics.getMetrics(i);
        if (metricPair != null) {
            String name = metricPair.getName();
            Long value = metricPair.getValue();
            if (name != null && value != null) {
                metricMap.put(name, value);
            }
        }
    }
    return metricMap;
}
Also used : HashMap(java.util.HashMap) NameInt64Pair(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.NameInt64Pair) ByteString(org.apache.hbase.thirdparty.com.google.protobuf.ByteString) ScanMetrics(org.apache.hadoop.hbase.shaded.protobuf.generated.MapReduceProtos.ScanMetrics)

Aggregations

HashMap (java.util.HashMap)1 NameInt64Pair (org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.NameInt64Pair)1 ScanMetrics (org.apache.hadoop.hbase.shaded.protobuf.generated.MapReduceProtos.ScanMetrics)1 ByteString (org.apache.hbase.thirdparty.com.google.protobuf.ByteString)1