hashgraph / hedera-json-rpc-relay

Implementation of Ethereum JSON-RPC APIs for Hedera
Apache License 2.0
50 stars 68 forks source link

Add logging level guarding #1118

Open Nana-EC opened 1 year ago

Nana-EC commented 1 year ago

πŸ†•πŸ₯ First Timers Only

This issue is reserved for people who have never contributed to Hedera or any open source project in general. We know that creating a pull request (PR) is a major barrier for new contributors. The goal of this issue and all other issues labeled by 'Good First Issue' is to help you make your first contribution to Hedera.

πŸ‘Ύ Description of the issue

The relay utilizes debug and trace logs without guarding (if-statements). This can result in unnecessary string generation when such levels are not applicable

Proposed Solution:

Add log level considerations and guard appropriately See https://github.com/pinojs/pino/blob/master/docs/api.md#loggerislevelenabledlevel

πŸ“‹ Step by step guide to do a contribution

If you have never contributed to an open source project at GitHub, the following step-by-step guide will introduce you to the workflow. More information and concrete samples for shell commands for each step can be found in our CONTRIBUTING.md file. A more detailed general documentation of the GitHub PR workflow can be found here.

πŸŽ‰ Contribute to Hacktoberfest

Solve this issue as part of the Hacktoberfest event and get a chance to receive cool goodies like a T-Shirt. 🎽

πŸ€” Additional Information

If you have any questions, just ask us directly in this issue by adding a comment. You can join our community chat at Discord. A general manual about open-source contributions can be found here.

belloibrahv commented 2 days ago

Summary of My Understanding:

From what I understand, the issue focuses on improving performance by preventing unnecessary string generation in debug and trace logs when these logging levels are disabled. The proposed solution involves adding log level guards (if-statements) to ensure string generation only occurs when the logging level is enabled. I’m looking to confirm my understanding of the requirements before proceeding.

Here are some questions I’d appreciate clarification on:

  1. Could you please confirm if the main issue is related to performance inefficiencies caused by unnecessary string generation, or are there additional concerns such as incorrect logging levels being used?
  2. Should the log level guards be implemented for both debug and trace logs, or are there additional logging levels we should consider when applying the guards?
  3. Could you guide me to the specific files or modules where the majority of these unguarded logs appear, or should I apply the changes across all components of the relay?
  4. Are there any existing unit or integration tests related to logging behavior that I should reference when adding log level guards? If not, would you recommend adding test coverage for this?
  5. Is there a preferred pattern or convention for adding if-statement guards in this project to maintain consistency, or should I follow the example provided in the pino documentation?
  6. I’ve already expressed my interest in this issue. Could you provide a rough timeline for when I might expect to be officially assigned so I can plan accordingly?