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

Devop/amplitude for new network UI #596

Merged
merged 8 commits into from
Jan 13, 2025

Conversation

gamalielhere
Copy link
Contributor

@gamalielhere gamalielhere commented Jan 10, 2025

Summary by CodeRabbit

  • New Features

    • Enhanced network selection tracking with detailed event logging
    • Added comprehensive metrics for network interactions, including custom network management
  • Improvements

    • Expanded tracking capabilities for network tabs, pinning, sorting, and custom network actions
    • Introduced more granular event tracking for network-related user interactions

Copy link

coderabbitai bot commented Jan 10, 2025

Warning

Rate limit exceeded

@gamalielhere has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 2 minutes and 39 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 4ae43e8 and f5654c3.

📒 Files selected for processing (14)
  • packages/extension/src/libs/metrics/index.ts (3 hunks)
  • packages/extension/src/libs/metrics/types.ts (1 hunks)
  • packages/extension/src/providers/bitcoin/methods/btc_switchNetwork.ts (3 hunks)
  • packages/extension/src/providers/ethereum/methods/wallet_addEthereumChain.ts (2 hunks)
  • packages/extension/src/providers/ethereum/methods/wallet_switchEthereumChain.ts (3 hunks)
  • packages/extension/src/providers/polkadot/ui/dot-verify-transaction.vue (2 hunks)
  • packages/extension/src/ui/action/App.vue (2 hunks)
  • packages/extension/src/ui/action/components/app-menu/components/app-menu-item.vue (2 hunks)
  • packages/extension/src/ui/action/components/app-menu/components/app-menu-sort.vue (2 hunks)
  • packages/extension/src/ui/action/components/app-menu/components/app-menu-tab.vue (2 hunks)
  • packages/extension/src/ui/action/components/app-menu/index.vue (2 hunks)
  • packages/extension/src/ui/action/views/add-network/components/add-network-item.vue (2 hunks)
  • packages/extension/src/ui/action/views/add-network/index.vue (2 hunks)
  • packages/extension/src/ui/action/views/add-network/views/add-custom-network.vue (2 hunks)

Walkthrough

This pull request introduces comprehensive enhancements to network selection tracking across multiple components in the extension. The changes expand the trackNetworkSelected function's capabilities by adding numerous optional parameters to capture more detailed metrics about network interactions. New enum values in NetworkChangeEvents provide granular tracking for various network-related actions such as tab clicks, pinning, sorting, and custom network management. Multiple components are updated to integrate these new tracking capabilities, enabling more detailed analytics of user network interactions.

Changes

File Change Summary
packages/extension/src/libs/metrics/index.ts Updated trackNetworkSelected function signature with expanded optional parameters for comprehensive network tracking
packages/extension/src/libs/metrics/types.ts Added multiple new enum values to NetworkChangeEvents for detailed network interaction tracking
packages/extension/src/ui/action/components/app-menu/* Added tracking for network pinning, sorting, and tab interactions
packages/extension/src/ui/action/views/add-network/* Integrated tracking for custom network addition, deletion, and navigation events

Possibly related PRs

Suggested reviewers

  • NickKelly1
  • kvhnuke
  • SemajaM8

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

github-actions bot commented Jan 10, 2025

💼 Build Files
chrome: enkrypt-chrome-f5654c3c.zip
firefox: enkrypt-firefox-f5654c3c.zip

💉 Virus total analysis
chrome: f5654c3c
firefox: f5654c3c

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (9)
packages/extension/src/libs/metrics/types.ts (1)

1-1: Consider using a relative import path

The import path could be simplified using a relative path instead of traversing up multiple directories.

-import { NetworkSortOption } from './../../ui/action/types/network-sort';
+import { NetworkSortOption } from '@/ui/action/types/network-sort';
packages/extension/src/libs/metrics/index.ts (1)

23-38: Add JSDoc documentation and improve type safety

While the expanded options provide comprehensive tracking capabilities, consider these improvements:

  1. Add JSDoc documentation to describe the purpose and usage of each parameter
  2. Consider using more specific types for some parameters:
    • networkType could be an enum
    • customChainId could be typed as number

Example implementation:

/**
 * Tracks network-related events with detailed context
 * @param event - The type of network change event
 * @param options - Configuration options for the event
 * @param options.provider - The provider name
 * @param options.network - The network name
 * @param options.networkTab - The active network tab
 * [... document remaining parameters ...]
 */
packages/extension/src/ui/action/views/add-network/index.vue (2)

49-49: Consider adding more context to the tracking event

The tracking call could include additional context about the user's current state.

-trackNetworkSelected(NetworkChangeEvents.NetworkAddCustomClicked, {});
+trackNetworkSelected(NetworkChangeEvents.NetworkAddCustomClicked, {
+  networkType: 'custom'
+});

53-53: Consider adding navigation context to the tracking event

The back button tracking could include information about where the user is returning from.

-trackNetworkSelected(NetworkChangeEvents.NetworkCustomBackButton, {});
+trackNetworkSelected(NetworkChangeEvents.NetworkCustomBackButton, {
+  networkType: 'custom'
+});
packages/extension/src/ui/action/views/add-network/components/add-network-item.vue (1)

91-93: Consider adding error handling for the tracking call.

