rabbitmq_tracing should open trace files using UTF-8 for encoding
Is your feature request related to a problem? Please describe.
We are using rabbitmq_tracing plugin and faced an issue - when opening log.file from admin->tracing->trace log files we see bad enconding for cyrillic symbols cause no charset is set by default.
Describe the solution you'd like
Maybe you should consider adding js function for opening file in new window:
in tracing.js add ( https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_tracing/priv/www/js/tracing.js )
function loadTextFile(node, file) {
fetch('/api/trace-files/node/' + node + '/' + file)
.then(response => response.text())
.then(text => {
const win = window.open();
win.document.write('<pre style="word-wrap: break-word; white-space: pre-wrap;" >' + text + '</pre>');
});
}
and in traces.ejs ( https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_tracing/priv/www/js/tmpl/traces.ejs#L94 )
<td><a onclick=loadTextFile(<%= node.name %>, <%= file.name %>) ><%= file.name %></a></td>
Describe alternatives you've considered
No response
Additional context
No response
@pavelbelonosov you are welcome to contribute the proposed changes.
@michaelklishin I’d like to work on this. Could you please assign it to me?
@bas0N after signing the CLA (that we have discussed in another issue), you are welcome to submit a PR. There are no other formalities involved, just do it.
Got it, thanks! I’m on it
@michaelklishin Could you please take a look at this PR? This implements a server-side fix for the UTF-8 encoding issue. The solution differs from the original JavaScript approach suggested in the issue, but it resolves the problem while providing a proper URL in the browser