RPC_server: truncate logging messages
What
Truncate the message in the log events RPC_server.rpc_http_event_* to a max of 4095 bytes.
Why
Some node events are output using emit__dont_wait__use_with_care, in particular p2p_io_scheduler.reset_quota and p2p_io_scheduler.reset_quota, which are produced very often.
This means they may get mingled with other events, in particular ones that have a huge payload, like RPC_server.rpc_http_event_debug for a POST query with much data, such as DAL node's POST \slots RPC, which may have 128KB.
If the events get mingled, tezt cannot decode them and the test will fail with error like this one:
[error] Could not parse daemon octez-dal-node1 event after 1048576 bytes
(see for instance https://gitlab.com/tezos/tezos/-/jobs/7461122557)
How mingled events look in a tezt log:
[13:43:46.521] {"fd-sink-item.v0":{"hostname":"eznl2","time_stamp":1721828626.499304,"section":["rpc_server"],"event":{"rpc_http_event_debug.v0":"[pid:939133][resto] server (52) request body: {\n \"invalid_utf8_string\": [\n 115,\n 108,\n 111,\n 116,\n 32,\n 49,\n 55,\n 0,\n 0,\n
[... very long line]
0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n {"fd-sink-item.v0":{"hostname":"eznl2","time_stamp":1721828626.515947,"section":["p2p","io-scheduler"],"event":{"reset_quota.v0":{}}}}
[13:43:46.533] {"fd-sink-item.v0":{"hostname":"eznl2","time_stamp":1721828626.516003,"section":["p2p","io-scheduler"],"event":{"update_quota.v0":"io_scheduler(read)"}}}
[13:43:46.545] {"fd-sink-item.v0":{"hostname":"eznl2","time_stamp":1721828626.516016,"section":["p2p","io-scheduler"],"event":{"update_quota.v0":"io_scheduler(write)"}}}
[13:43:46.572] 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\
[... very long line]
0,\n {"fd-sink-item.v0":{"hostname":"eznl2","time_stamp":1721828626.515947,"section":["p2p","io-scheduler"],"event":{"reset_quota.v0":{}}}}
[13:43:46.533] {"fd-sink-item.v0":{"hostname":"eznl2","time_stamp":1721828626.516003,"section":["p2p","io-scheduler"],"event":{"update_quota.v0":"io_scheduler(read)"}}}
[13:43:46.545] {"fd-sink-item.v0":{"hostname":"eznl2","time_stamp":1721828626.516016,"section":["p2p","io-scheduler"],"event":{"update_quota.v0":"io_scheduler(write)"}}}
[13:43:46.572] 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0
[... very long line]
0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0\n ]\n}"}}}
On the one hand, truncating the message of the mentioned events seems reasonable (as I don't think the large payload would be useful in practice), and on the other hand it should fix the issue with tezt being unable to decode events. This is an alternative attempt to fix the issue to !14352 (closed), which still exhibited the issue.