posthog-prod-checklist

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

PostHog Production Checklist

PostHog生产检查清单

Overview

概述

Complete checklist for deploying PostHog integrations to production.
完成将PostHog集成部署到生产环境的检查清单。

Prerequisites

前置条件

  • Staging environment tested and verified
  • Production API keys available
  • Deployment pipeline configured
  • Monitoring and alerting ready
  • 已测试并验证Staging环境
  • 已获取生产环境API密钥
  • 已配置部署流水线
  • 监控与告警已就绪

Instructions

操作步骤

Step 1: Pre-Deployment Configuration

步骤1:部署前配置

  • Production API keys in secure vault
  • Environment variables set in deployment platform
  • API key scopes are minimal (least privilege)
  • Webhook endpoints configured with HTTPS
  • Webhook secrets stored securely
  • 生产环境API密钥已存储在安全密钥库中
  • 已在部署平台设置环境变量
  • API密钥权限最小化(遵循最小权限原则)
  • 已配置HTTPS协议的Webhook端点
  • Webhook密钥已安全存储

Step 2: Code Quality Verification

步骤2:代码质量验证

  • All tests passing (
    npm test
    )
  • No hardcoded credentials
  • Error handling covers all PostHog error types
  • Rate limiting/backoff implemented
  • Logging is production-appropriate
  • 所有测试通过(
    npm test
  • 无硬编码凭证
  • 错误处理覆盖所有PostHog错误类型
  • 已实现速率限制/退避机制
  • 日志配置符合生产环境要求

Step 3: Infrastructure Setup

步骤3:基础设施配置

  • Health check endpoint includes PostHog connectivity
  • Monitoring/alerting configured
  • Circuit breaker pattern implemented
  • Graceful degradation configured
  • 健康检查端点包含PostHog连通性检测
  • 已配置监控与告警
  • 已实现熔断器模式
  • 已配置优雅降级机制

Step 4: Documentation Requirements

步骤4:文档要求

  • Incident runbook created
  • Key rotation procedure documented
  • Rollback procedure documented
  • On-call escalation path defined
  • 已创建事件响应手册
  • 已记录密钥轮换流程
  • 已记录回滚流程
  • 已定义On-call升级路径

Step 5: Deploy with Gradual Rollout

步骤5:分批灰度部署

bash
undefined
bash
undefined

Pre-flight checks

预部署检查

Gradual rollout - start with canary (10%)

灰度部署 - 先启动金丝雀发布(10%流量)

kubectl apply -f k8s/production.yaml kubectl set image deployment/posthog-integration app=image:new --record kubectl rollout pause deployment/posthog-integration
kubectl apply -f k8s/production.yaml kubectl set image deployment/posthog-integration app=image:new --record kubectl rollout pause deployment/posthog-integration

Monitor canary traffic for 10 minutes

监控金丝雀流量10分钟

sleep 600
sleep 600

Check error rates and latency before continuing

继续之前检查错误率与延迟情况

If healthy, continue rollout to 50%

若状态健康,将流量扩大至50%

kubectl rollout resume deployment/posthog-integration kubectl rollout pause deployment/posthog-integration sleep 300
kubectl rollout resume deployment/posthog-integration kubectl rollout pause deployment/posthog-integration sleep 300

Complete rollout to 100%

完成全量部署(100%流量)

kubectl rollout resume deployment/posthog-integration kubectl rollout status deployment/posthog-integration
undefined
kubectl rollout resume deployment/posthog-integration kubectl rollout status deployment/posthog-integration
undefined

Output

输出结果

  • Deployed PostHog integration
  • Health checks passing
  • Monitoring active
  • Rollback procedure documented
  • PostHog集成已部署完成
  • 健康检查全部通过
  • 监控已激活
  • 回滚流程已记录

Error Handling

错误处理

AlertConditionSeverity
API Down5xx errors > 10/minP1
High Latencyp99 > 5000msP2
Rate Limited429 errors > 5/minP2
Auth Failures401/403 errors > 0P1
告警触发条件严重级别
API服务不可用5xx错误每分钟超过10次P1
高延迟p99延迟超过5000msP2
速率受限429错误每分钟超过5次P2
认证失败401/403错误出现次数大于0P1

Examples

示例

Health Check Implementation

健康检查实现

typescript
async function healthCheck(): Promise<{ status: string; posthog: any }> {
  const start = Date.now();
  try {
    await posthogClient.ping();
    return { status: 'healthy', posthog: { connected: true, latencyMs: Date.now() - start } };
  } catch (error) {
    return { status: 'degraded', posthog: { connected: false, latencyMs: Date.now() - start } };
  }
}
typescript
async function healthCheck(): Promise<{ status: string; posthog: any }> {
  const start = Date.now();
  try {
    await posthogClient.ping();
    return { status: 'healthy', posthog: { connected: true, latencyMs: Date.now() - start } };
  } catch (error) {
    return { status: 'degraded', posthog: { connected: false, latencyMs: Date.now() - start } };
  }
}

Immediate Rollback

紧急回滚

bash
kubectl rollout undo deployment/posthog-integration
kubectl rollout status deployment/posthog-integration
bash
kubectl rollout undo deployment/posthog-integration
kubectl rollout status deployment/posthog-integration

Resources

参考资源

Next Steps

下一步操作

For version upgrades, see
posthog-upgrade-migration
.
如需进行版本升级,请查看
posthog-upgrade-migration