CA-351685: truncate large messages in trace buffer
CA-351685: truncate large messages in trace buffer

Currently message-switch stores the payload as a string.
Most of the time this is a JSON, containing e.g. xenstore key/value
pairs.

When possible parse the payload, and store it in Rpc.t form.
This already reduces worst-case memory usage 6x
(ASCII control chars get encoded as \uNNNN leading to 6x size
 amplification).
Also truncate individual entries that are too long and add an UTF-8
ellipsis to indicate that truncation occured.

This is only done for entries stored in the trace ring, and not
with messages "on-the-wire".

The payload may not be JSON, so we have to be careful to fall back to
just truncating the entire payload.

This introduces a trace-truncate command-line value.

Signed-off-by: Edwin Török <c8d178016cbaf8a6ef23c2cbc9db96123c48b7dc@citrix.com>

xapi-project/message-switch,xapi-project/message-switch,xapi-project/message-switch