Skip to content

Commit 12445a5

Browse files
authored
Update alerts documentation (#307)
1 parent 792740e commit 12445a5

File tree

1 file changed

+57
-137
lines changed

1 file changed

+57
-137
lines changed

usage/tools/monitoring-and-alerting.mdx

Lines changed: 57 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ You can monitor activity and alert on issues and usage for your PowerSync Cloud
99

1010
* **Monitor Service and Replication Activity**: Track your PowerSync Service and replication logs with [Instance Logs](#instance-logs)
1111

12-
* **Configure Alerts**: Set up alerts for replication issues or usage activity \*
12+
* **Configure Alerts**: Set up alerts for connection or replication issues or usage activity \*
1313

1414
* Includes [Issue Alerts](#issue-alerts) and/or [Usage Alerts](#usage-alerts)
1515

@@ -108,7 +108,7 @@ You can manage logs with the following options:
108108

109109
## Issue Alerts
110110

111-
Issue alerts capture potential problems with your instance, such as connection or sync issues.
111+
Issue alerts capture potential problems with your instance, such as connection or replication issues.
112112

113113
<Note>
114114
**Availability**
@@ -118,41 +118,27 @@ Issue alerts capture potential problems with your instance, such as connection o
118118

119119
### Configure Issue Alerts
120120

121-
<Note>
122-
Issue alerts configuration is currently available in the [legacy dashboard](https://powersync.journeyapps.com/). This feature will be available in the new dashboard soon.
123-
</Note>
124-
125-
Issue alerts are set up per instance. To set up a new alert, navigate to your **PowerSync Project tree**, right-click on the "Issue Alerts" option under the selected instance, and follow the prompts.
126-
127-
<Frame>
128-
<img src="/images/resources/instance-alerts-dashboard.png" width="50%" />
129-
</Frame>
130-
131-
You can set up alerts that trigger under certain conditions:
132-
133-
* **Connection Issues**: Trigger when there is a connection problem
121+
Issue alerts are set up per instance. To set up a new alert, navigate to the **Alerts** section in the [PowerSync Dashboard](https://dashboard.powersync.com/) and click **Create Issue Alert**.
134122

135-
* **Replication/Sync Issues**: Trigger when there is an issue with a replication or sync process
123+
When creating or editing an issue alert, you can configure:
136124

137-
#### Severity Level
125+
* **Alert Name**: Give your alert a descriptive name to help identify it
138126

139-
You also have the option to set the severity level of the alerts. For example, you can configure alerts to trigger only for `warning` and/or `fatal` issues. Free and Pro plan customers can only configure `fatal` alerts.
127+
* **Issue Type**: Select the type of issue to monitor from the dropdown:
128+
* **Database Connection Issue**: Trigger when there is a connection problem
129+
* **Replication Issue**: Trigger when there is an issue with the replication process
140130

141-
### View Issue Alerts
131+
* **Severity Levels**: Choose which severity levels should trigger this alert:
132+
* **Warning**: For non-critical issues
133+
* **Fatal**: For critical issues that require immediate attention
142134

143-
<Note>
144-
Viewing issue alerts is currently available in the [legacy dashboard](https://powersync.journeyapps.com/). This feature will be available in the new dashboard soon.
145-
</Note>
146135

147-
Once you have created an alert, you can right-click on it to open the alert logs. The logs panel includes the option to filter alerts by date range.
148-
149-
<Frame>
150-
<img src="/images/resources/view-issue-alert-logs-cmd.png" />
151-
</Frame>
152136

153-
### **Configure Notifications**
137+
<Warning>
138+
**Important: Set Up Notification Rules**
154139

155-
See [Alert Notifications](#alert-notifications) below to be notified when an issue alert is triggered.
140+
Creating an issue alert only defines *what* to monitor. To actually receive notifications when alerts trigger, you must also set up [Email Rules](#email-notifications) or [Webhooks](#webhooks) and configure them to notify for "Issue alert state change" events. See the [Alert Notifications](#alert-notifications) section below.
141+
</Warning>
156142

157143
## Usage Alerts
158144

@@ -166,26 +152,14 @@ Usage alerts trigger when specific usage metrics exceed a defined threshold. Thi
166152

167153
### Configure Usage Alerts
168154

169-
<Note>
170-
Usage alerts configuration is currently available in the [legacy dashboard](https://powersync.journeyapps.com/). This feature will be available in the new dashboard soon.
171-
</Note>
155+
Usage alerts are set up per instance. Navigate to the **Alerts** section in the [PowerSync Dashboard](https://dashboard.powersync.com/) and click **Create Usage Alert**.
172156

173-
Usage alerts are set up per instance. Navigate to your **PowerSync Project** tree, and click on the plus icon for the **Usage Alerts** option under your selected instance to create a new alert.
174157

175-
<Frame>
176-
<img src="/images/resources/instance-alerts-dashboard.png" width="50%" />
177-
</Frame>
178-
179-
Usage alerts have the following configuration options:
180-
181-
<Frame>
182-
<img src="/images/resources/usage-alert-config.png" width="75%" />
183-
</Frame>
158+
When creating or editing a usage alert, you can configure:
184159

185-
* **Alert Name**: A descriptive name for your alert to help identify it
160+
* **Alert Name**: Give your alert a descriptive name to help identify it
186161

187162
* **Metric**: Select from the following usage metrics to monitor:
188-
189163
* Data Synced
190164
* Data Replicated
191165
* Operations Synced
@@ -197,141 +171,94 @@ Usage alerts have the following configuration options:
197171
These metrics correspond to the data shown in the [Usage Metrics](#view-usage-metrics) workspace and align with the PowerSync Service parameters outlined in our [pricing](https://www.powersync.com/pricing).
198172
</Note>
199173

200-
* **Window (minutes)**: The number of minutes to look back when evaluating usage. All usage data points within this time window are included when determining if the configured threshold has been crossed
174+
* **Window**: The number of minutes to look back when evaluating usage. All usage data points within this time window are included when determining if the configured threshold has been crossed
201175

202-
* **Calculation**: Choose how to aggregate all data points within the window before comparing to the threshold:
176+
* **Aggregation**: Choose how to aggregate all data points within the window before comparing to the threshold:
177+
* **Avg**: Calculate the average of all values
178+
* **Max**: Use the highest value
179+
* **Min**: Use the lowest value
203180

204-
* **Average over window**: Calculate the average of all values
205-
* **Max over window**: Use the highest value
206-
* **Min over window**: Use the lowest value
181+
* **Condition**: Set whether the alert triggers when usage goes **Above** or **Below** the specified threshold
207182

208-
* **Threshold Condition**: Set whether the alert triggers when usage goes **Above** or **Below** the specified value
183+
* **Threshold Value**: The numeric limit for the selected metric (in bytes for size-based metrics; count for all other metrics)
209184

210-
* **Threshold Value**: The numeric limit for the selected metric (in bytes for size-based metrics; count for all others)
211185

212-
### View Usage Alert Logs
186+
<Warning>
187+
**Important: Set Up Notification Rules**
213188

214-
<Note>
215-
Viewing usage alert logs is currently available in the [legacy dashboard](https://powersync.journeyapps.com/). This feature will be available in the new dashboard soon.
216-
</Note>
217-
218-
Once you have created an alert, you can right-click on it to open the alert logs. The logs panel includes the option to filter alerts by date range.
219-
<Frame>
220-
<img src="/images/resources/view-usage-alert-logs-cmd.png" />
221-
</Frame>
222-
223-
### **Configure Notifications**
224-
225-
See [Alert Notifications](#alert-notifications) below to be notified when a usage alert is triggered.
189+
Creating a usage alert only defines *what* to monitor. To actually receive notifications when alerts trigger, you must also set up [Email Rules](#email-notifications) or [Webhooks](#webhooks) and configure them to notify for "Usage alert state change" events. See the [Alert Notifications](#alert-notifications) section below.
190+
</Warning>
226191

227192
## Alert Notifications
228193

229-
You can set up notifications to be informed of issue or metric alerts, as well as deploy state changes. PowerSync provides multiple notification methods that trigger both when an alert becomes active and when it returns to normal (indicating the monitored conditions are back within acceptable thresholds).
194+
Set up notification rules to be informed of issue or usage alerts, as well as deploy state changes. PowerSync provides multiple notification methods that trigger both when an alert becomes active and when it returns to normal (indicating the monitored conditions are back within acceptable thresholds).
230195

231-
* **Email Notifications**: Send alerts directly to your email address
196+
* **Email Rules**: Send alerts directly to your email address
232197
* **Webhooks**: Notify external systems and services
233198

234199
<Note>
235200
**Availability**
236201

237-
* **Email notifications**: Available on all plans (**Free**, **Pro**, **Team** and **Enterprise**)
202+
* **Email Rules**: Available on all plans (**Free**, **Pro**, **Team** and **Enterprise**)
238203

239204
* **Webhooks**: Available on **Pro**, **Team** and **Enterprise** plans
240205
</Note>
241206

242-
### Email Notifications
207+
### Email Rules
243208

244-
Email notifications allow you to receive alerts directly to your email address when specific events occur in PowerSync.
209+
Email rules allow you to receive alerts directly to your email address when specific events occur in PowerSync.
245210

246-
#### Set Up Email Notifications
211+
#### Set Up Email Rules
247212

248-
<Note>
249-
Email rules configuration is currently available in the [legacy dashboard](https://powersync.journeyapps.com/). This feature will be available in the new dashboard soon.
250-
</Note>
213+
Navigate to the **Alerts** section in the [PowerSync Dashboard](https://dashboard.powersync.com/) and scroll down to the **Notification Rules** section. Click **Create Email Rule** to set up email notifications.
251214

252-
Navigate to the **Email Rules** section in your **PowerSync Project** tree, and click on the plus icon to create a new email rule for your project.
253-
254-
<Info>
215+
<Warning>
255216
Accounts on the Free plan are restricted to a single email rule; customers on paid plans can create an unlimited number of email rules.
256-
</Info>
257-
258-
<Frame>
259-
<img src="/images/resources/instance-alerts-dashboard.png" width="50%" />
260-
</Frame>
217+
</Warning>
261218

262-
#### Configuration
219+
When creating or editing an email rule, you can configure:
263220

264-
* **Email Address**: Specify the email address that will receive the notifications
221+
* **Recipient Email**: Specify the email address that will receive the notifications (required)
265222

266223
* **Event Triggers**: Select one or more of the following events to trigger the email notification:
224+
* **Usage alert state change**: Fired when a usage alert changes between 'monitoring' and 'alerting' (a threshold has been crossed)
225+
* **Issue alert state change**: Fired when an issue alert changes between 'monitoring' and 'alerting' (the instance has active issues)
226+
* **Deploy state change**: Fired when an instance deploy starts, completes or fails. This includes deprovisioning an instance
267227

268-
* Issue alert state change
269-
270-
* Usage alert state change (Team & Enterprise plan only)
271-
272-
* Deploy state change
228+
* **Enabled**: Toggle to control whether the email rule is active
273229

274-
* **Enable/Disable**: Control whether the email rule is active
275230

276231
### Webhooks
277232

278233
Webhooks enable you to notify external systems when specific events occur in PowerSync.
279234

280235
#### Set Up Webhooks
281236

282-
<Note>
283-
Webhook configuration is currently available in the [legacy dashboard](https://powersync.journeyapps.com/). This feature will be available in the new dashboard soon.
284-
</Note>
237+
Navigate to the **Alerts** section in the [PowerSync Dashboard](https://dashboard.powersync.com/) and scroll down to the **Notification Rules** section. Click **Create Webhook Rule** to set up webhook notifications.
285238

286-
Navigate to the **Webhooks** section in your **PowerSync Project** tree, and click on the plus icon to create a new webhook for your project.
239+
When creating or editing a webhook rule, you can configure:
287240

288-
<Frame>
289-
<img src="/images/resources/instance-alerts-dashboard.png" width="50%" />
290-
</Frame>
291-
292-
#### Webhook Configuration
293-
294-
* **Specify Webhook Endpoint**: Define the endpoint that will receive the webhook request (starting with `https://`).
241+
* **Webhook Endpoint (URL)**: Define the endpoint that will receive the webhook request (starting with `https://`) (required)
295242

296243
* **Event Triggers**: Select one or more of the following events to trigger the webhook:
244+
* **Usage alert state change**: Fired when a usage alert changes between 'monitoring' and 'alerting' (a threshold has been crossed)
245+
* **Issue alert state change**: Fired when an issue alert changes between 'monitoring' and 'alerting' (the instance has active issues)
246+
* **Deploy state change**: Fired when an instance deploy starts, completes or fails. This includes deprovisioning an instance
297247

298-
* Issue alert state change
299-
300-
* Usage alert state change (Team & Enterprise plan only)
248+
* **Enabled**: Toggle to control whether the webhook rule is active
301249

302-
* Deploy state change
250+
* **Retries**: Configure the number of retry attempts for failed webhook deliveries
303251

304-
You can control how webhooks operate:
305252

306-
* Enable, disable, or pause a webhook
253+
<Check>
254+
After creating a webhook, a secret is automatically generated and copied to your clipboard. Store this secret since you'll need it to verify the webhook request signature.
255+
</Check>
307256

308-
* If paused, invocations can still be generated and queued, but they won't be processed
309-
310-
* If disabled, invocations won't be generated
311-
312-
* Choose sequential or concurrent execution
313-
314-
* If concurrent, you can set the maximum number of concurrent invocations
315-
316-
* Configure retry attempts for failed webhook deliveries
317-
318-
#### Webhook Secret
319-
320-
After creating a webhook, a secret is automatically generated and copied to your clipboard. Store this secret since you'll need it to verify the webhook request signature. See [Webhook Signature Verification](#webhook-signature-verification)
321-
322-
#### Test Webhooks
323-
324-
A test webhook can be sent to your specified endpoint to verify your setup. Right-click on a webhook in the **PowerSync project** tree and select the **Test Webhook** option:
325-
326-
<Frame>
327-
<img src="/images/resources/test-webhook-cmd.png" />
328-
</Frame>
329-
330-
#### Webhook Signature Verification
257+
### Webhook Signature Verification
331258

332259
Every webhook request contains an `x-journey-signature` header, which is a base64-encoded HMAC (Hash-based Message Authentication Code). To verify the request, you need to compute the HMAC using the shared secret that was generated when you created the webhook, and compare it to the value in the `x-journey-signature` header.
333260

334-
**JavaScript Example**
261+
**JavaScript Example:**
335262

336263
```javascript
337264
import { createHmac } from 'crypto';
@@ -352,10 +279,3 @@ if (signature === verify) {
352279
}
353280
```
354281

355-
#### Regenerate Secret
356-
357-
You can regenerate the secret used to validate the webhook signature. Right-click on a webhook in the PowerSync project tree and select the **Regenerate secret** option.
358-
359-
#### View Webhook Invocation Logs
360-
361-
You can review webhook invocation logs in the Dashboard and filter them by date. Right-click on a webhook in the **PowerSync project** tree and select the **View webhook invocation logs** option.

0 commit comments

Comments
 (0)