klaviyo-observability
Set up observability for Klaviyo integrations with metrics, traces, and alerts. Use when implementing monitoring for Klaviyo API operations, setting up dashboards, or configuring alerting for Klaviyo integration health. Trigger with phrases like "klaviyo monitoring", "klaviyo metrics", "klaviyo observability", "monitor klaviyo", "klaviyo alerts", "klaviyo tracing".
Best use case
klaviyo-observability is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Set up observability for Klaviyo integrations with metrics, traces, and alerts. Use when implementing monitoring for Klaviyo API operations, setting up dashboards, or configuring alerting for Klaviyo integration health. Trigger with phrases like "klaviyo monitoring", "klaviyo metrics", "klaviyo observability", "monitor klaviyo", "klaviyo alerts", "klaviyo tracing".
Teams using klaviyo-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/klaviyo-observability/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How klaviyo-observability Compares
| Feature / Agent | klaviyo-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 observability for Klaviyo integrations with metrics, traces, and alerts. Use when implementing monitoring for Klaviyo API operations, setting up dashboards, or configuring alerting for Klaviyo integration health. Trigger with phrases like "klaviyo monitoring", "klaviyo metrics", "klaviyo observability", "monitor klaviyo", "klaviyo alerts", "klaviyo tracing".
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 Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
ChatGPT vs Claude for Agent Skills
Compare ChatGPT and Claude for AI agent skills across coding, writing, research, and reusable workflow execution.
SKILL.md Source
# Klaviyo Observability
## Overview
Comprehensive observability for Klaviyo integrations: Prometheus metrics for API call tracking, OpenTelemetry tracing, structured logging, and alerting rules tuned to Klaviyo's rate limits and error patterns.
## Prerequisites
- Prometheus or compatible metrics backend
- OpenTelemetry SDK installed (optional)
- Grafana or similar dashboarding tool (optional)
- `klaviyo-api` SDK installed
## Key Metrics to Track
| Metric | Type | Why It Matters |
|--------|------|---------------|
| `klaviyo_api_requests_total` | Counter | Track total API volume by endpoint |
| `klaviyo_api_duration_seconds` | Histogram | Detect latency degradation |
| `klaviyo_api_errors_total` | Counter | 4xx/5xx error rates |
| `klaviyo_rate_limit_remaining` | Gauge | Predict when you'll hit 429s |
| `klaviyo_profiles_synced_total` | Counter | Profile sync throughput |
| `klaviyo_events_tracked_total` | Counter | Event tracking volume |
| `klaviyo_webhook_received_total` | Counter | Inbound webhook volume |
## Instructions
### Step 1: Instrumented API Wrapper
```typescript
// src/klaviyo/instrumented-client.ts
import { Counter, Histogram, Gauge, Registry } from 'prom-client';
const registry = new Registry();
const apiRequests = new Counter({
name: 'klaviyo_api_requests_total',
help: 'Total Klaviyo API requests',
labelNames: ['method', 'endpoint', 'status'],
registers: [registry],
});
const apiDuration = new Histogram({
name: 'klaviyo_api_duration_seconds',
help: 'Klaviyo API request duration in seconds',
labelNames: ['method', 'endpoint'],
buckets: [0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10],
registers: [registry],
});
const apiErrors = new Counter({
name: 'klaviyo_api_errors_total',
help: 'Klaviyo API errors by status code',
labelNames: ['endpoint', 'status_code', 'error_code'],
registers: [registry],
});
const rateLimitRemaining = new Gauge({
name: 'klaviyo_rate_limit_remaining',
help: 'Remaining requests in current rate limit window',
registers: [registry],
});
export async function instrumentedCall<T>(
endpoint: string,
method: string,
operation: () => Promise<T>
): Promise<T> {
const timer = apiDuration.startTimer({ method, endpoint });
try {
const result = await operation();
apiRequests.inc({ method, endpoint, status: 'success' });
// Extract rate limit headers if available
const headers = (result as any)?.headers;
if (headers?.['ratelimit-remaining']) {
rateLimitRemaining.set(parseInt(headers['ratelimit-remaining']));
}
return result;
} catch (error: any) {
const statusCode = error.status || 'unknown';
const errorCode = error.body?.errors?.[0]?.code || 'unknown';
apiRequests.inc({ method, endpoint, status: 'error' });
apiErrors.inc({ endpoint, status_code: statusCode, error_code: errorCode });
throw error;
} finally {
timer();
}
}
export { registry };
```
### Step 2: Usage in Service Layer
```typescript
// Wrap all Klaviyo calls with instrumentation
import { instrumentedCall } from '../klaviyo/instrumented-client';
// Profile creation with metrics
const profile = await instrumentedCall('profiles', 'POST', () =>
profilesApi.createOrUpdateProfile({
data: {
type: 'profile' as any,
attributes: { email: user.email, firstName: user.name },
},
})
);
// Event tracking with metrics
await instrumentedCall('events', 'POST', () =>
eventsApi.createEvent({
data: {
type: 'event',
attributes: {
metric: { data: { type: 'metric', attributes: { name: 'Placed Order' } } },
profile: { data: { type: 'profile', attributes: { email: order.email } } },
properties: { orderId: order.id },
value: order.total,
time: new Date().toISOString(),
},
},
})
);
```
### Step 3: OpenTelemetry Tracing
```typescript
// src/klaviyo/tracing.ts
import { trace, SpanStatusCode, Span } from '@opentelemetry/api';
const tracer = trace.getTracer('klaviyo-integration', '1.0.0');
export async function tracedKlaviyoCall<T>(
operationName: string,
attributes: Record<string, string>,
operation: () => Promise<T>
): Promise<T> {
return tracer.startActiveSpan(`klaviyo.${operationName}`, async (span: Span) => {
span.setAttributes({
'klaviyo.operation': operationName,
'klaviyo.revision': '2024-10-15',
...attributes,
});
try {
const result = await operation();
span.setStatus({ code: SpanStatusCode.OK });
return result;
} catch (error: any) {
span.setStatus({ code: SpanStatusCode.ERROR, message: error.message });
span.setAttributes({
'klaviyo.error.status': error.status?.toString() || 'unknown',
'klaviyo.error.code': error.body?.errors?.[0]?.code || 'unknown',
});
span.recordException(error);
throw error;
} finally {
span.end();
}
});
}
```
### Step 4: Structured Logging
```typescript
// src/klaviyo/logger.ts
import pino from 'pino';
const logger = pino({
name: 'klaviyo',
level: process.env.KLAVIYO_LOG_LEVEL || 'info',
serializers: {
// Redact sensitive data from logs
profile: (profile: any) => ({
id: profile.id,
email: profile.email ? `${profile.email.substring(0, 3)}***` : undefined,
}),
err: pino.stdSerializers.err,
},
});
export function logApiCall(operation: string, durationMs: number, status: 'ok' | 'error', meta?: Record<string, any>) {
logger.info({
msg: `klaviyo.${operation}`,
service: 'klaviyo',
operation,
durationMs: Math.round(durationMs),
status,
...meta,
});
}
export function logWebhook(topic: string, eventId: string, durationMs: number) {
logger.info({
msg: `klaviyo.webhook.${topic}`,
service: 'klaviyo',
topic,
eventId,
durationMs: Math.round(durationMs),
});
}
export { logger };
```
### Step 5: Alert Rules (Prometheus)
```yaml
# prometheus/klaviyo-alerts.yml
groups:
- name: klaviyo
rules:
- alert: KlaviyoHighErrorRate
expr: |
rate(klaviyo_api_errors_total[5m]) /
rate(klaviyo_api_requests_total[5m]) > 0.05
for: 5m
labels:
severity: warning
annotations:
summary: "Klaviyo API error rate above 5%"
description: "Error rate: {{ $value | humanizePercentage }}"
- alert: KlaviyoRateLimited
expr: |
increase(klaviyo_api_errors_total{status_code="429"}[5m]) > 10
for: 2m
labels:
severity: warning
annotations:
summary: "Klaviyo rate limit being hit frequently"
- alert: KlaviyoHighLatency
expr: |
histogram_quantile(0.95,
rate(klaviyo_api_duration_seconds_bucket[5m])
) > 3
for: 5m
labels:
severity: warning
annotations:
summary: "Klaviyo API P95 latency above 3 seconds"
- alert: KlaviyoDown
expr: |
increase(klaviyo_api_errors_total{status_code=~"5.."}[5m]) > 20
and increase(klaviyo_api_requests_total{status="success"}[5m]) == 0
for: 3m
labels:
severity: critical
annotations:
summary: "Klaviyo API appears to be down"
- alert: KlaviyoRateLimitLow
expr: klaviyo_rate_limit_remaining < 20
for: 30s
labels:
severity: warning
annotations:
summary: "Klaviyo rate limit headroom below 20 requests"
```
### Step 6: Metrics Endpoint
```typescript
// src/routes/metrics.ts
import { registry } from '../klaviyo/instrumented-client';
app.get('/metrics', async (req, res) => {
res.set('Content-Type', registry.contentType);
res.send(await registry.metrics());
});
```
## Grafana Dashboard Panels
| Panel | Query | Purpose |
|-------|-------|---------|
| Request Rate | `rate(klaviyo_api_requests_total[5m])` | API call volume |
| Error Rate | `rate(klaviyo_api_errors_total[5m])` | Error trend |
| Latency P50/P95 | `histogram_quantile(0.95, rate(klaviyo_api_duration_seconds_bucket[5m]))` | Performance |
| Rate Limit | `klaviyo_rate_limit_remaining` | Rate limit headroom |
| Error by Code | `topk(5, sum by (status_code) (rate(klaviyo_api_errors_total[5m])))` | Error breakdown |
## Error Handling
| Issue | Cause | Solution |
|-------|-------|----------|
| Missing metrics | No instrumentation wrapper | Wrap all API calls with `instrumentedCall()` |
| High cardinality | Too many label values | Use endpoint groups, not full URLs |
| Alert storms | Thresholds too low | Tune alert rules to your traffic pattern |
| PII in logs | Email in log messages | Use serializer to redact emails |
## Resources
- [Prometheus Best Practices](https://prometheus.io/docs/practices/naming/)
- [OpenTelemetry Node.js](https://opentelemetry.io/docs/languages/js/)
- [pino Logger](https://github.com/pinojs/pino)
## Next Steps
For incident response, see `klaviyo-incident-runbook`.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".