error-tracking-go

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

PostHog error tracking for Go

面向Go语言的PostHog错误追踪

This skill helps you add PostHog error tracking to Go applications.
本技能可帮助你在Go应用中添加PostHog错误追踪功能。

Reference files

参考文件

  • references/go.md
    - Go error tracking installation - docs
  • references/fingerprints.md
    - Fingerprints - docs
  • references/alerts.md
    - Send error tracking alerts - docs
  • references/monitoring.md
    - Monitor and search issues - docs
  • references/assigning-issues.md
    - Assign issues to teammates - docs
  • references/upload-source-maps.md
    - Upload source maps - docs
Consult the documentation for API details and framework-specific patterns.
  • references/go.md
    - Go错误追踪安装文档
  • references/fingerprints.md
    - 错误指纹文档
  • references/alerts.md
    - 发送错误追踪告警文档
  • references/monitoring.md
    - 监控与搜索问题文档
  • references/assigning-issues.md
    - 将问题分配给团队成员文档
  • references/upload-source-maps.md
    - 上传源码映射文档
如需API详情和特定框架的实现模式,请查阅相关文档。

Key principles

核心原则

  • Environment variables: Always use environment variables for PostHog keys and host URLs. Never hardcode them.
  • Minimal changes: Add error tracking alongside existing error handling. Don't replace or restructure existing error handling code.
  • Autocapture first: Enable exception autocapture in the SDK initialization before adding manual captures.
  • Source maps: Upload source maps so stack traces resolve to original source code, not minified bundles.
  • Manual capture for boundaries: Use
    captureException()
    at error boundaries and catch blocks for errors that don't propagate to the global handler.
  • 环境变量:始终使用环境变量存储PostHog密钥和主机URL,切勿硬编码。
  • 最小改动:在现有错误处理基础上添加错误追踪功能,不要替换或重构已有的错误处理代码。
  • 自动捕获优先:在SDK初始化时启用异常自动捕获,之后再添加手动捕获逻辑。
  • 源码映射:上传源码映射,以便堆栈追踪能够解析到原始源代码,而非压缩后的包文件。
  • 边界处手动捕获:在错误边界和catch代码块中使用
    captureException()
    捕获那些不会传播到全局处理器的错误。

Framework guidelines

框架指南

No specific framework guidelines.
暂无特定框架指南。