long errorOffset, LOGTYPES type, FileSystem fs,
Throwable ex, Context context, long recoveryTime) {
try {
incrLogMetricCounter(context, fs, type, result,
codec == null? null: codec.id);
LogSample sample = new LogSample();
sample.addNormalValue(LOGKEYS.Result.name(), result.name());
sample.addIntValue(LOGKEYS.ConstructedBytes.name(), bytes);
if (null != codec) {
sample.addNormalValue(LOGKEYS.Code.name(), codec.id);
} else {
sample.addNormalValue(LOGKEYS.Code.name(), "unknown");
}
if (delay >= 0) sample.addIntValue(LOGKEYS.Delay.name(), delay);
if (decodingTime >= 0) sample.addIntValue(LOGKEYS.DecodingTime.name(),
decodingTime);
if (numMissingBlocks >= 0)
sample.addNormalValue(LOGKEYS.MissingBlocks.name(),
Integer.toString(numMissingBlocks));
if (numReadBytes >= 0) sample.addIntValue(LOGKEYS.ReadBytes.name(),
numReadBytes);
if (numReadRemoteRackBytes >= 0)
sample.addIntValue(LOGKEYS.RemoteRackReadBytes.name(),
numReadRemoteRackBytes);
if (recoveryTime > 0) {
sample.addIntValue(LOGKEYS.RecoveryTime.name(), recoveryTime);
}
sample.addNormalValue(LOGKEYS.Path.name(), srcFile.toString());
sample.addIntValue(LOGKEYS.Offset.name(), errorOffset);
sample.addNormalValue(LOGKEYS.Type.name(), type.name());
sample.addNormalValue(LOGKEYS.Cluster.name(), fs.getUri().getAuthority());
if (ex != null) {
sample.addNormalValue(LOGKEYS.Error.name(),
StringUtils.stringifyException(ex));
}
DECODER_METRICS_LOG.info(sample.toJSON());
} catch(Exception e) {
LOG.warn("Exception when logging the Raid metrics: " + e.getMessage(),
e);
}