Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Telemetry HQ

Central alerting endpoint for AnswerLayer BYOC deployments. Receives CloudWatch alarm notifications via SNS and forwards to Slack.

Architecture

Customer Account                         Your Infrastructure
┌─────────────────────┐                  ┌─────────────────────┐
│ CloudWatch Alarm    │                  │ Cloudflare Worker   │
│        ↓            │                  │   (telemetry-hq)    │
│    SNS Topic        │ ──── HTTPS ────→ │        ↓            │
│        ↓            │                  │     Slack           │
│  HTTPS Subscription │                  └─────────────────────┘
└─────────────────────┘

Setup

1. Install dependencies

npm install

2. Set secrets

# Slack incoming webhook URL
wrangler secret put SLACK_WEBHOOK_URL

3. Deploy

npm run deploy

4. Configure custom domain (optional)

In Cloudflare dashboard:

  1. Go to Workers & Pages → telemetry-hq → Settings → Triggers
  2. Add Custom Domain: alerts.answerlayer.com

5. Set endpoint URL in Nuon

nuon apps variables create --name alerts_endpoint_url \
  --value "https://alerts.answerlayer.com/sns"

Endpoints

Path Method Description
/sns POST SNS notification receiver
/health GET Health check

Local development

# Create .dev.vars with secrets
echo 'SLACK_WEBHOOK_URL="https://hooks.slack.com/services/..."' > .dev.vars

# Start dev server
npm run dev

SNS Message Flow

  1. Subscription Confirmation: When SNS subscription is created, SNS sends a confirmation request. The worker automatically confirms by fetching the SubscribeURL.

  2. Notifications: CloudWatch alarms trigger SNS notifications. The worker parses the alarm details and posts a formatted message to Slack.

Slack Message Format

🚨 answerlayer-high-5xx-rate
State: ALARM

Account: 123456789012 | Region: us-east-1

┌─────────────────────────────────────────┐
│ Threshold crossed: 15 > 10 for 2 periods│
└─────────────────────────────────────────┘

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages