customerio-observability
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".
Best use case
customerio-observability is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
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".
Teams using customerio-observability should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/customerio-observability/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How customerio-observability Compares
| Feature / Agent | customerio-observability | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
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".
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Startups
Explore AI agent skills for startup validation, product research, growth experiments, documentation, and fast execution with small teams.
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
AI Agent for Product Research
Browse AI agent skills for product research, competitive analysis, customer discovery, and structured product decision support.
SKILL.md Source
# Customer.io Observability
## Overview
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.
## Prerequisites
- Customer.io integration deployed
- Prometheus + Grafana (or compatible metrics stack)
- Structured logging system (pino recommended)
## Key Metrics to Track
| 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 |
## Instructions
### Step 1: Prometheus Metrics
```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 };
```
### Step 2: Instrumented Client
```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;
}
}
}
```
### Step 3: Structured Logging with PII Redaction
```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"}
```
### Step 4: Webhook Metrics Collection
```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;
}
}
```
### Step 5: Prometheus Metrics Endpoint
```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;
```
### Step 6: Grafana Dashboard (JSON Model)
```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" }
]
}
]
}
```
### Step 7: Alerting Rules
```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"
```
## Error Handling
| 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 |
## Resources
- [Prometheus Best Practices](https://prometheus.io/docs/practices/)
- [Grafana Dashboard Provisioning](https://grafana.com/docs/grafana/latest/dashboards/)
- [pino Logger](https://getpino.io/)
## Next Steps
After observability setup, proceed to `customerio-advanced-troubleshooting` for debugging.Related Skills
windsurf-observability
Monitor Windsurf AI adoption, feature usage, and team productivity metrics. Use when tracking AI feature usage, measuring ROI, setting up dashboards, or analyzing Cascade effectiveness across your team. Trigger with phrases like "windsurf monitoring", "windsurf metrics", "windsurf analytics", "windsurf usage", "windsurf adoption".
webflow-observability
Set up observability for Webflow integrations — Prometheus metrics for API calls, OpenTelemetry tracing, structured logging with pino, Grafana dashboards, and alerting for rate limits, errors, and latency. Trigger with phrases like "webflow monitoring", "webflow metrics", "webflow observability", "monitor webflow", "webflow alerts", "webflow tracing".
vercel-observability
Set up Vercel observability with runtime logs, analytics, log drains, and OpenTelemetry tracing. Use when implementing monitoring for Vercel deployments, setting up log drains, or configuring alerting for function errors and performance. Trigger with phrases like "vercel monitoring", "vercel metrics", "vercel observability", "vercel logs", "vercel alerts", "vercel tracing".
veeva-observability
Veeva Vault observability for enterprise operations. Use when implementing advanced Veeva Vault patterns. Trigger: "veeva observability".
vastai-observability
Monitor Vast.ai GPU instance health, utilization, and costs. Use when setting up monitoring dashboards, configuring alerts, or tracking GPU utilization and spending. Trigger with phrases like "vastai monitoring", "vastai metrics", "vastai observability", "monitor vastai", "vastai alerts".
twinmind-observability
Monitor TwinMind transcription quality, meeting coverage, action item extraction rates, and memory vault health. Use when implementing observability, or managing TwinMind meeting AI operations. Trigger with phrases like "twinmind observability", "twinmind observability".
speak-observability
Monitor Speak API health, assessment latency, session metrics, and pronunciation score distributions. Use when implementing observability, or managing Speak language learning platform operations. Trigger with phrases like "speak observability", "speak observability".
snowflake-observability
Set up Snowflake observability using ACCOUNT_USAGE views, alerts, and external monitoring. Use when implementing Snowflake monitoring dashboards, setting up query performance tracking, or configuring alerting for warehouse and pipeline health. Trigger with phrases like "snowflake monitoring", "snowflake metrics", "snowflake observability", "snowflake dashboard", "snowflake alerts".
shopify-observability
Set up observability for Shopify app integrations with query cost tracking, rate limit monitoring, webhook delivery metrics, and structured logging. Trigger with phrases like "shopify monitoring", "shopify metrics", "shopify observability", "monitor shopify API", "shopify alerts", "shopify dashboard".
salesforce-observability
Set up observability for Salesforce integrations with API limit monitoring, error tracking, and alerting. Use when implementing monitoring for Salesforce operations, tracking API consumption, or configuring alerting for Salesforce integration health. Trigger with phrases like "salesforce monitoring", "salesforce metrics", "salesforce observability", "monitor salesforce", "salesforce alerts", "salesforce API usage dashboard".
retellai-observability
Retell AI observability — AI voice agent and phone call automation. Use when working with Retell AI for voice agents, phone calls, or telephony. Trigger with phrases like "retell observability", "retellai-observability", "voice agent".
replit-observability
Monitor Replit deployments with health checks, uptime tracking, resource usage, and alerting. Use when setting up monitoring for Replit apps, building health dashboards, or configuring alerting for deployment health and performance. Trigger with phrases like "replit monitoring", "replit metrics", "replit observability", "monitor replit", "replit alerts", "replit uptime".