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

[feature] [#13099] Automatic RPC usage refresh #13364

Conversation

smohamedjavid
Copy link
Member

Fixes #13099

Summary

In this PR, I have added an automatic refresh of RPC usage under RPC usage stats screen without the user's need to interact with the app.
This is achieved by calling the get-stats method every 2 seconds with the help of the set-interval method from utils.

I have removed the Refresh button from the UI as it no longer serves the purpose and kept the Reset and Copy buttons intact.

Areas that maybe impacted

  • RPC Usage Stats

Steps to test

  • Open Status
  • Navigate to Profile Tab
  • Open Advanced Settings
  • Open RPC Usage Stats

status: ready

@status-github-bot
Copy link

Hey @smohamedjavid, and thank you so much for making your first pull request in status-react! ❤️ Please help us make your experience better by filling out this brief questionnaire https://goo.gl/forms/uWqNcVpVz7OIopXg2


(def rpc-usage-refresh-interval 2000)

(reset! rpc-refresh-interval (utils/set-interval #(re-frame/dispatch [::get-stats]) rpc-usage-refresh-interval))
Copy link
Member

Choose a reason for hiding this comment

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

i guess we need this only when the screen is opened

Copy link
Member

Choose a reason for hiding this comment

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

Yes, probably best to use the component lifecycle methods (componentdidmount & componentwillunmount for cleaning up), there should be a few examples on how we do this in the codebase (if you search for component-did-mount you should find a few examples)

Copy link
Member Author

Choose a reason for hiding this comment

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

@flexsurfer @cammellos - Updated the code with interval cleanup

Copy link
Member

Choose a reason for hiding this comment

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

@smohamedjavid could you run make lint-fix and make lint please? The build is failing because of indentation.
Thanks!

Copy link
Member Author

Choose a reason for hiding this comment

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

@cammellos - Apologies, I have fixed the lint issue and the build is successful now.

@status-im-auto
Copy link
Member

status-im-auto commented May 17, 2022

Jenkins Builds

Click to see older builds (12)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 921400b #1 2022-05-17 10:30:46 ~9 min android-e2e 📦apk 📲
✔️ 921400b #1 2022-05-17 10:32:02 ~10 min android 📦apk 📲
✔️ 921400b #1 2022-05-17 10:38:02 ~16 min ios 📦ipa 📲
✖️ a932aee #2 2022-05-17 11:45:07 ~10 min android-e2e 📦apk 📲
✖️ a932aee #2 2022-05-17 11:45:48 ~10 min android 📦apk 📲
✖️ a932aee #2 2022-05-17 11:48:22 ~13 min ios 📦ipa 📲
✖️ 1001d5a #3 2022-05-17 11:51:56 ~9 min android 📦apk 📲
✖️ 1001d5a #3 2022-05-17 11:52:07 ~10 min android-e2e 📦apk 📲
✖️ 1001d5a #3 2022-05-17 11:53:10 ~11 min ios 📦ipa 📲
✔️ 467a87a #4 2022-05-17 12:17:31 ~9 min android-e2e 📦apk 📲
✔️ 467a87a #4 2022-05-17 12:17:34 ~9 min android 📦apk 📲
✔️ 467a87a #4 2022-05-17 12:21:03 ~12 min ios 📦ipa 📲
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ ad3752a #5 2022-05-17 15:20:57 ~10 min android-e2e 📦apk 📲
✔️ ad3752a #5 2022-05-17 15:21:29 ~11 min android 📦apk 📲
✔️ ad3752a #5 2022-05-17 15:25:47 ~15 min ios 📦ipa 📲
✔️ 9b4b63a #6 2022-05-19 15:08:39 ~8 min android-e2e 📦apk 📲
✔️ 9b4b63a #6 2022-05-19 15:08:43 ~8 min android 📦apk 📲
✔️ 9b4b63a #6 2022-05-19 15:12:02 ~12 min ios 📦ipa 📲

@smohamedjavid smohamedjavid force-pushed the feature/#13099_automatic_rpc_usage_refresh branch 2 times, most recently from 1001d5a to 467a87a Compare May 17, 2022 12:08

(let [stats @(re-frame/subscribe [:rpc-usage/data])
Copy link
Member

Choose a reason for hiding this comment

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

if you used letsubs , you need to move subsciptions to it

Copy link
Member Author

Choose a reason for hiding this comment

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

It's a small hack to make sure the UI is updated when we dispatch the get-stats method. Apologies, I'll create a container and push it.

@smohamedjavid smohamedjavid force-pushed the feature/#13099_automatic_rpc_usage_refresh branch from 467a87a to ad3752a Compare May 17, 2022 15:09
Copy link
Member

@cammellos cammellos left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks!

@@ -565,7 +565,7 @@
:component network-info/network-info}
{:name :rpc-usage-info
:options {:topBar {:title {:text (i18n/label :t/rpc-usage-info)}}}
:component rpc-usage-info/usage-info}
:component rpc-usage-info/usage-info-container}
Copy link
Member

Choose a reason for hiding this comment

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

its better to keep this name for container and rename usage-info to usage-info-render

Copy link
Member

Choose a reason for hiding this comment

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

so here we should keep rpc-usage-info/usage-info

Copy link
Member Author

Choose a reason for hiding this comment

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

I initially started with that naming convention but I looked at other files where it follows as above so I followed the same (doesn't want to deviate from the code ambience). I can change the name if needed. Kindly advice. @flexsurfer

@qoqobolo qoqobolo moved this from REVIEW to E2E Tests in Pipeline for QA May 19, 2022
@qoqobolo qoqobolo moved this from E2E Tests to IN TESTING in Pipeline for QA May 19, 2022
@status-im-auto
Copy link
Member

90% of end-end tests have passed

Total executed tests: 84
Failed tests: 8
Passed tests: 76
Not executed tests: 1
IDs of not executed tests: 702267 
IDs of failed tests: 3994,702153,702186,700743,702076,5756,700744,702188 

Not executed tests (1)

Click to expand
  • Rerun not executed tests
  • Failed tests (8)

    Click to expand
  • Rerun failed tests

  • 1. test_group_chat_push_system_messages_when_invited, id: 3994

    Device 2: Looking for a message by text: Fickle Opulent Reptile created the group acclooo
    Device 2: Looking for a message by text: Fickle Opulent Reptile has invited Tattered Tricky Chafer

    Fickle Opulent Reptile invited you to acclooo is not shown after invite to group chat Fickle Opulent Reptile wants you to join group acclooo is not shown after invite to group chat

    Class: TestGroupChatMultipleDeviceMerged

    Device sessions

    2. test_ens_command_send_tx_eth_1_1_chat, id: 702153

    # STEP: Check that message is fetched for receiver
    Device 2: Looking for chat: 'Forked Slategray Vampirebat'

    E http.client.RemoteDisconnected: Remote end closed connection without response

    During handling of the above exception, another exception occurred:
    ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))


    Class: TestEnsStickersMultipleDevicesMerged

    Device sessions

    3. test_keycard_command_send_tx_eth_1_1_chat, id: 702186

    Expected amount of confirmations is 3, in fact 4
    Device 1: Click until EditBox by accessibility id: chat-message-input will be presented

    E http.client.RemoteDisconnected: Remote end closed connection without response

    During handling of the above exception, another exception occurred:
    ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))


    Class: TestContactBlockMigrateKeycardMultipleSharedDevices

    Device sessions

    4. test_onboarding_share_contact_address, id: 700743

    ## 1-1 chat is created successfully!
    Device 1: Find EditBox by accessibility id: chat-message-input

    Device 1: EditBox by accessibility id: chat-message-input is not found on the screen

    Class: TestOnboardingOneDeviceMerged

    Device sessions

    5. test_browser_delete_close_tabs, id: 702076

    Device 1: Find Button by xpath: //*[contains(@text, 'bbc.com')]/../../../../*[@content-desc='empty-tab']
    Device 1: Tap on found: Button

    Device 1: Button by xpath: //*[contains(@text, "bbc.com")] is still visible on the screen after 10 seconds after wait_for_invisibility_of_element

    Class: TestPublicChatBrowserOneDeviceMerged

    Device sessions

    6. test_group_chat_decline_invite_chat_highligted, id: 5756

    Device 1: Find SendMessageButton by accessibility id: send-message-button
    Device 1: Tap on found: SendMessageButton

    Preview message is not hightligted or text is not shown!

    Class: TestGroupChatMultipleDeviceMerged

    Device sessions

    7. test_onboarding_share_wallet_address, id: 700744

    Device 1: Looking for chat: '#zoclnjq'
    Device 1: Wait for element Button for max 30s and click when it is available

    Device 1: Button by accessibility id:notifications-unread-badge is not found on the screen after wait_for_visibility_of_element

    Class: TestOnboardingOneDeviceMerged

    Device sessions

    8. test_cellular_settings_on_off_public_chat_fetching_history, id: 702188

    ## Public chat 'e2e-started-before' is created successfully!
    Device 1: Sending message 'message to pub chat'

    Device 1: EditBox by accessibility id: chat-message-input is not found on the screen after wait_for_element

    Class: TestContactBlockMigrateKeycardMultipleSharedDevices

    Device sessions

    Passed tests (76)

    Click to expand

    1. test_wallet_add_account_seed_phrase_collectibles_rinkeby_set_as_profile_image, id: 700762

    Class: TestWalletManagementDeviceMerged

    Device sessions

    2. test_wallet_manage_assets, id: 700758

    Class: TestWalletManagementDeviceMerged

    Device sessions

    3. test_public_chat_message_edit, id: 700734

    Class: TestPublicChatMultipleDeviceMerged

    Device sessions

    4. test_contact_block_unblock_public_chat_offline, id: 702176

    Class: TestContactBlockMigrateKeycardMultipleSharedDevices

    Device sessions

    5. test_1_1_chat_text_message_edit_delete_push_disappear, id: 695843

    Class: TestOneToOneChatMultipleSharedDevices

    Device sessions

    6. test_keycard_relogin_after_restore, id: 700768

    Class: TestKeycardTxOneDeviceMerged

    Device sessions

    7. test_send_tx_token_7_decimals, id: 700764

    Class: TestSendTxDeviceMerged

    Device sessions

    8. test_contact_add_remove_mention_default_username_nickname_public_chat, id: 702175

    Class: TestContactBlockMigrateKeycardMultipleSharedDevices

    Device sessions

    9. test_public_chat_open_using_deep_link, id: 700739

    Class: TestPublicChatBrowserOneDeviceMerged

    Device sessions

    10. test_public_chat_unread_messages_counter, id: 5360

    Class: TestPublicChatMultipleDeviceMerged

    Device sessions

    11. test_1_1_chat_command_decline_eth_push_changing_state, id: 6265

    Class: TestCommandsMultipleDevicesMerged

    Device sessions

    12. test_pairing_sync_contacts_block_unblock, id: 702196

    Class: TestPairingSyncMultipleDevicesMerged

    Device sessions

    13. test_public_chat_emoji_send_copy_paste_reply, id: 700719

    Class: TestPublicChatMultipleDeviceMerged

    Device sessions

    14. test_1_1_chat_command_request_and_send_tx_stt_in_1_1_chat_offline, id: 6263

    Class: TestCommandsMultipleDevicesMerged

    Device sessions

    15. test_browser_bookmarks_create_edit_remove, id: 702077

    Class: TestPublicChatBrowserOneDeviceMerged

    Device sessions

    16. test_send_tx_eth_check_logcat, id: 700763

    Class: TestSendTxDeviceMerged

    Device sessions

    17. test_public_chat_unread_messages_counter_for_mention_relogin, id: 700718

    Class: TestPublicChatMultipleDeviceMerged

    Device sessions

    18. test_send_tx_custom_token_18_decimals_invalid_password, id: 700765

    Class: TestSendTxDeviceMerged

    Device sessions

    19. test_onboarding_add_new_multiaccount_username_by_position_pass_validation, id: 700747

    Class: TestOnboardingOneDeviceMerged

    Device sessions

    20. test_public_chat_delete_chat_long_press, id: 5319

    Class: TestPublicChatMultipleDeviceMerged

    Device sessions

    21. test_onboarding_home_initial_popup, id: 700742

    Class: TestOnboardingOneDeviceMerged

    Device sessions

    22. test_browser_blocked_url, id: 702072

    Class: TestPublicChatBrowserOneDeviceMerged

    Device sessions

    23. test_wallet_add_hide_unhide_account_private_key, id: 700761

    Class: TestWalletManagementDeviceMerged

    Device sessions

    24. test_1_1_chat_message_reaction, id: 6315

    Class: TestOneToOneChatMultipleSharedDevices

    Device sessions

    25. test_ens_mention_push_highlighted_public_chat, id: 702156

    Class: TestEnsStickersMultipleDevicesMerged

    Device sessions

    26. test_keycard_send_tx_sign_message_request_stt_testdapp, id: 700769

    Class: TestKeycardTxOneDeviceMerged

    Device sessions

    27. test_1_1_chat_image_send_save_reply, id: 6305

    Class: TestOneToOneChatMultipleSharedDevices

    Device sessions

    28. test_1_1_chat_emoji_and_link_send_and_open, id: 5373

    Class: TestOneToOneChatMultipleSharedDevices

    Device sessions

    29. test_public_chat_link_send_open, id: 700736

    Class: TestPublicChatMultipleDeviceMerged

    Device sessions

    30. test_sticker_1_1_public_chat, id: 702157

    Class: TestEnsStickersMultipleDevicesMerged

    Device sessions

    31. test_onboarding_backup_seed_phrase_restore_same_login_logcat, id: 700745

    Class: TestOnboardingOneDeviceMerged

    Device sessions

    32. test_restore_set_up_wallet_sign_phrase, id: 700749

    Class: TestRestoreOneDeviceMerged

    Device sessions

    33. test_ens_mention_nickname_1_1_chat, id: 702155

    Class: TestEnsStickersMultipleDevicesMerged

    Device sessions

    34. test_1_1_chat_is_shown_message_sent_delivered_from_offline, id: 5310

    Class: TestOneToOneChatMultipleSharedDevices

    Device sessions

    35. test_public_chat_mark_all_messages_as_read, id: 6270

    Class: TestPublicChatMultipleDeviceMerged

    Device sessions

    36. test_browser_connection_is_secure_not_secure_warning, id: 702073

    Class: TestPublicChatBrowserOneDeviceMerged

    Device sessions

    37. test_send_tx_set_recipient_options, id: 700757

    Class: TestSendTxDeviceMerged

    Device sessions

    38. test_onboarding_cant_sign_in_with_invalid_password_logcat, id: 700746

    Class: TestOnboardingOneDeviceMerged

    Device sessions

    39. test_send_tx_sign_message_2tx_in_batch_tx_filters_request_stt_testdapp, id: 5342

    Class: TestSendTxDeviceMerged

    Device sessions

    40. test_group_chat_join_send_text_messages_push, id: 700731

    Class: TestGroupChatMultipleDeviceMerged

    Device sessions

    41. test_browser_web3_permissions_testdapp, id: 702078

    Class: TestPublicChatBrowserOneDeviceMerged

    Device sessions

    42. test_1_1_chat_text_message_with_push, id: 6316

    Class: TestOneToOneChatMultipleSharedDevices

    Device sessions

    43. test_wallet_add_delete_watch_only_account, id: 700760

    Class: TestWalletManagementDeviceMerged

    Device sessions

    44. test_public_chat_tag_message, id: 700738

    Class: TestPublicChatBrowserOneDeviceMerged

    Device sessions

    45. test_keycard_create_account_unlock_same_seed, id: 5689

    Class: TestKeycardTxOneDeviceMerged

    Device sessions

    46. test_1_1_chat_command_send_tx_eth_outgoing_tx_push, id: 6253

    Class: TestCommandsMultipleDevicesMerged

    Device sessions

    47. test_pairing_sync_initial_contacts_blocked_users, id: 702194

    Class: TestPairingSyncMultipleDevicesMerged

    Device sessions

    48. test_public_chat_navigate_to_chat_when_relaunch, id: 5396

    Class: TestPublicChatBrowserOneDeviceMerged

    Device sessions

    49. test_pairing_sync_1_1_chat_message, id: 702198

    Class: TestPairingSyncMultipleDevicesMerged

    Device sessions

    50. test_pairing_sync_public_chat_add_remove, id: 702199

    Class: TestPairingSyncMultipleDevicesMerged

    Device sessions

    51. test_public_chat_copy_and_paste_message_in_chat_input, id: 5317

    Class: TestPublicChatBrowserOneDeviceMerged

    Device sessions

    52. test_public_chat_fetch_more_history, id: 5675

    Class: TestPublicChatBrowserOneDeviceMerged

    Device sessions

    53. test_wallet_fetching_balance_after_offline_insufficient_funds_errors, id: 700766

    Class: TestWalletManagementDeviceMerged

    Device sessions

    54. test_group_chat_offline_pn, id: 3998

    Class: TestGroupChatMultipleDeviceMerged

    Device sessions

    55. test_restore_account_migrate_multiaccount_to_keycard_db_saved, id: 702177

    Class: TestContactBlockMigrateKeycardMultipleSharedDevices

    Device sessions

    56. test_group_chat_add_new_member_activity_centre, id: 700732

    Class: TestGroupChatMultipleDeviceMerged

    Device sessions

    57. test_public_chat_links_with_previews_github_youtube_twitter_gif_send_enable, id: 700737

    Class: TestPublicChatMultipleDeviceMerged

    Device sessions

    58. test_ens_purchased_in_profile, id: 702152

    Class: TestEnsStickersMultipleDevicesMerged

    Device sessions

    59. test_1_1_chat_non_latin_message_to_newly_added_contact_with_profile_picture_on_different_networks, id: 5315

    Class: TestOneToOneChatMultipleSharedDevices

    Device sessions

    60. test_keycard_send_tx_eth, id: 700767

    Class: TestKeycardTxOneDeviceMerged

    Device sessions

    61. test_restore_account_migrate_multiaccount_to_keycard_no_db_saved_add_wallet_send_tx, id: 702189

    Class: TestRestoreOneDeviceMerged

    Device sessions

    62. test_browser_offline, id: 702075

    Class: TestPublicChatBrowserOneDeviceMerged

    Device sessions

    63. test_browser_invalid_url, id: 702074

    Class: TestPublicChatBrowserOneDeviceMerged

    Device sessions

    64. test_restore_seed_phrase_field_validation, id: 700750

    Class: TestRestoreOneDeviceMerged

    Device sessions

    65. test_wallet_add_account_generate_new, id: 700759

    Class: TestWalletManagementDeviceMerged

    Device sessions

    66. test_start_new_chat_public_key_validation, id: 702158

    Class: TestEnsStickersMultipleDevicesMerged

    Device sessions

    67. test_restore_uppercase_whitespaces_seed_phrase_special_char_passw_logcat, id: 700748

    Class: TestRestoreOneDeviceMerged

    Device sessions

    68. test_public_chat_message_send_check_timestamps_while_on_different_tab, id: 5313

    Class: TestPublicChatMultipleDeviceMerged

    Device sessions

    69. test_wallet_tx_history_copy_tx_hash_on_cellular, id: 700756

    Class: TestWalletManagementDeviceMerged

    Device sessions

    70. test_1_1_chat_delete_via_delete_button_relogin, id: 5387

    Class: TestOneToOneChatMultipleSharedDevices

    Device sessions

    71. test_group_chat_leave_relogin, id: 3997

    Class: TestGroupChatMultipleDeviceMerged

    Device sessions

    72. test_public_chat_message_delete, id: 700735

    Class: TestPublicChatMultipleDeviceMerged

    Device sessions

    73. test_keycard_wallet_recover_pairing_check_balance_after_offline_tx_history, id: 700770

    Class: TestKeycardTxOneDeviceMerged

    Device sessions

    74. test_1_1_chat_push_emoji, id: 6283

    Class: TestOneToOneChatMultipleSharedDevices

    Device sessions

    75. test_pairing_sync_initial_public_chats, id: 702195

    Class: TestPairingSyncMultipleDevicesMerged

    Device sessions

    76. test_pairing_sync_contacts_add_remove_set_nickname_ens, id: 702197

    Class: TestPairingSyncMultipleDevicesMerged

    Device sessions

    @status-im-auto
    Copy link
    Member

    100% of end-end tests have passed

    Total executed tests: 2
    Failed tests: 0
    Passed tests: 2
    

    Passed tests (2)

    Click to expand

    1. test_browser_delete_close_tabs, id: 702076

    Class: TestPublicChatBrowserOneDeviceMerged

    Device sessions

    2. test_cellular_settings_on_off_public_chat_fetching_history, id: 702188

    Class: TestContactBlockMigrateKeycardMultipleSharedDevices

    Device sessions

    @qoqobolo
    Copy link
    Contributor

    Hi @smohamedjavid, thanks for your contribution!
    PR looks good.
    However, I noticed one thing, that could be improved in this area:

    ISSUE 1: If a method has a long name its value is not displayed on Android

    As far as I can see, this only applies to the method in the screenshot. If you copy it, it's pasted correctly, so it's absolutely not critical.
    Also, it's not a PR issue, we have it in the develop. But maybe you could take a look if it's an easy fix.
    Otherwise, we will register and fix it separately without any problems.

    photo_2022-05-19_12-42-59

    @smohamedjavid
    Copy link
    Member Author

    @qoqobolo Apologies, I cannot run the project on Android emulators from my machine at the moment. However, I know the cause of this issue (due to flex styling of text) and I fixed it. Kindly test it.

    @qoqobolo
    Copy link
    Contributor

    @smohamedjavid many thanks for this additional fix! Looks great now.
    PR can be merged.

    @qoqobolo qoqobolo moved this from IN TESTING to MERGE in Pipeline for QA May 19, 2022
    @flexsurfer flexsurfer merged commit 7c4897f into status-im:develop May 24, 2022
    Pipeline for QA automation moved this from MERGE to DONE May 24, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    Archived in project
    Development

    Successfully merging this pull request may close these issues.

    Add automatic refresh to RPC usage stats page
    5 participants