/** * Publish the scan metrics. For now, we use scan.setAttribute to pass the metrics back to the * application or TableInputFormat.Later, we could push it to other systems. We don't use metrics * framework because it doesn't support multi-instances of the same metrics on the same machine; * for scan/map reduce scenarios, we will have multiple scans running at the same time. * * <p>By default, scan metrics are disabled; if the application wants to collect them, this * behavior can be turned on by calling calling: * * <p>scan.setAttribute(SCAN_ATTRIBUTES_METRICS_ENABLE, Bytes.toBytes(Boolean.TRUE)) */ protected void writeScanMetrics() { if (this.scanMetrics == null || scanMetricsPublished) { return; } MapReduceProtos.ScanMetrics pScanMetrics = ProtobufUtil.toScanMetrics(scanMetrics); scan.setAttribute(Scan.SCAN_ATTRIBUTES_METRICS_DATA, pScanMetrics.toByteArray()); scanMetricsPublished = true; }