While the tracking implementation is correct, consider wrapping it in a try-catch to ensure any tracking failures don't affect the network deletion functionality.

 const deleteNetwork = async () => {
   const chainId = (props.network as unknown as CustomEvmNetwork).chainID;
   if (chainId !== undefined) {
+    try {
       trackNetworkSelected(NetworkChangeEvents.NetworkDeleteCustomNetwork, {
         customChainId: chainId,
       });
+    } catch (error) {
+      console.error('Failed to track network deletion:', error);
+    }
     emit('networkDeleted', chainId);
   }
 };
packages/extension/src/ui/action/components/app-menu/components/app-menu-sort.vue (1)

95-97: Consider adding error handling for the tracking call.

The tracking implementation is correct, but consider wrapping it in a try-catch to ensure any tracking failures don't affect the sort functionality.

   } else {
     // Next Release Version: update this function
     newSortBy.name = _sort;
   }
+  try {
     trackNetworkSelected(NetworkChangeEvents.NetworkSortOptionChanged, {
       sortOption: newSortBy.name,
     });
+  } catch (error) {
+    console.error('Failed to track sort option change:', error);
+  }
   emit('update:sort', newSortBy);
packages/extension/src/ui/action/components/app-menu/components/app-menu-item.vue (1)

183-186: Consider adding error handling for the tracking call.

While the tracking implementation is correct, consider wrapping it in a try-catch to ensure any tracking failures don't affect the pin functionality.

 const setPinned = async () => {
+  try {
     trackNetworkSelected(NetworkChangeEvents.NetworkPinnedStatusChanged, {
       network: props.network.name,
       isPinned: !props.isPinned,
     });
+  } catch (error) {
+    console.error('Failed to track pin status change:', error);
+  }
   emit('update:pinNetwork', props.network.name, !props.isPinned);
 };
packages/extension/src/ui/action/components/app-menu/index.vue (2)

120-124: Consider adding TypeScript type for network types.

The network type detection logic is clean and well-structured. Consider defining a TypeScript type for the network types to improve type safety:

type NetworkType = 'testnet' | 'custom' | 'regular';

125-128: Add error handling for tracking call.

Consider wrapping the tracking call in a try-catch block to ensure that any tracking issues don't affect the core network selection functionality:

-  trackNetworkSelected(NetworkChangeEvents.NetworkActiveChanged, {
-    network: network.name,
-    networkType,
-  });
+  try {
+    trackNetworkSelected(NetworkChangeEvents.NetworkActiveChanged, {
+      network: network.name,
+      networkType,
+    });
+  } catch (error) {
+    console.error('Failed to track network selection:', error);
+  }
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8ca8cf0 and 4ae43e8.

📒 Files selected for processing (10)
  • packages/extension/src/libs/metrics/index.ts (1 hunks)
  • packages/extension/src/libs/metrics/types.ts (2 hunks)
  • packages/extension/src/ui/action/components/app-menu/components/app-menu-item.vue (2 hunks)
  • packages/extension/src/ui/action/components/app-menu/components/app-menu-sort.vue (2 hunks)
  • packages/extension/src/ui/action/components/app-menu/components/app-menu-tab.vue (2 hunks)
  • packages/extension/src/ui/action/components/app-menu/index.vue (2 hunks)
  • packages/extension/src/ui/action/views/add-network/components/add-network-item.vue (2 hunks)
  • packages/extension/src/ui/action/views/add-network/index.vue (2 hunks)
  • packages/extension/src/ui/action/views/add-network/views/add-custom-network.vue (2 hunks)
  • packages/extension/src/ui/action/views/network-assets/index.vue (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/extension/src/ui/action/views/network-assets/index.vue
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: buildAll
  • GitHub Check: test
🔇 Additional comments (7)
packages/extension/src/libs/metrics/types.ts (1)

20-27: LGTM! Well-structured event tracking enums

The new NetworkChangeEvents values follow a consistent naming pattern and provide comprehensive coverage for tracking network-related user interactions.

packages/extension/src/ui/action/components/app-menu/components/app-menu-tab.vue (1)

56-59: LGTM! Clean implementation of tab tracking

The tracking implementation is well-integrated and provides relevant context through the networkTab parameter.

packages/extension/src/ui/action/views/add-network/components/add-network-item.vue (1)

49-50: LGTM! Clean import additions.

The new imports for tracking metrics are appropriately placed at the module level.

packages/extension/src/ui/action/components/app-menu/components/app-menu-sort.vue (1)

66-67: LGTM! Clean import additions.

The new imports for tracking metrics are appropriately placed at the module level.

packages/extension/src/ui/action/views/add-network/views/add-custom-network.vue (1)

94-95: LGTM! Clean import additions.

The new imports for tracking metrics are appropriately placed at the module level.

packages/extension/src/ui/action/components/app-menu/components/app-menu-item.vue (1)

61-62: LGTM! Clean import additions.

The new imports for tracking metrics are appropriately placed at the module level.

packages/extension/src/ui/action/components/app-menu/index.vue (1)

69-70: LGTM! Clean import additions.

The new imports for tracking functionality are properly organized and consistent with the existing import style.

@gamalielhere gamalielhere merged commit 9e281eb into develop Jan 13, 2025
2 of 4 checks passed
@gamalielhere gamalielhere deleted the devop/amplitude-for-new-network-ui branch January 13, 2025 18:50
This was referenced Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants