Search in sources :

Example 1 with NameInt64Pair

use of org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.NameInt64Pair 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() || response.getScanMetrics() == null) {
        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.hadoop.hbase.shaded.com.google.protobuf.ByteString) ScanMetrics(org.apache.hadoop.hbase.shaded.protobuf.generated.MapReduceProtos.ScanMetrics)

Aggregations

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