posthog-incident-runbook
/posthog-incident-runbook
Prowadzi triaż incydentu produkcyjnej integracji PostHog z zachowaniem dostępności aplikacji i dowodów, gdy capture, flagi, prywatne API lub destynacje są zdegradowane.
- Autor
- jeremylongshore ↗
- Repozytorium
- tons-of-skills-marketplace ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 26.10.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 2
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 6
Brak sygnałów. Repozytorium zmienione 26.10.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Prowadzi triaż incydentu produkcyjnej integracji PostHog z zachowaniem dostępności aplikacji i dowodów, gdy capture, flagi, prywatne API lub destynacje są zdegradowane.
Wyzwalacze z opisu
Argumenty
/posthog-incident-runbook [service] [symptom]
Oryginalny opis (EN)
Triage a production PostHog integration incident while preserving application availability and evidence. Use when capture, flags, private API access, or downstream destinations are degraded. Trigger with "PostHog incident", "PostHog outage", or "PostHog on-call".
Jak działa
- Overview
- Prerequisites
- Instructions
- Severity Levels
- Quick Triage (Run First)
- Decision Tree
- Immediate Actions by Error Type
- Graceful Degradation Pattern
- Post-Incident Evidence Collection
- Error Handling
Podgląd SKILL.md
---
name: posthog-incident-runbook
description: |
Triage a production PostHog integration incident while preserving application availability and evidence. Use when capture, flags, private API access, or downstream destinations are degraded. Trigger with "PostHog incident", "PostHog outage", or "PostHog on-call".
argument-hint: "[service] [symptom]"
allowed-tools: Read, Grep, Bash(kubectl:*), Bash(curl:*)
version: 1.14.0
license: MIT
author: Jeremy Longshore <jeremy@intentsolutions.io>
tags:
- saas
- posthog
- incident-response
compatibility: Designed for Claude Code
---
# PostHog Incident Runbook
## Overview
Rapid incident response for PostHog integration failures. PostHog Cloud has its own status page (status.posthog.com) — the first step is always determining whether the issue is PostHog-side or your integration.
## Prerequisites
- The affected service, deployment window, and PostHog region are known.
- Read-only evidence is preferred; production write probes require explicit authorization.
- A safe application fallback exists for analytics and flag failures.
## Instructions
### Tool discipline
Use `Read` to inspect the relevant configuration and implementation before proposing changes. Use `Grep` to locate initialization, capture, flag, and credential boundaries.
Follow the triage sequence below. Stop when evidence identifies a failed boundary; do not continue mutating unrelated layers.
## Severity Levels
| Level | Definition | Response Time | Examples |
|-------|------------|---------------|----------|
| P1 | Analytics completely down | < 15 min | All capture calls failing, feature flags returning defaults |
| P2 | Degraded analytics | < 1 hour | High latency, partial event loss, slow flag eval |
| P3 | Minor impact | < 4 hours | Webhook delays, specific event type missing |
| P4 | No user impact | Next day | Monitoring gaps, dashboard stale data |
## Quick Triage (Run First)
```bash
set -euo pipefail
: "${POSTHOG_PUBLIC_HOST:?Set the US or EU ingestion host for this project}"
: "${POSTHOG_PRIVATE_HOST:?Set the matching US or EU private API host}"
# 1. Check PostHog's status page and the selected regional ingestion host.
curl -fsSI https://status.posthog.com/ | head -n 1
curl -sf -o /dev/null -w "Regional health: %{http_code}\n" \
"$POSTHOG_PUBLIC_HOST/healthz"
# 2. Verify private API access without changing project data.
if [ -n "${POSTHOG_PERSONAL_API_KEY:-}" ]; then
curl -sf -o /dev/null -w "Private API: %{http_code}\n" \
"$POSTHOG_PRIVATE_HOST/api/projects/" \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY"
fi
# 3. Check the application's own health and recent delivery telemetry.
curl -sf -o /dev/null -w "Application health: %{http_code}\n" \
"${APPLICATION_HEALTH_URL:?Set the affected service health URL}"
```
Do not use an event capture as the default health check: it writes project data, and an HTTP 200 only confirms receipt and payload shape, not successful ingestion. If the incident commander explicitly authorizes a production write probe, use a named synthetic event and distinct ID, record the approval and timestamp, inspect `quota_limited`, and remove or exclude the probe from analysis.
## Decision Tree
```
Is PostHog Cloud healthy (status.posthog.com)?
├── NO → PostHog outage
│ ├── Enable graceful degradation (feature flags return defaults)
│ ├── Monitor status.posthog.com for resolution
│ └── Events will be lost during outage (capture is fire-and-forget)
│
└── YES → Our integration issue
├── Are we getting 401? → API key issue (see Error 401 below)
├── Are we getting 429? → Rate limited (see Error 429 below)
├── Are events just not appearing? → Check flush/shutdown (see below)
└── Are flags returning defaults? → Check the feature flags secure API key (see below)
```
## Immediate Actions by Error Type
### 401/403 — Authentication Failed
```bash
set -euo pipefail
# Test the public project token through flag evaluation; this does not capture an event.
curl -s -o /dev/null -w "Flags: %{http_code}\n" -X POST "$POSTHOG_PUBLIC_HOST/flags/?v=2" \
-H 'Content-Type: application/json' \
-d "{\"api_key\":\"$NEXT_PUBLIC_POSTHOG_KEY\",\"distinct_id\":\"incident-readonly-probe\"}"
# Test the private credential with a read-only project list.
curl -s -o /dev/null -w "Private API: %{http_code}\n" "$POSTHOG_PRIVATE_HOST/api/projects/" \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY"
# Fix: If key is invalid, rotate in PostHog dashboard and update secrets
```
### 429 — Rate Limited
```bash
set -euo pipefail
# PostHog rate limits (private API only):
# - Analytics endpoints: 240/min, 1200/hour
# - HogQL query: 2400/hour
# - Local flag eval polling: 600/min
# - Other private CRUD endpoints: 480/min, 4800/hour
# - Capture endpoints: NO LIMIT
# Immediate: Cache API responses, reduce polling frequency
# Long-term: See posthog-rate-limits skill
```
### Events Not Appearing
```bash
set -euo pipefail
# Most common cause: not calling flush/shutdown in serverless
# Check 1: verify the regional host and inspect SDK delivery logs, queue depth,
# ingestion warnings, and the latest expected event in PostHog.
# Check 2: verify the API host is correct (common mistake).
# WRONG: https://app.posthog.com (this is the UI)
# RIGHT: the target project's US or EU ingestion endpoint
```
### Feature Flags Returning Defaults
```typescript
// Most common causes:
// 1. No feature flags secure API key → local definitions are unavailable
// 2. Flags not loaded yet → check timing
// 3. Wrong project key → flags from different project
// Fix 1: Pass the server-only feature flags secure API key via the SDK option
const posthog = new PostHog(process.env.NEXT_PUBLIC_POSTHOG_KEY!, {
personalApiKey: process.env.POSTHOG_FEATURE_FLAGS_SECURE_API_KEY,
});
// Fix 2: Wait for flags in browser
posthog.onFeatureFlags(() => {
// Now flags are loaded
const value = posthog.isFeatureEnabled('my-flag');
});
```
## Graceful Degradation Pattern
```typescript
// PostHog should NEVER crash your app
function safeCapture(distinctId: string, event: string, props?: Record<string, any>) {
try {
posthog.capture({ distinctId, event, properties: props });
} catch {
// Swallow error — analytics failure should never impact users
}
}
async function safeFlag(key: string, userId: string, fallback: boolean = false): Promise<boolean> {
try {
const result = await posthog.isFeatureEnabled(key, userId);
return result ?? fallback;
} catch {
return fallback; // Return safe default
}
}
```
## Post-Incident Evidence Collection
```bash
set -euo pipefail
INCIDENT_DIR="posthog-incident-$(date +%Y%m%d-%H%M%S)"
mkdir -p "$INCIDENT_DIR"
# Collect diagnostics
echo "Incident: $(date -u)" > "$INCIDENT_DIR/timeline.txt"
curl -s https://us.i.posthog.com/healthz > "$INCIDENT_DIR/healthz.json" 2>&1
env | grep -i posthog | sed 's/=.*/=***/' > "$INCIDENT_DIR/env-redacted.txt"
npm list posthog-js posthog-node 2>/dev/null > "$INCIDENT_DIR/versions.txt"
tar -czf "$INCIDENT_DIR.tar.gz" "$INCIDENT_DIR"
echo "Evidence collected: $INCIDENT_DIR.tar.gz"
```
## Error Handling
| Issue | Cause | Solution |
|-------|-------|----------|
| Complete analytics outage | PostHog Cloud down | Enable graceful degradation, monitor status page |
| Partial event loss | Serverless not flushing | Add `await posthog.shutdown()` |
| All flags return false | Secure flag key missing or expired | Add or rotate the feature flags secure API key |
| Admin API 401 | Personal key revoked | Generate new key in PostHog settings |
| High latency | Network path to PostHog | Check reverse proxy, try direct connection |
## Output
- Triage commands identifying issue source
- Immediate remediation for each error type
- Graceful degradation wrappers
- Post-incident evidence bundle
## Examples
For a sudden feature-flag fallback spike, first confirm application health, PostHog status, region routing, and SDK initialization lifetime. Avoid sending probe events into production until authorized; use a controlled test project when a write probe is necessary, then record containment, rollback, and recovery evidence.
## Resources
See [official PostHog references](references/official-docs.md) for current authority and verification boundaries.
- [PostHog Status Page](https://status.posthog.com)
- [PostHog Support](https://posthog.com/docs/support)
- [PostHog API Overview](https://posthog.com/docs/api)
## Next Steps
For data handling, see `posthog-data-handling`.
Pliki w paczce (2)
- SKILL.md 8 KB
- references/official-docs.md 1 KB
Wersje
| Repozytorium | Wynik | Licencja |
|---|---|---|
| Ta strona · jeremylongshore/tons-of-skills-marketplace | 100 | MIT |
| HelixDevelopment/agent | 100 | MIT |
Identyczna treść występuje jeszcze w 1 innych folderach na GitHubie. Tu pokazujemy jedną, najlepiej ocenioną kopię.
Migawka bazy z 28.10.2026 · wersja paczki 3a1a1484dc1d (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100posthog-prod-checklist
Przeprowadza przegląd gotowości produkcyjnej instrumentacji PostHog w trybie fail-safe: flagi, sekrety, prywatność, dostarczanie i wycofanie, przy włączaniu nowej integracji lub dużej zmianie SDK. - 100posthog-ci-integration
Buduje bramki CI dla PostHog w konkretnym repozytorium: inicjalizacja SDK, typowane testy capture, adnotacje wydań i granice sekretów, przy dodawaniu lub przeglądzie sprawdzeń PostHog w CI. - 100posthog-observability
Konfiguruje monitoring integracji PostHog z metrykami, śladami i alertami, w tym dashboardy i alerty o zdrowiu integracji. - 100posthog-ci-integration
Konfiguruje integrację PostHog z CI/CD przez GitHub Actions i testy, przy automatycznym testowaniu i włączaniu testów PostHog do procesu budowania. - 90incident-runbook
Prowadzi reakcję na incydent od diagnozy przez łagodzenie do rozwiązania, potem postmortem bez szukania winnych i powtarzalny runbook, gdy produkcja jest zdegradowana lub awarie wracają. - 91migrate-posthog
Migruje flagi funkcji z PostHog do Confidence SDK i przekształca kod SDK na nowe wywołania.