Lib_telemetry: ensure pending telemetry data is exported on exit

What

This MR modifies the telemetry setup to return a cleanup function. This function, which is provided by the OpenTelemetry collector backend, is now registered as an Lwt_exit callback in the rollup node and EVM node daemons to be called upon shutdown.

Why

Telemetry data, such as traces and logs, is often buffered and exported in batches by collectors to improve performance. Without a clean shutdown process, any data remaining in these buffers when the application exits would be lost. This change ensures that a final export is triggered during the node's shutdown sequence, preventing data loss and guaranteeing that all telemetry from the run is captured.

How

The Opentelemetry_setup.setup function's return type was changed to return the clean up function. This ensures that callers handle the cleanup. The various node daemons were updated to accept this new cleanup function and register it with Lwt_exit.register_clean_up_callback, ensuring it is executed gracefully upon termination. For the rollup node replay commands, Lwt.finalize is used to the same effect.

Edited by Alain Mebsout

Merge request reports

Loading
Loading