sentry-go

The official Go SDK for capturing errors, panics, and performance traces and sending them to Sentry.

SDK
Go
vv0.50.0
1,108 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
95 /100 Excellent
Development Activity 96
Maintenance 96
Community 88
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
86 /100 Excellent
Architecture 88
Code Quality 90
Innovation 85
Learning Curve 80

sentry-go is the official Go client for Sentry, the error-tracking and performance-monitoring platform. It captures unhandled panics and errors, attaches breadcrumbs and contextual scope data, and reports them to Sentry with stack traces resolved from Go’s runtime. Beyond error capture, it implements distributed tracing (transactions and spans), structured logging, and metrics, all configurable through a single ClientOptions struct passed to Init.

The SDK ships first-class middleware for a wide range of Go web frameworks and HTTP libraries — net/http, Gin, Echo, Fiber, Iris, fasthttp, gRPC, Negroni — plus adapters for popular loggers (logrus, slog, zap, zerolog) and an OpenTelemetry bridge, so most Go services can wire up error and performance monitoring with a few lines of setup code.

What You Get

  • Panic and error capture with resolved Go stack traces via CaptureException and Recover/RecoverWithContext
  • Distributed tracing with StartTransaction/StartSpan, trace propagation headers, and configurable sampling
  • Framework middleware for net/http, Gin, Echo, Fiber, Iris, fasthttp, gRPC, and Negroni
  • Logger integrations for logrus, slog, zap, and zerolog that forward log entries as breadcrumbs or events
  • Structured logging and metrics APIs alongside error/performance reporting
  • Configurable HTTP transports (async batching or HTTPSyncTransport for serverless) with rate-limit handling

Common Use Cases

  • Reporting unhandled panics from production HTTP servers with full stack traces and request context
  • Instrumenting distributed traces across microservices using StartTransaction and ContinueTrace
  • Correlating structured logs from logrus/zap/zerolog with Sentry events via breadcrumbs
  • Monitoring scheduled/cron jobs with CaptureCheckIn and MonitorConfig
  • Attaching custom user, tag, and extra-data context to errors via Scope

Under The Hood

Architecture

The SDK centers on a Hub/Scope/Client pattern (hub.go, scope.go, client.go): a Hub holds a stack of Scopes and a bound Client, and package-level functions in sentry.go (Init, CaptureException, Recover, WithScope) delegate to CurrentHub(). Context-based hub retrieval (GetHubFromContext/SetHubOnContext) enables per-request isolation — the http/sentryhttp.go middleware clones a fresh hub per request, starts a transaction, and defers panic recovery against that hub. The transport layer (transport.go) implements batching and rate-limit handling independently of capture logic, so swapping HTTPTransport for HTTPSyncTransport requires no changes elsewhere. Tracing (tracing.go) is a parallel subsystem built on Span/Transaction structs threaded through context.Context and consumed uniformly by the 13+ framework-integration packages. Wire-format, rate-limiting, and telemetry concerns are isolated under internal/, keeping the public API surface small; changing the Hub/Scope contract would require touching every framework integration and both context helpers.

Tech Stack

The root module (github.com/getsentry/sentry-go, go.mod, Go 1.25) carries minimal dependencies — go-errors/errors, pingcap/errors, and pkg/errors for compatibility across different error-wrapping styles, plus stretchr/testify, google/go-cmp, and uber-go/goleak for testing. Framework integrations (gin/, echo/, fiber/, grpc/, and others) live as separate Go modules coordinated through a root go.work file, so consumers only pull in the framework dependency they actually use rather than the full integration matrix. CI runs golangci-lint, govulncheck, and CodeQL across a Go version matrix.

Code Quality

307 test functions across 34 test files in the root package alone, with additional suites inside each framework-integration submodule. Tests use testify for assertions, go-cmp for deep-equal diffs, and goleak to catch goroutine leaks in the concurrency-heavy batch processor and telemetry code. Errors are returned rather than swallowed in the reviewed core files (client.go, sentry.go, http/sentryhttp.go), and CI enforces linting, dependency vulnerability scanning, and static analysis on every pull request.

API Design The public API is a small set of package-level functions (Init, CaptureException, CaptureMessage, Recover, WithScope) that delegate to a hidden global Hub, so a minimal integration is a single Init call plus a deferred Recover. Power users can reach the same functionality through an explicit context-scoped Hub for goroutine-safe, multi-tenant use. Configuration uses a declarative ClientOptions struct rather than functional options, and every framework integration follows the same New(Options) *Handler plus Handle/HandleFunc middleware shape, so moving between frameworks doesn’t require relearning the integration surface. Extensive godoc comments and 26 runnable examples under _examples/ shorten the path to a working integration.

Used by 17 apps in this directory

Go
84%
AGPL 3.0

Lago

Ecommerce · Invoicing Finance

10,709

Open-source metering, billing, and revenue infrastructure for product-led companies that need complete control over their pricing stack.

View details
90
Repo Health
81
Technical
75
Dependency
Built with
Go 84%
Updated 1 weeks ago
TypeScript
51%
Other

Mattermost

Collaboration · Devops · Team Chat

39,418

Open core, self-hosted team collaboration with chat, AI agents, voice calling, and deep DevOps integrations — all under your control.

View details
96
Repo Health
87
Technical
65
Dependency
Built with
TypeScript 51%
Go 40%
Updated 6 days ago
TypeScript
54%
Other

OpenReplay

Analytics

13,042

Self-hosted session replay and product analytics suite that lets you see exactly what users do on your web app — without sending data to third parties.

View details
91
Repo Health
77
Technical
66
Dependency
Built with
TypeScript 54%
Go 13%
Updated 1 weeks ago
Rust
66%
Apache 2.0

Temps

Analytics · Devops · Monitoring

865

A self-hosted Rust PaaS that replaces Vercel, Sentry, PostHog, Pingdom, Resend, and E2B with one binary — plus 440+ CLI operations agents like Claude Code can drive directly.

View details
81
Repo Health
86
Technical
66
Dependency
Built with
Rust 66%
TypeScript 33%
Updated 1 weeks ago
Go
54%
AGPL 3.0

Uptrace

Devops · Monitoring

4,305

Unified open-source APM that collects OpenTelemetry traces, metrics, and logs into a single self-hosted platform backed by ClickHouse.

View details
71
Repo Health
70
Technical
65
Dependency
Built with
Go 54%
Vue 34%
Updated 1 weeks ago
Go
66%
AGPL 3.0

Vikunja

Project Management

5,833

Self-hosted task management with natural-language quick-add, multiple views, and a fully documented REST API — your tasks, your infrastructure, zero lock-in.

View details
86
Repo Health
81
Technical
65
Dependency
Built with
Go 66%
TypeScript 24%
Updated 6 days ago
Go
79%
MIT

Wakapi

Analytics · Developer Tools

4,462

Self-hosted WakaTime-compatible coding statistics backend that gives developers full control over their coding activity data.

View details
89
Repo Health
77
Technical
72
Dependency
Built with
Go 79%
HTML 11%
Updated 1 weeks ago
Go
97%
BSD 3

Weaviate

Databases · Search

16,908

Open-source vector database combining semantic search, hybrid queries, RAG, and image search in a single cloud-native system built for production scale.

View details
91
Repo Health
85
Technical
68
Dependency
Built with
Go 97%
Updated 1 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers