Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Set up Customer.io monitoring and observability. Use when implementing metrics, structured logging, alerting, or Grafana dashboards for Customer.io integrations. Trigger: "customer.io monitoring", "customer.io metrics", "customer.io dashboard", "customer.io alerts", "customer.io observability".
.claude/skills/jeremylongshore-customerio-observability/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-22 | ✗→✓ | ▲ Improved | 103% | 0% |
| case-01 | ✗→✓ | ▲ Improved | 67% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 68% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 82% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 157% | 0% |
Implement comprehensive observability for Customer.io integrations: Prometheus metrics (latency, error rates, delivery funnel), structured JSON logging with PII redaction, OpenTelemetry tracing, and Grafana dashboard definitions.
| Metric | Type | Description | Alert Threshold | |--------|------|-------------|----------------| | cio_api_duration_ms | Histogram | API call latency | p99 > 5000ms | | cio_api_requests_total | Counter | Total API requests by operation | N/A (rate) | | cio_api_errors_total | Counter | API errors by status code | > 1% error rate | | cio_email_sent_total | Counter | Transactional + campaign emails | N/A | | cio_email_bounced_total | Counter | Bounce count | > 5% of sends | | cio_email_complained_total | Counter | Spam complaints | > 0.1% of sends | | cio_webhook_received_total | Counter | Webhook events by metric type | N/A | | cio_queue_depth | Gauge | Pending items in event queue | > 10K |
typescript// lib/customerio-metrics.ts import { Counter, Histogram, Gauge, Registry } from "prom-client"; const registry = new Registry(); export const cioMetrics = { apiDuration: new Histogram({ name: "cio_api_duration_ms", help: "Customer.io API call duration in milliseconds", labelNames: ["operation", "status"] as const, buckets: [10, 25, 50, 100, 250, 500, 1000, 2500, 5000], registers: [registry], }), apiRequests: new Counter({ name: "cio_api_requests_total", help: "Total Customer.io API requests", labelNames: ["operation"] as const, registers: [registry], }), apiErrors: new Counter({ name: "cio_api_errors_total", help: "Customer.io API errors", labelNames: ["operation", "status_code"] as const, registers: [registry], }), emailSent: new Counter({ name: "cio_email_sent_total", help: "Emails sent via Customer.io", labelNames: ["type"] as const, // "transactional" or "campaign" registers: [registry], }), emailBounced: new Counter({ name: "cio_email_bounced_total", help: "Email bounces from Customer.io webhooks", registers: [registry], }), emailComplained: new Counter({ name: "cio_email_complained_total", help: "Spam complaints from Customer.io webhooks", registers: [registry], }), webhookReceived: new Counter({ name: "cio_webhook_received_total", help: "Webhook events received", labelNames: ["metric"] as const, registers: [registry], }), queueDepth: new Gauge({ name: "cio_queue_depth", help: "Pending items in Customer.io event queue", labelNames: ["queue"] as const, registers: [registry], }), }; export { registry };
typescript// lib/customerio-instrumented.ts import { TrackClient, APIClient, SendEmailRequest, RegionUS } from "customerio-node"; import { cioMetrics } from "./customerio-metrics"; export class InstrumentedCioClient { private track: TrackClient; private app: APIClient; constructor(siteId: string, trackKey: string, appKey: string) { this.track = new TrackClient(siteId, trackKey, { region: RegionUS }); this.app = new APIClient(appKey, { region: RegionUS }); } async identify(userId: string, attrs: Record<string, any>): Promise<void> { const timer = cioMetrics.apiDuration.startTimer({ operation: "identify" }); cioMetrics.apiRequests.inc({ operation: "identify" }); try { await this.track.identify(userId, attrs); timer({ status: "success" }); } catch (err: any) { const code = String(err.statusCode ?? "unknown"); timer({ status: "error" }); cioMetrics.apiErrors.inc({ operation: "identify", status_code: code }); throw err; } } async trackEvent( userId: string, name: string, data?: Record<string, any> ): Promise<void> { const timer = cioMetrics.apiDuration.startTimer({ operation: "track" }); cioMetrics.apiRequests.inc({ operation: "track" }); try { await this.track.track(userId, { name, data }); timer({ status: "success" }); } catch (err: any) { timer({ status: "error" }); cioMetrics.apiErrors.inc({ operation: "track", status_code: String(err.statusCode ?? "unknown"), }); throw err; } } async sendEmail(request: SendEmailRequest): Promise<any> { const timer = cioMetrics.apiDuration.startTimer({ operation: "send_email" }); cioMetrics.apiRequests.inc({ operation: "send_email" }); try { const result = await this.app.sendEmail(request); timer({ status: "success" }); cioMetrics.emailSent.inc({ type: "transactional" }); return result; } catch (err: any) { timer({ status: "error" }); cioMetrics.apiErrors.inc({ operation: "send_email", status_code: String(err.statusCode ?? "unknown"), }); throw err; } } }
typescript// lib/customerio-logger.ts import pino from "pino"; const logger = pino({ name: "customerio", level: process.env.CUSTOMERIO_LOG_LEVEL ?? "info", redact: { paths: [ "*.email", "*.phone", "*.ip_address", "*.password", "attrs.email", "attrs.phone", ], censor: "[REDACTED]", }, }); export function logCioOperation( operation: string, data: { userId?: string; event?: string; latencyMs?: number; statusCode?: number; error?: string; attrs?: Record<string, any>; } ): void { if (data.error) { logger.error({ operation, ...data }, `CIO ${operation} failed`); } else { logger.info({ operation, ...data }, `CIO ${operation} completed`); } } // Usage: // logCioOperation("identify", { // userId: "user-123", // latencyMs: 85, // attrs: { email: "user@example.com", plan: "pro" } // }); // Output: {"level":"info","operation":"identify","userId":"user-123", // "latencyMs":85,"attrs":{"email":"[REDACTED]","plan":"pro"}, // "msg":"CIO identify completed"}
typescript// Integrate with webhook handler (see customerio-webhooks-events skill) function recordWebhookMetrics(event: { metric: string }): void { cioMetrics.webhookReceived.inc({ metric: event.metric }); switch (event.metric) { case "bounced": cioMetrics.emailBounced.inc(); break; case "spammed": cioMetrics.emailComplained.inc(); break; case "sent": cioMetrics.emailSent.inc({ type: "campaign" }); break; } }
typescript// routes/metrics.ts import { Router } from "express"; import { registry } from "../lib/customerio-metrics"; const router = Router(); router.get("/metrics", async (_req, res) => { res.set("Content-Type", registry.contentType); res.end(await registry.metrics()); }); export default router;
json{ "title": "Customer.io Integration", "panels": [ { "title": "API Latency (p50/p95/p99)", "type": "timeseries", "targets": [ { "expr": "histogram_quantile(0.50, rate(cio_api_duration_ms_bucket[5m]))" }, { "expr": "histogram_quantile(0.95, rate(cio_api_duration_ms_bucket[5m]))" }, { "expr": "histogram_quantile(0.99, rate(cio_api_duration_ms_bucket[5m]))" } ] }, { "title": "Request Rate by Operation", "type": "timeseries", "targets": [ { "expr": "rate(cio_api_requests_total[5m])" } ] }, { "title": "Error Rate %", "type": "stat", "targets": [ { "expr": "rate(cio_api_errors_total[5m]) / rate(cio_api_requests_total[5m]) * 100" } ] }, { "title": "Email Delivery Funnel", "type": "bargauge", "targets": [ { "expr": "cio_email_sent_total" }, { "expr": "cio_email_bounced_total" }, { "expr": "cio_email_complained_total" } ] } ] }
yaml# prometheus/customerio-alerts.yml groups: - name: customerio rules: - alert: CioHighErrorRate expr: rate(cio_api_errors_total[5m]) / rate(cio_api_requests_total[5m]) > 0.05 for: 5m labels: { severity: critical } annotations: summary: "Customer.io API error rate > 5%" - alert: CioHighLatency expr: histogram_quantile(0.99, rate(cio_api_duration_ms_bucket[5m])) > 5000 for: 5m labels: { severity: warning } annotations: summary: "Customer.io p99 latency > 5 seconds" - alert: CioHighBounceRate expr: rate(cio_email_bounced_total[1h]) / rate(cio_email_sent_total[1h]) > 0.05 for: 15m labels: { severity: warning } annotations: summary: "Email bounce rate > 5%" - alert: CioSpamComplaints expr: rate(cio_email_complained_total[1h]) / rate(cio_email_sent_total[1h]) > 0.001 for: 5m labels: { severity: critical } annotations: summary: "Spam complaint rate > 0.1% — sender reputation at risk"
| Issue | Solution | |-------|----------| | High cardinality metrics | Don't use userId as a label — use operation + status only | | Log volume too high | Set CUSTOMERIO_LOG_LEVEL=warn in production | | Missing metrics | Check metric registration and scrape config | | PII in logs | Verify pino redact paths cover all sensitive fields |
After observability setup, proceed to customerio-advanced-troubleshooting for debugging.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-22 | fail→pass | 11,116 | 6,562 | -41% | 1 | 1 | 0% | 2,191 | 4,457 | +103% | 0 | 0 | — |
case-01 | fail→pass | 15,577 | 12,009 | -23% | 1 | 1 | 0% | 3,574 | 5,957 | +67% | 0 | 0 | — |
case-02 | fail→pass | 15,581 | 9,807 | -37% | 1 | 1 | 0% | 3,248 | 5,456 | +68% | 0 | 0 | — |
case-03 | fail→fail | 15,514 | 19,355 | +25% | 1 | 1 | 0% | 3,773 | 8,008 | +112% | 0 | 0 | — |
case-04 | pass→pass | 13,782 | 9,236 | -33% | 1 | 1 | 0% | 2,868 | 5,030 | +75% | 0 | 0 | — |
case-05 | pass→pass | 13,961 | 12,462 | -11% | 1 | 1 | 0% | 2,499 | 5,262 | +111% | 0 | 0 | — |
case-06 | pass→pass | 16,150 | 13,227 | -18% | 1 | 1 | 0% | 2,983 | 5,684 | +91% | 0 | 0 | — |
case-07 | fail→pass | 11,110 | 3,728 | -66% | 1 | 1 | 0% | 2,142 | 3,888 | +82% | 0 | 0 | — |
case-08 | fail→pass | 7,444 | 4,852 | -35% | 1 | 1 | 0% | 1,416 | 3,645 | +157% | 0 | 0 | — |
case-09 | fail→pass | 12,445 | 4,565 | -63% | 1 | 1 | 0% | 2,283 | 3,911 | +71% | 0 | 0 | — |
case-10 | fail→pass | 29,604 | 9,535 | -68% | 1 | 1 | 0% | 2,753 | 5,100 | +85% | 0 | 0 | — |
case-11 | fail→pass | 12,577 | 3,834 | -70% | 1 | 1 | 0% | 2,285 | 3,812 | +67% | 0 | 0 | — |
case-12 | pass→pass | 9,807 | 5,929 | -40% | 1 | 1 | 0% | 1,939 | 4,154 | +114% | 0 | 0 | — |
case-13 | pass→pass | 8,698 | 3,232 | -63% | 1 | 1 | 0% | 1,670 | 3,725 | +123% | 0 | 0 | — |
case-14 | fail→pass | 11,154 | 5,591 | -50% | 1 | 1 | 0% | 2,319 | 4,043 | +74% | 0 | 0 | — |
case-15 | fail→pass | 7,787 | 1,793 | -77% | 1 | 1 | 0% | 1,509 | 3,426 | +127% | 0 | 0 | — |
case-16 | pass→pass | 9,854 | 5,367 | -46% | 1 | 1 | 0% | 1,841 | 4,085 | +122% | 0 | 0 | — |
case-17 | fail→pass | 5,644 | 1,542 | -73% | 1 | 1 | 0% | 961 | 3,326 | +246% | 0 | 0 | — |
case-18 | fail→pass | 11,938 | 7,332 | -39% | 1 | 1 | 0% | 2,285 | 4,519 | +98% | 0 | 0 | — |
case-19 | fail→pass | 8,862 | 1,844 | -79% | 1 | 1 | 0% | 1,617 | 3,388 | +110% | 0 | 0 | — |
case-20 | fail→pass | 13,040 | 6,590 | -49% | 1 | 1 | 0% | 2,696 | 4,434 | +64% | 0 | 0 | — |
case-21 | fail→pass | 20,496 | 2,899 | -86% | 1 | 1 | 0% | 1,997 | 3,628 | +82% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +68 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.