### EPF5 Final Update ### Project Abstract During the fellowship I worked on integrating [tracing](https://tracing.rs/) into [lighthouse](https://github.com/sigp/lighthouse/blob/stable/lighthouse) . why?: Lighthouse uses `slog` for logging,and many methods in the codebase need a slog param,which makes exporting some lighthouse crates annoying as they sometimes require external code consumer to additionally initialize and pass around their own slog instance. but with `tracing` there's no need to pass around a logger.Additionally `tracing` provides extra contextual info which is better for debugging.And `tracing` also has better logging tools.And it's better with async environment in general. Here's the Project Proposal: https://github.com/eth-protocol-fellows/cohort-five/blob/main/projects/tracing-integration-lighthouse.md ### State of the project Here's the PR: https://github.com/sigp/lighthouse/pull/6339 (WIP) - The whole codebase of lighthouse has been fully migrated from `slog` to `tracing` - Custom formatter: The [custom formatter](https://github.com/ThreeHrSleep/lighthouse/tree/tracing-integration/common/logging) had to be rewritten(almost fully) to make sure the format of the logs remains identical(almost) to what we had before, because lighthouse's internal infra and external users/staking services rely on lighthouse logs to be formatted in a certain way. This is how the logs look like right now: ![Screenshot 2024-11-02 at 6.37.10 AM](https://hackmd.io/_uploads/S1FuHJlQye.png) - Custom crit macro: As `tracing` doesn’t provide `crit!` out of the box,so we had to build a custom implementation ![Screenshot 2024-11-02 at 6.35.47 AM](https://hackmd.io/_uploads/SyznINeQJl.png) - File logging : File Logging mechanism has been migrated from `sloggers` to `tracing-appender`. - As we're using `RollingFileAppender` now ,We now have time-based file rotation instead of size-based rotation. - SSE logging : Previous code for SSE Logging had to be removed completely and SSE Logging Component had to be re-implemented from scratch.![Screenshot 2024-11-01 at 7.49.25 PM](https://hackmd.io/_uploads/r171eUb71e.png) - All `slog::o!`s has been removed and have been(& are still being) replaced with `spans`.(Both of these are used for additional context) - Right now spans for [slasher service](https://github.com/ThreeHrSleep/lighthouse/pull/1) & for [RPC](https://github.com/ThreeHrSleep/lighthouse/pull/2) have been added (Thanks to Eitan for the PRs) ### Next steps - Adding more spans so that all the `service_name`s show up in the logs like they used to. - More testing/QA to make sure that this change breaks the least amount of things possible - Adding flags for disabling,enabling additional contextual info. - More feedback-fix iterations ### Self-evaluation welp,I think I could've performed a bit better. Taking on 2 projects at once in the beginning (with my not-so-great dev skill-set) wasn't really a smart move. Some things that I think I should've done: - Spending more time learning the fundamentals during first few weeks. - Teaming up: Having another fellow to discuss roadblocks/ideas could've been helpful.Even though my Mentors were super helpful,I often spent a lot of time stuck on issues ,trying to come up with the solutions by myself, before asking them,thinking 'this issue is just too lame to bother the mentors with'. Having a team-mate could've helped in such situations to bounce ideas off & to brain-storm. - Spending more time during the project selection phase & tinker with more projects instead of rushing to start working on the project itself But,I got to learn a lot during these last few months. I think almost 80% of the stuff that I know now about the core protocol,it's development & research is due to EPF.And also,I got better at Rust :) ### Feedback on EPF It was a blast! :heart: Really liked the freedom that we were given.And overall stucture of the programme was just great. The Office Hours/AMAs were super insightful.Also learned a lot just by reading other's dev-updates. Getting to work with Lighthouse team was absolutely amazing. Huge Thanks to [Age](https://github.com/agemanning),[Eitan](https://github.com/eserilev),[Mac](https://github.com/macladson) for tolerating me for so long,answering all my queries and for helping me out with everything throughtout the fellowship. Special thanks to Eitan & Mac for reviewing that monsterous mess of a [PR](https://github.com/sigp/lighthouse/pull/6339) & for being so patient with me. And I owe an apology to [Michael](https://github.com/michaelsproul) because I had to drop the other project[[Direct(non-http) integration of Lighthouse-Reth](https://github.com/eth-protocol-fellows/cohort-five/blob/7bd4509acaec8416926c5bc5f23c4b38e76c57b4/projects/direct-integration-of-lighthouse-reth-and-tracing-integration-in-lighthouse.md)] midway.Thanks to him for patiently helping me with all my doubts regarding that project though.Even though I couldn't end up making too much progress on it, I got to learn a lot about the intrecacies of how EL-CL communication works. And Finally,Thanks a lot to Mario & Josh for organizing this whole thing.You guys are the OGs. Really grateful to you two & the EF for providing us with the opportunity and for organizing the whole program so seamlessly. It was a pleasure getting to know all of the fellows. See y'all soon in some random PRs,issues,forums,(and calls maybe?) :) peace out :dove_of_peace: