⚠️ USER SETUP REQUIRED: Axiom & Slack Configuration
Status: Task 2.1 (Axiom Integration) code is complete, but requires user configuration before it can function.
Estimated Time: 15 minutes
What Was Implemented (Task 2.1)
✅ Completed:
- Axiom SDK installed (
@axiomhq/js) - Environment variable validation (
lib/env.ts) - Axiom integration module (
lib/observability/axiom.ts) - Performance metric export (
lib/performance/metrics.ts) - Circuit breaker event streaming (
lib/resilience/telemetry.ts) - Scheduled cron job (
app/api/cron/export-metrics/route.ts) - Vercel cron configuration (
vercel.json)
✅ Verification:
- Type-check: PASSED (0 errors)
- Tests: 540/540 passing
- Build: Successful
What YOU Need to Do (15 minutes)
Step 1: Create Axiom Account (~5 minutes)
Why: Axiom stores performance metrics and circuit breaker events in production.
Instructions:
- Go to https://axiom.co
- Click "Sign Up" (choose free tier)
- Create account with email/password or GitHub
- Verify email if required
After Sign Up:
- Create a new dataset:
- Click "Datasets" in sidebar
- Click "Create Dataset"
- Name:
kingston-care-production -
Click "Create"
-
Generate API token:
- Click "Settings" (gear icon)
- Go to "API Tokens" tab
- Click "Create API Token"
- Name:
kingston-care-production-token - Permissions: Select "Ingest" and "Query"
- Click "Create Token"
- IMPORTANT: Copy the token immediately (starts with
xait-) -
Save it securely (you won't be able to see it again)
-
Note your Organization ID:
- Still in Settings
- Look for "Organization ID" near the top
- Copy this value (it's a short alphanumeric string)
Step 2: Create Slack Webhook (~5 minutes)
Why: Slack receives critical alerts (circuit breaker opens, high error rates).
Instructions:
- Go to https://slack.com/apps/A0F7XDUAZ-incoming-webhooks
- Click "Add to Slack" (or "Add Configuration" if already installed)
- Select the channel for alerts:
- Recommended: Create a new channel called
#kingston-care-alerts - Alternative: Use existing channel like
#alertsor#monitoring - Click "Add Incoming WebHooks integration"
- Copy the Webhook URL (starts with
https://hooks.slack.com/services/) - Example:
https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXX - (Optional) Customize the webhook:
- Name:
CareConnect - Icon: Choose an icon or emoji
- Click "Save Settings"
Test the Webhook (Optional):
curl -X POST "YOUR_WEBHOOK_URL_HERE" \
-H "Content-Type: application/json" \
-d '{"text":"Test alert from CareConnect setup"}'
You should see a message appear in your Slack channel immediately.
Step 3: Generate Cron Secret (~1 minute)
Why: Secures the cron endpoint so only Vercel can trigger metric exports.
Instructions:
Copy the output (long random string, ~44 characters)
Step 4: Add Environment Variables (~4 minutes)
Local Development (.env.local):
Create or update .env.local with these values:
# Axiom Observability (v18.0 Phase 2)
AXIOM_TOKEN=xait-xxxx-xxxx-xxxx-xxxx-xxxx
AXIOM_ORG_ID=your-org-id-here
AXIOM_DATASET=kingston-care-production
# Slack Integration (v18.0 Phase 2)
SLACK_WEBHOOK_URL=https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXX
# Cron Job Authentication (v18.0 Phase 2)
CRON_SECRET=your-random-secret-from-step-3
Replace:
xait-xxxx...with your actual Axiom API token from Step 1your-org-id-herewith your Axiom Organization ID from Step 1https://hooks.slack.com/...with your Slack webhook URL from Step 2your-random-secret...with the output from Step 3
Step 5: Add to Vercel (Production)
When deploying to production:
- Go to Vercel Dashboard → Your Project → Settings → Environment Variables
- Add each variable:
AXIOM_TOKEN=xait-xxxx...(Production)AXIOM_ORG_ID=your-org-id(Production)AXIOM_DATASET=kingston-care-production(Production)SLACK_WEBHOOK_URL=https://hooks.slack.com/...(Production)-
CRON_SECRET=your-random-secret(Production) -
Redeploy the application for changes to take effect
Verification
Test Local Setup (Development)
Note: Axiom integration is production-only, so local testing is limited.
1. Verify environment variables are loaded:
2. Test Slack webhook manually:
curl -X POST "$SLACK_WEBHOOK_URL" \
-H "Content-Type: application/json" \
-d '{"text":"🧪 Test from CareConnect local dev"}'
Expected: Message appears in Slack channel
3. Test cron endpoint:
# Start dev server in one terminal
npm run dev
# In another terminal:
curl -H "Authorization: Bearer $CRON_SECRET" \
http://localhost:3000/api/cron/export-metrics
Expected response:
Test Production Setup (After Deployment)
1. Verify Axiom is receiving events:
- Deploy to Vercel with environment variables
- Wait for cron job to run (every hour at :00)
- Go to Axiom dashboard → Datasets →
kingston-care-production - Check for recent events (type:
performance,health_check)
2. Verify Slack alerts:
- Trigger a circuit breaker open (simulate database failure)
- Check Slack channel for alert
- Should receive message within 30 seconds
3. Check Vercel cron logs:
- Go to Vercel Dashboard → Your Project → Logs
- Filter by
/api/cron/export-metrics - Verify executions every hour
- Check for errors
Troubleshooting
Issue: "Axiom credentials missing" warning
Cause: Environment variables not set or incorrect
Fix:
- Check
.env.localhas all three Axiom variables - Restart dev server after adding env vars
- Verify no typos in variable names (must match exactly)
Issue: Slack webhook returns 404 or 401
Cause: Webhook URL incorrect or webhook deleted
Fix:
- Go back to Slack incoming webhooks page
- Verify webhook is still active
- Copy URL again (may have changed)
- Update
SLACK_WEBHOOK_URLin env vars
Issue: Cron job returns 401 Unauthorized
Cause: CRON_SECRET mismatch or not set
Fix:
- Verify
CRON_SECRETis set in Vercel environment variables - Regenerate secret:
openssl rand -base64 32 - Update both local and Vercel env vars
- Redeploy
Issue: No metrics appearing in Axiom
Possible Causes:
- Production guard: Axiom only sends in production (
NODE_ENV=production) - Cron not running: Check Vercel cron logs
- API token expired: Regenerate in Axiom settings
- Dataset name mismatch: Verify
AXIOM_DATASETmatches dataset in Axiom
Fix:
- Check Vercel logs for errors
- Verify
NODE_ENV=productionin Vercel - Check Axiom API token is valid
- Test cron endpoint manually with correct auth header
Next Steps
After completing setup:
✅ You're ready for Task 2.2: Observability Dashboard
The dashboard will display:
- Circuit breaker status (current state, failure count)
- Performance metrics (p50/p95/p99 latency)
- System health summary
When ready to continue:
- Confirm environment variables are set
- Verify Axiom account is active
- Verify Slack webhook works
- Proceed to Task 2.2 implementation
Summary
What You Did:
- ✅ Created Axiom account and dataset
- ✅ Generated Axiom API token
- ✅ Created Slack webhook
- ✅ Generated cron secret
- ✅ Added environment variables to
.env.local - ✅ (Optional) Added environment variables to Vercel
What's Working:
- Axiom SDK integrated and ready to send metrics
- Slack webhook ready to receive alerts
- Cron job ready to export metrics hourly
- Circuit breaker events will stream to Axiom in production
What's Next:
- Task 2.2: Build observability dashboard UI
- Task 2.3: Configure alerting logic
- Task 2.4: Write operational runbooks
Setup Time: ~15 minutes Completion: When all 5 steps done and verified Status: ⏸️ WAITING FOR USER SETUP