janestreet / magic-trace

magic-trace collects and displays high-resolution traces of what a process is doing
https://magic-trace.org
MIT License
4.58k stars 87 forks source link

destinations.ml: add a compressed_file_destination that uses zstandard #247

Closed Lilydemi closed 1 day ago

Lilydemi commented 2 years ago

Trace files can be large and hard to share. Using zstd to compress trace files allows users to decrease their file sizes, as demonstrated here:

$ du -sh trace.fxt trace.fxt.zst
472K    trace.fxt
56K     trace.fxt.zst

This is a preliminary attempt at adding a compressed file destination. We have some open questions that we want to raise in the PR.

One thing we had to do is we had to make an original_filename labeled argument. This is because, sometimes, magic-trace uses /proc/self/fd/$FD paths as a way to prevent a race condition when serving traces.

hlian commented 2 years ago

This addresses #154 (just to link the two)

hlian commented 2 years ago

@Xyene ready for rereview if you have free time!

Xyene commented 1 day ago

Merged as part of https://github.com/janestreet/magic-trace/commit/7ac635e41438248c3a3348c039dae00854f38342. Thanks!