Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improve logging system in terminal and UI #540

Merged

Conversation

denishacquin
Copy link
Contributor

@denishacquin denishacquin commented Sep 25, 2024

Fixes #448
Fixes #436

What

  • Refactored and improved the overall logging system for RPC, GenVM, consensus, both in backend and in frontend.
  • Display live transaction status updates in both terminal and frontend logs
  • Added filtering capabilities in the UI
  • Added ability to filter by tx hash directly from transaction items
  • Removed some unused logic in the frontend

Here's the list of events that trigger logs:

const trackedEvents = [
    'endpoint_call',
    'endpoint_success',
    'endpoint_error',
    'transaction_status_updated',
    'consensus_data_updated',
    'read_contract',
    'write_contract',
    'write_contract_failed',
    'deploying_contract',
    'deployed_contract',
    'contract_deployment_failed',
  ];
image image

Why

  • To improve debugging and overall developer experience

Testing done

  • e2e
  • unit
  • integration
  • error handling for each case

Decisions made

  • Added loguru python package for easy colored logs
  • Introduced some types for the new events in the backend to enforce type safety
  • Decided to keep llm calls and get page for later as the context is different more tricky to implement

Checks

  • I have tested this code
  • I have reviewed my own PR
  • I have created an issue for this PR
  • I have set a descriptive PR title compliant with conventional commits

Reviewing tips

  • Need special attention on the message handler class
  • Check out the terminal and play around with the logs to try the new features
  • Not 100% sure we should print the payloads in the terminal, it's a lot of clutter (we were doing it before)

User facing release notes

  • Improved logging of key events in the backend terminal
  • Improved logging in the UI
  • Added filtering capabilities in the logs in the UI

Den and others added 30 commits September 4, 2024 17:53
…nsaction-hash

# Conflicts:
#	backend/protocol_rpc/endpoints.py
#	tests/common/transactions.py
…ion-id-with-transaction-hash

# Conflicts:
#	backend/protocol_rpc/endpoints.py
@AgustinRamiroDiaz
Copy link
Contributor

@denishacquin please also fix backend unit tests

@@ -149,7 +149,6 @@ def set_transaction_result(self, transaction_hash: str, consensus_data: dict):
self.session.query(Transactions).filter_by(hash=transaction_hash).one()
)

transaction.status = TransactionStatus.FINALIZED
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason behind this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was redundant because we also update the status in the update status method, and I thought it was causing the unit test to fail. But actually updating the mocking in the test was enough, so I'm reverting this! nevermind

Den and others added 5 commits October 1, 2024 16:20
Signed-off-by: Agustín Ramiro Díaz <agustin.ramiro.diaz@gmail.com>
Signed-off-by: Agustín Ramiro Díaz <agustin.ramiro.diaz@gmail.com>
Signed-off-by: Agustín Ramiro Díaz <agustin.ramiro.diaz@gmail.com>
Signed-off-by: Agustín Ramiro Díaz <agustin.ramiro.diaz@gmail.com>
Signed-off-by: Agustín Ramiro Díaz <agustin.ramiro.diaz@gmail.com>
Signed-off-by: Agustín Ramiro Díaz <agustin.ramiro.diaz@gmail.com>
Copy link

sonarcloud bot commented Oct 1, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

@AgustinRamiroDiaz AgustinRamiroDiaz merged commit beeac5c into main Oct 1, 2024
14 of 16 checks passed
Copy link
Contributor

github-actions bot commented Oct 2, 2024

🎉 This PR is included in version 0.13.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@cristiam86 cristiam86 deleted the 448-show-captured-outputs-also-in-the-dev-terminal branch October 16, 2024 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show captured outputs also in the dev terminal Return validator execution logs
3 participants