44
44
import com .google .common .collect .Maps ;
45
45
import com .google .protobuf .BlockingService ;
46
46
import com .google .protobuf .ProtocolMessageEnum ;
47
+ import com .google .protobuf .TextFormat ;
47
48
import java .io .IOException ;
48
49
import java .net .InetSocketAddress ;
49
50
import java .util .ArrayList ;
@@ -285,7 +286,7 @@ private String constructCommandAuditMap(List<SCMCommandProto> cmds) {
285
286
auditMap .append (" encodedToken: \" " ).append (cmd .getEncodedToken ()).append ("\" " );
286
287
auditMap .append (" deadlineMsSinceEpoch: " ).append (cmd .getDeadlineMsSinceEpoch ());
287
288
} else {
288
- auditMap .append (cmd );
289
+ auditMap .append (TextFormat . shortDebugString ( cmd ) );
289
290
}
290
291
auditMap .append (", " );
291
292
}
@@ -308,7 +309,7 @@ public SCMHeartbeatResponseProto sendHeartbeat(
308
309
boolean auditSuccess = true ;
309
310
Map <String , String > auditMap = Maps .newHashMap ();
310
311
auditMap .put ("datanodeUUID" , heartbeat .getDatanodeDetails ().getUuid ());
311
- auditMap .put ("command" , flatten ( constructCommandAuditMap (cmdResponses ) ));
312
+ auditMap .put ("command" , constructCommandAuditMap (cmdResponses ));
312
313
term .ifPresent (t -> auditMap .put ("term" , String .valueOf (t )));
313
314
try {
314
315
SCMHeartbeatResponseProto .Builder builder =
@@ -480,13 +481,6 @@ public AuditMessage buildAuditMessageForFailure(AuditAction op, Map<String,
480
481
.build ();
481
482
}
482
483
483
- private static String flatten (String input ) {
484
- return input
485
- .replaceAll (System .lineSeparator (), " " )
486
- .trim ()
487
- .replaceAll (" +" , " " );
488
- }
489
-
490
484
/**
491
485
* Get the ProtocolMessageMetrics for this server.
492
486
* @return ProtocolMessageMetrics
0 commit comments