sentry-go-sdk

Configure Sentry error monitoring, tracing, logging, metrics, and crons for Go applications.

Updated Apr 22, 2026
One-click install
npx skills add https://github.com/imrishuroy/algopatterns --skill sentry-go-sdk-imrishuroy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sentry-go-sdk
Source: https://github.com/imrishuroy/algopatterns/tree/main/.agents/skills/sentry-go-sdk
Command: npx skills add https://github.com/imrishuroy/algopatterns --skill sentry-go-sdk-imrishuroy

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Setting up Sentry in a Go application requires choosing the right framework middleware, logging integration, and feature configuration across many SDK sub-packages. This Skill scans your Go project, detects your framework and libraries, and guides you through a complete, verified Sentry setup. ## Core Features & Use Cases - Project Detection: Scans go.mod to detect frameworks (Gin, Echo, Fiber, FastHTTP, Iris, Negroni, net/http, gRPC), logging libraries (logrus, zap, zerolog, slog), cron schedulers, and OpenTelemetry usage. - Feature-Guided Setup: Walks through Error Monitoring, Tracing, Logging, Metrics, and Crons one at a time using detailed reference guides with verified code examples. - Framework Middleware & gRPC: Provides exact middleware registration patterns, hub access methods, and gRPC interceptors for each supported framework. - Use Case: You have a Gin-based REST API using zerolog and robfig/cron. The Skill detects all three, installs the correct sentry-go sub-packages, configures error capture with middleware, enables tracing, and sets up cron check-ins for your scheduled jobs. ## Quick Start Ask the AI to add Sentry to your Go project and it will scan your dependencies, recommend features, and configure the SDK step by step.

Frequently Asked Questions about sentry-go-sdk

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add Sentry to a Go application?

Install github.com/getsentry/sentry-go, call sentry.Init with your DSN in main(), and defer sentry.Flush(2 * time.Second). Then register the middleware matching your framework, such as sentrygin.New for Gin or sentryhttp for net/http.

How do I set up Sentry middleware for Gin in Go?

Install github.com/getsentry/sentry-go/gin and register it with router.Use(sentrygin.New(sentrygin.Options{Repanic: true})). Inside handlers, access the hub via sentrygin.GetHubFromContext(c) to capture errors or start spans.

Does sentry-go support profiling?

No. Profiling was removed in sentry-go v0.31.0 and ProfilesSampleRate no longer compiles. Use standard pprof via net/http/pprof or external continuous profiling services like Pyroscope instead.

Which logging libraries integrate with sentry-go?

The SDK provides sub-packages for logrus, slog, zerolog, and zap. Logrus and slog support both Sentry Logs and error events, zerolog sends events and breadcrumbs, and zap (v0.43.0+) sends Sentry Logs when EnableLogs is true.

Why are my Sentry events not appearing in Go?

Events are sent asynchronously, so missing sentry.Flush() before exit is the most common cause. Also verify the DSN is correct, set Debug: true in ClientOptions for diagnostics, and note that os.Exit() skips deferred Flush calls.

How do I monitor cron jobs with Sentry in Go?

Use sentry.CaptureCheckIn with a MonitorConfig defining the schedule, MaxRuntime, and CheckInMargin. Send an InProgress check-in when the job starts and an OK or Error check-in on completion to detect missed and timed-out jobs.