monitoring-setup
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMonitoring Setup Expert
监控搭建专家
Overview
概述
This skill enables AI assistants to set up comprehensive monitoring for NestJS and Next.js applications, including Sentry for error tracking and Google Analytics for user analytics.
此技能可让AI助手为NestJS和Next.js应用搭建全面的监控体系,包括用于错误追踪的Sentry和用于用户分析的Google Analytics。
When to Use This Skill
何时使用此技能
This skill activates when users:
- Need to set up error tracking (Sentry)
- Want to configure Google Analytics
- Need monitoring for production applications
- Want to track application errors and user behavior
当用户有以下需求时,将激活此技能:
- 需要搭建错误追踪系统(Sentry)
- 想要配置Google Analytics
- 需要为生产环境应用设置监控
- 想要追踪应用错误与用户行为
Sentry Setup
Sentry 搭建步骤
NestJS Backend
NestJS 后端
- Install:
npm install @sentry/node @sentry/profiling-node - Initialize in before app creation
main.ts - Configure DSN via environment variable
SENTRY_DSN - Set appropriate sample rates for production
- 安装:
npm install @sentry/node @sentry/profiling-node - 在创建应用前,在中初始化
main.ts - 通过环境变量配置DSN
SENTRY_DSN - 为生产环境设置合适的采样率
Next.js Frontend
Next.js 前端
- Install:
npm install @sentry/nextjs - Run:
npx @sentry/wizard@latest -i nextjs - Configure client/server/edge configs
- Set for client-side
NEXT_PUBLIC_SENTRY_DSN
- 安装:
npm install @sentry/nextjs - 运行:
npx @sentry/wizard@latest -i nextjs - 配置客户端/服务端/边缘环境的相关设置
- 为客户端设置
NEXT_PUBLIC_SENTRY_DSN
Google Analytics Setup
Google Analytics 搭建步骤
Next.js Setup
Next.js 配置
- Add Google Analytics script to root layout
- Use (format: G-XXXXXXXXXX)
NEXT_PUBLIC_GA_MEASUREMENT_ID - Create analytics utility functions for event tracking
- Set up page view tracking
- 将Google Analytics脚本添加到根布局中
- 使用(格式:G-XXXXXXXXXX)
NEXT_PUBLIC_GA_MEASUREMENT_ID - 创建用于事件追踪的分析工具函数
- 配置页面浏览追踪
Common Events
常见追踪事件
- User signup/login
- Purchases/conversions
- Feature usage
- Custom business events
- 用户注册/登录
- 购买/转化
- 功能使用情况
- 自定义业务事件
Best Practices
最佳实践
- Use different DSNs for dev/prod
- Set appropriate sample rates
- Respect user privacy (GDPR/CCPA)
- Don't track sensitive data
- Set up alerts for critical errors
- 为开发/生产环境使用不同的DSN
- 设置合适的采样率
- 尊重用户隐私(GDPR/CCPA合规)
- 不要追踪敏感数据
- 为严重错误设置告警
Integration
集成
This skill integrates with command for automated setup workflows.
/monitoring-setup此技能可与命令集成,实现自动化搭建流程。
/monitoring-setup