Provenance
Alerting

Subscriber Alerts

Monitor notification subscriber health with threshold-based alerts on delivery metrics.

Subscriber Alerts monitor the health of your notification subscribers. They track delivery metrics — failure rate, failure count, success rate, and total volume — and fire when a threshold is breached.

Overview

Every time a notification is processed, the result (success or error) is logged in the audits table. Subscriber alerts query these audit records over a configurable time window and compare the result against a threshold.

When a subscriber alert fires, it creates a provenance interaction — which means it can trigger downstream notification subscriptions just like any other interaction.

How it works

Notification processed → Audit record created (success/error)

            POST /api/alerts/process (cron or manual)

            For each active alert:
              1. Query audits for subscriber within time window
              2. Calculate metric (failure_rate, success_rate, etc.)
              3. Compare against threshold
              4. If exceeded → create interaction

Creating a subscriber alert

POST /api/alerts
{
  "subscriberId": "uuid",
  "name": "High Failure Rate — SendGrid",
  "metric_type": "failure_rate",
  "condition": ">",
  "threshold": 10,
  "time_window": "1h",
  "severity": "critical",
  "resourceTypeId": "uuid",
  "actionId": "uuid"
}

Fields

FieldRequiredDescription
subscriberIdYesThe subscriber to monitor
nameYesHuman-readable alert name
metric_typeYesWhat to measure (see below)
conditionYesComparison operator
thresholdYesNumeric threshold value
time_windowYesLookback window for metric calculation
severityYesAlert severity level
resourceTypeIdNoResource type for the alert interaction (defaults to system ALERT type)
actionIdNoAction for the alert interaction (defaults to system ALERTTRIG action)

Metric types

MetricDescriptionUnit
failure_ratePercentage of failed notifications% (0–100)
failure_countAbsolute number of failurescount
success_ratePercentage of successful notifications% (0–100)
total_countTotal notifications processedcount

Conditions

OperatorMeaning
>Greater than
<Less than
>=Greater than or equal
<=Less than or equal
==Equal to

Time window format

FormatExampleMeaning
{n}m5m5 minutes
{n}h1h1 hour
{n}d7d7 days

Severity levels

  • info — informational, no action needed
  • warning — something to watch
  • critical — immediate attention required

Alert interaction data

When a subscriber alert fires, it creates an interaction with this structure in the interaction JSON field:

{
  "alert": {
    "subscriberAlertId": "uuid",
    "name": "High Failure Rate — SendGrid",
    "severity": "critical",
    "metric_type": "failure_rate",
    "condition": ">",
    "threshold": 10,
    "time_window": "1h",
    "triggered_at": "2026-03-20T14:30:00.000Z"
  },
  "subscriber": {
    "subscriberId": "uuid",
    "subscriberName": "SendGrid",
    "subscriberArn": "adapter:email"
  },
  "metrics": {
    "current_value": 15.5,
    "total_count": 200,
    "success_count": 169,
    "failure_count": 31,
    "success_rate": 84.5,
    "failure_rate": 15.5
  }
}

The interaction is created with:

FieldValue
resourceIdalert-{subscriberId}-{metric_type}
resourceTypeIdAlert's configured resource type, or system ALERT type
actionIdAlert's configured action, or system ALERTTRIG action
originIdSystem ALERTING origin
externalReferencealert-{subscriberAlertId}
uowIdAuto-generated UUID

System entities required

Subscriber alerts require these system entities to exist:

EntityMnemonicPurpose
Resource TypeALERTDefault resource type for alert interactions
ActionALERTTRIGDefault action for alert interactions
OriginALERTINGOrigin for all subscriber alert interactions

If these don't exist, alert processing will fail with Missing required default alert resource type, action, or origin.

Processing alerts

Alerts are evaluated on demand — either manually or via a cron job.

Manual evaluation

POST /api/alerts/process

Returns:

{
  "processed": 5,
  "results": [
    {
      "subscriberAlertId": "uuid",
      "triggered": true,
      "interactionId": "uuid",
      "currentValue": 15.5,
      "threshold": 10
    },
    {
      "subscriberAlertId": "uuid",
      "triggered": false,
      "currentValue": 2.1,
      "threshold": 10
    }
  ]
}

Cron job

# Evaluate every minute
* * * * * curl -X POST https://your-api.com/api/alerts/process \
  -H "x-api-key: your-key"

Check individual alert status

GET /api/alerts/:alertId/firing

Returns:

{
  "isFiring": true,
  "currentValue": 15.5,
  "threshold": 10,
  "condition": ">",
  "metric_type": "failure_rate"
}

API reference

MethodEndpointDescription
GET/api/alertsList all subscriber alerts
GET/api/alerts/:idGet alert by ID
POST/api/alertsCreate alert
PUT/api/alerts/:idUpdate alert
DELETE/api/alerts/:idDelete alert
POST/api/alerts/processEvaluate all active alerts
GET/api/alerts/:id/firingCheck if alert is currently firing

Example: Alert on SendGrid failures

# 1. Create the alert
POST /api/alerts
{
  "subscriberId": "sendgrid-subscriber-uuid",
  "name": "SendGrid failure rate > 5%",
  "metric_type": "failure_rate",
  "condition": ">",
  "threshold": 5,
  "time_window": "1h",
  "severity": "warning"
}

# 2. Process alerts (or set up cron)
POST /api/alerts/process

# 3. Check status
GET /api/alerts/{alertId}/firing