|
| 1 | +# Performance Alert |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +Performance alerts can be created in Sentry to get notified in case a given performance metric regresses over time. |
| 6 | + |
| 7 | +## Choose the trace you want to monitor |
| 8 | + |
| 9 | +The performance metric needed to monitor the performance of a given user flow can be tracked by adding a performance trace to the codebase (or by using an existing trace if one already exists). More details on performance tracing can be found [here](./performance-tracing.md). |
| 10 | + |
| 11 | +## Create a new alert |
| 12 | + |
| 13 | +Go to [Sentry alerts page](https://metamask.sentry.io/alerts/rules/). |
| 14 | + |
| 15 | +Click on "Create Alert". |
| 16 | + |
| 17 | +Select the `Performance > Transaction duration` as alert type. |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | +Click on "Set Conditions". |
| 22 | + |
| 23 | +### 1. Define your metric |
| 24 | + |
| 25 | +Leave this section unchanged, except the `p95` that you can change into `p75`. |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | +### 2. Filter events |
| 30 | + |
| 31 | +Indicate the name of the project: |
| 32 | + |
| 33 | +- Choose `metamask` project for Extension |
| 34 | +- Choose `metamask-mobile` project for Mobile |
| 35 | + |
| 36 | +Indicate the name of the environment: `production`. |
| 37 | + |
| 38 | +For Extension, use the following query format: |
| 39 | + |
| 40 | +``` |
| 41 | +transaction:"name-of-the-trace" |
| 42 | +``` |
| 43 | + |
| 44 | +For Mobile, if you want to filter for iOS metrics only, use the following query format: |
| 45 | + |
| 46 | +``` |
| 47 | +transaction:"name-of-the-trace" release.package:io.metamask.MetaMask |
| 48 | +``` |
| 49 | + |
| 50 | +For Mobile, if you want to filter for Android metrics only, use the following query format: |
| 51 | + |
| 52 | +``` |
| 53 | +transaction:"name-of-the-trace" release.package:io.metamask |
| 54 | +``` |
| 55 | + |
| 56 | +Example filter: |
| 57 | + |
| 58 | +``` |
| 59 | +transaction:"UI Startup" release.package:io.metamask.MetaMask |
| 60 | +``` |
| 61 | + |
| 62 | +### 3. Set thresholds |
| 63 | + |
| 64 | +Select the following options: |
| 65 | + |
| 66 | +- Type: `Anomaly` |
| 67 | +- Level of responsiveness `Medium` |
| 68 | +- Direction of anomaly movement: `Above bounds only` |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | +### 4. Set actions |
| 73 | + |
| 74 | +Click on "Add Action". |
| 75 | + |
| 76 | +Select the following options: |
| 77 | + |
| 78 | +- Action type: `Critical Status` |
| 79 | +- Channel type: `Slack - Consensys` |
| 80 | +- Slack channel name: `#your-slack-channel-name` (Example: #metamask-your-team-name-release-monitoring) |
| 81 | +- Slack channel ID: `your-slack-channel-id` (Example: C085BL3Z04J) |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | +PS: We recommend that you create a Slack channel called #metamask-your-team-name-release-monitoring, specifically for these Sentry alerts. |
| 86 | +PSS: Here's an [article](https://zeroheight.com/help/article/retrieving-a-slack-channel-id-from-slack/) explaining how to retrieve the ID of a Slack channel. |
| 87 | + |
| 88 | +### 5. Establish ownership |
| 89 | + |
| 90 | +Choose a self explanatory name for your alert, like: `Anomaly - name-of-the-trace (type-of-application)`. |
| 91 | + |
| 92 | +Example: `Anomaly - UI Startup (iOS)` or `Anomaly - UI Startup (Android)` |
| 93 | + |
| 94 | +Select `#metamask`. |
| 95 | + |
| 96 | +Click on "Save Rule". |
| 97 | + |
| 98 | +That's it. Your performance alert is now configured and will post messages to the Slack channel you chose. |
| 99 | + |
| 100 | + |
0 commit comments