| name | klaviyo-observability |
| description | 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".
|
| allowed-tools | Read, Write, Edit |
| version | 1.7.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","klaviyo","email-marketing","cdp"] |
| compatibility | Designed for Claude Code |
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. The pattern centers on one instrumentation wrapper that every Klaviyo call routes through, so metrics, traces, and logs stay consistent across profiles, events, and webhooks.
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
Read any existing Klaviyo client code first, then build the layers in order. Each
step writes one module; steps 5–6 wire the alerting and scrape endpoint.
- Instrumented API wrapper — write
src/klaviyo/instrumented-client.ts with the
Prometheus counters, histogram, and gauge, exposed through a single
instrumentedCall() helper.
- Route every call through
instrumentedCall(endpoint, method, () => ...) in
the service layer so profile/event/webhook traffic is all counted.
- OpenTelemetry tracing (optional) — add
tracedKlaviyoCall() to emit spans
with Klaviyo operation + error attributes.
- Structured logging — add a logger with an email-redacting serializer.