You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Implement client pooling for Webhook-based notifiers (#281)
* feat: Move generic client storage to a separate module
* feat: Add NotificationClientPool for managing HTTP clients in notifications
* test: Add unit tests for NotificationClientPool functionality
* feat: Extend NotificationClientPool to manage SMTP clients and improve error handling
* feat: make HTTP retry configuration serializable
* feat: add retry policy to TriggerTypeConfig and update related tests
* feat: add retry policy to TriggerTypeConfig and update related notification implementations
* feat: add client pool to NotificationService
* chore: formatting
* feat: add default serde attribute to retry_policy in TriggerTypeConfig variants
* fix: minor
* feat: refactor notification services to use a shared HTTP client
* feat: update WebhookNotifier to use a retryable HTTP client with TransientErrorRetryStrategy
* test: update integration tests to include retryable and non-retryable error scenarios
* feat: update TelegramNotifier to use POST method and JSON payload for webhook notifications
* minor
* feat: refactor EmailNotifier to accept an SMTP client and update notification service to use client pool
* feat: update NotificationClientPool to use ClientWithMiddleware
* test: refactor test to use test http client helpers
* feat: enhance SmtpConfig with additional traits and implement SMTP client creation in NotificationClientPool
* test: adjust error context assertions and add additional test
* test: add missing tests
* test: update retry expectations in notification tests to use dynamic retry count
* refactor: improve documentation for HTTP and SMTP client methods in NotificationClientPool
* minor
* refactor: remove unnecessary WebhookPayload struct and simplify payload handling
* test: remove redundant test
* Update src/services/notification/mod.rs
Co-authored-by: Nicolas Molina <[email protected]>
* refactor: improve error message for missing retry policy in trigger configuration
* fix: pass source error to trigger execution error
* docs: update notification protocols section
* docs: clarify base_for_backoff parameter description in retry policy
---------
Co-authored-by: Nicolas Molina <[email protected]>
** **HTTPS Required:** The API endpoint uses HTTPS.
232
+
** Authentication is handled via the **Bot Token** in the URL. Keep this token secure.
233
+
* **Formatting:** Messages are sent with `parse_mode` set to `MarkdownV2`. Special characters in the message title and body are automatically escaped to prevent formatting errors.
234
+
213
235
====== Email Notifications
214
236
* *Secure Ports Recommended*: The following ports are considered secure:
215
237
** 465: SMTPS (SMTP over SSL)
@@ -218,19 +240,27 @@ The monitor implements protocol security validations across different components
218
240
* *Warning*: Using other ports will trigger security warnings
219
241
* *Valid Format*: Email addresses must follow RFC 5322 format
220
242
221
-
====== Webhook Notifications
222
-
* *HTTPS Recommended*: URLs should use HTTPS protocol
223
-
* *Authentication Recommended*: Including either:
224
-
** `X-API-Key` header
225
-
** `Authorization` header
226
-
* *Optional Secret*: Can include a secret for HMAC authentication
227
-
** When a secret is provided, the monitor will:
228
-
*** Generate a timestamp in milliseconds
229
-
*** Create an HMAC-SHA256 signature of the payload and timestamp
230
-
*** Add the signature in the `X-Signature` header
231
-
*** Add the timestamp in the `X-Timestamp` header
232
-
** The signature is computed as: `HMAC-SHA256(secret, payload + timestamp)`
233
-
* *Warning*: Non-HTTPS URLs or missing authentication headers will trigger security warnings
243
+
====== Notifcations Retry Policy
244
+
245
+
Following notification protocols support retry policies:
246
+
247
+
* Slack
248
+
* Discord
249
+
* Telegram
250
+
* Webhook
251
+
252
+
Default retry policy is using exponential backoff with the following parameters:
253
+
[cols="1,1,1"]
254
+
|===
255
+
| Parameter | Default Value | Description
256
+
| `max_retries` | `3` | Maximum number of retries before giving up
257
+
| `base_for_backoff` | `2` | Base duration for exponential backoff calculations in seconds
258
+
| `initial_backoff` | `250` | Initial backoff duration in milliseconds
259
+
| `max_backoff` | `10` | Maximum backoff duration in seconds
260
+
| `jitter` | `Full` | Jitter strategy to apply to the backoff duration, currently supports `Full` and `None`
261
+
|===
262
+
263
+
These parameters can be overridden by providing custom `HttpRetryConfig` struct in `retry_policy` field in trigger configuration.
0 commit comments