
sentry-go-sdk
Full Sentry SDK setup for Go. Use when asked to "add Sentry to Go", "install sentry-go", "setup Sentry in Go", or configure error monitoring, tracing, logging, metrics, or crons for Go applications. Supports net/http, Gin, Echo, Fiber, FastHTTP, Iris, Negroni, and gRPC.
- Installs
- 2.2K
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/getsentry/sentry-for-ai --skill sentry-go-sdk- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads sentry-go-sdk automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
All Skills > SDK Setup > Go SDK
Sentry Go SDK
Opinionated wizard that scans your Go project and guides you through complete Sentry setup.
Invoke This Skill When
- User asks to "add Sentry to Go" or "setup Sentry" in a Go app
- User wants error monitoring, tracing, logging, metrics, or crons in Go
- User mentions
sentry-go,github.com/getsentry/sentry-go, or Go Sentry SDK - User wants to monitor panics, HTTP handlers, or scheduled jobs in Go
Note: SDK versions and APIs below reflect Sentry docs at time of writing (sentry-go v0.43.0+). As of v0.33.0+, the SDK requires Go 1.25 or later (supports the two most recent Go major versions). Always verify against docs.sentry.io/platforms/go/ before implementing.
Phase 1: Detect
Run these commands to understand the project before making any recommendations:
# Check existing Sentry dependency
grep -i sentry go.mod 2>/dev/null
# Detect web framework
grep -E "gin-gonic/gin|labstack/echo|gofiber/fiber|valyala/fasthttp|kataras/iris|urfave/negroni" go.mod 2>/dev/null
# Detect gRPC
grep "google.golang.org/grpc" go.mod 2>/dev/null
# Detect logging libraries
grep -E "sirupsen/logrus|go.uber.org/zap|rs/zerolog|log/slog" go.mod go.sum 2>/dev/null
# Detect cron / scheduler patterns
grep -E "robfig/cron|go-co-op/gocron|jasonlvhit/gocron" go.mod 2>/dev/null
# Detect OpenTelemetry usage
grep "go.opentelemetry.io" go.mod 2>/dev/null
# Check for companion frontend
ls frontend/ web/ client/ ui/ 2>/dev/null
What to note:
- Is
sentry-goalready ingo.mod? If yes, skip to Phase 2 (configure features). - Which framework is used? (Determines which sub-package and middleware to install.)
- Which logging library? (Enables automatic log capture.)
- Are cron/scheduler patterns present? (Triggers Crons recommendation.)
- Is there a companion frontend directory? (Triggers Phase 4 cross-link.)
Phase 2: Recommend
Based on what you found, present a concrete recommendation. Don't ask open-ended questions — lead with a proposal:
Recommended (core coverage):
- ✅ Error Monitoring — always; captures panics and unhandled errors
- ✅ Tracing — if HTTP handlers, gRPC, or DB calls are detected
- ✅ Logging — if logrus, zap, zerolog, or slog is detected
Optional (enhanced observability):
- ⚡ Metrics — custom counters and gauges for business KPIs / SLOs
- ⚡ Crons — detect silent failures in scheduled jobs
- ⚠️ Profiling — removed in sentry-go v0.31.0; see
references/profiling.mdfor alternatives
Recommendation logic:
| Feature | Recommend when... |
|---|---|
| Error Monitoring | Always — non-negotiable baseline |
| Tracing | net/http, gin, echo, fiber, gRPC, or DB calls detected |
| Logging | logrus, zap, zerolog, or log/slog imports detected |
| Metrics | Business events, SLO tracking, or counters needed |
| Crons | robfig/cron, gocron, or scheduled job patterns detected |
| Profiling | ⚠️ Removed in v0.31.0 — do not recommend; see references/profiling.md |
Propose: "I recommend setting up Error Monitoring + Tracing [+ Logging if applicable]. Want me to also add Metrics or Crons?"
Phase 3: Guide
Install
# Core SDK (always required)
go get github.com/getsentry/sentry-go
# Framework sub-package — install only what matches detected framework:
go get github.com/getsentry/sentry-go/http # net/http
go get github.com/getsentry/sentry-go/gin # Gin
go get github.com/getsentry/sentry-go/echo # Echo
go get github.com/getsentry/sentry-go/fiber # Fiber
go get github.com/getsentry/sentry-go/fasthttp # FastHTTP
# Logging sub-packages — install only what matches detected logging lib:
go get github.com/getsentry/sentry-go/logrus # Logrus
go get github.com/getsentry/sentry-go/slog # slog (stdlib, Go 1.21+)
go get github.com/getsentry/sentry-go/zap # Zap
go get github.com/getsentry/sentry-go/zerolog # Zerolog
# gRPC interceptors (only if google.golang.org/grpc is detected):
go get github.com/getsentry/sentry-go/grpc
# OpenTelemetry bridge (only if OTel is already in use):
go get github.com/getsentry/sentry-go/otel
Quick Start — Recommended Init
Add to main() before any other code. This config enables the most features with sensible defaults:
import (
"log"
"os"
"time"
"github.com/getsentry/sentry-go"
)
err := sentry.Init(sentry.ClientOptions{
Dsn: os.Getenv("SENTRY_DSN"),
Environment: os.Getenv("SENTRY_ENVIRONMENT"), // "production", "staging", etc.
Release: release, // inject via -ldflags at build time
SendDefaultPII: true,
AttachStacktrace: true,
// Tracing (adjust sample rate for production)
EnableTracing: true,
TracesSampleRate: 1.0, // lower to 0.1–0.2 in high-traffic production
// Logs
EnableLogs: true,
})
if err != nil {
log.Fatalf("sentry.Init: %s", err)
}
defer sentry.Flush(2 * time.Second)
Injecting Release at build time (recommended):
var release string // set by -ldflags
// go build -ldflags="-X main.release=my-app@$(git describe --tags)"
Framework Middleware
After sentry.Init, register the Sentry middleware for your framework:
| Framework | Import path | Middleware call | Repanic | WaitForDelivery |
|---|---|---|---|---|
net/http | .../sentry-go/http | sentryhttp.New(opts).Handle(h) | true | false |
| Gin | .../sentry-go/gin | router.Use(sentrygin.New(opts)) | true | false |
| Echo | .../sentry-go/echo | e.Use(sentryecho.New(opts)) | true | false |
| Fiber | .../sentry-go/fiber | app.Use(sentryfiber.New(opts)) | false | true |
| FastHTTP | .../sentry-go/fasthttp | sentryfasthttp.New(opts).Handle(h) | false | true |
| Iris | .../sentry-go/iris | app.Use(sentryiris.New(opts)) | true | false |
| Negroni | .../sentry-go/negroni | n.Use(sentrynegroni.New(opts)) | true | false |
Note: Fiber and FastHTTP are built on
valyala/fasthttpwhich has no built-in recovery. UseRepanic: false, WaitForDelivery: truefor those.
Hub access in handlers:
// net/http, Negroni:
hub := sentry.GetHubFromContext(r.Context())
// Gin:
hub := sentrygin.GetHubFromContext(c)
// Echo:
hub := sentryecho.GetHubFromContext(c)
// Fiber:
hub := sentryfiber.GetHubFromContext(c)
gRPC Integration
For gRPC servers and clients, use the sentrygrpc interceptors instead:
import sentrygrpc "github.com/getsentry/sentry-go/grpc"
// Server: register interceptors when creating the gRPC server
server := grpc.NewServer(
grpc.UnaryInterceptor(sentrygrpc.UnaryServerInterceptor()),
grpc.StreamInterceptor(sentrygrpc.StreamServerInterceptor()),
)
// Client: register interceptors when dialing
conn, err := grpc.NewClient(
address,
grpc.WithUnaryInterceptor(sentrygrpc.UnaryClientInterceptor()),
grpc.WithStreamInterceptor(sentrygrpc.StreamClientInterceptor()),
)
// Hub access inside a gRPC handler:
hub := sentry.GetHubFromContext(ctx)
For Each Agreed Feature
Walk through features one at a time. Load the reference file for each, follow its steps, and verify before moving to the next:
| Feature | Reference file | Load when... |
|---|---|---|
| Error Monitoring | ${SKILL_ROOT}/references/error-monitoring.md | Always (baseline) |
| Tracing | ${SKILL_ROOT}/references/tracing.md | HTTP handlers / distributed tracing |
| Profiling | ${SKILL_ROOT}/references/profiling.md | Performance-sensitive production apps |
| Logging | ${SKILL_ROOT}/references/logging.md | logrus / zap / zerolog / slog detected |
| Metrics | ${SKILL_ROOT}/references/metrics.md | Business KPIs / SLO tracking |
| Crons | ${SKILL_ROOT}/references/crons.md | Scheduler / cron job patterns detected |
For each feature: Read ${SKILL_ROOT}/references/<feature>.md, follow steps exactly, verify it works.
Configuration Reference
Key ClientOptions Fields
| Option | Type | Default | Purpose |
|---|---|---|---|
Dsn | string | "" | SDK disabled if empty; env: SENTRY_DSN |
Environment | string | "" | e.g., "production"; env: SENTRY_ENVIRONMENT |
Release | string | "" | e.g., "my-app@1.0.0"; env: SENTRY_RELEASE |
SendDefaultPII | bool | false | Include IP, request headers |
AttachStacktrace | bool | false | Stack traces on CaptureMessage calls |
SampleRate | float64 | 1.0 | Error event sample rate (0.0 treated as 1.0) |
EnableTracing | bool | false | Enable performance tracing |
TracesSampleRate | float64 | 0.0 | Transaction sample rate |
TracesSampler | TracesSampler | nil | Custom per-transaction sampling (overrides rate) |
EnableLogs | bool | false | Enable Sentry Logs feature |
MaxBreadcrumbs | int | 100 | Max breadcrumbs per event |
MaxErrorDepth | int | 100 | Max depth for unwrapping error chains |
Debug | bool | false | Verbose SDK debug output |
BeforeSend | func | nil | Hook to mutate/drop error events |
BeforeSendTransaction | func | nil | Hook to mutate/drop transaction events |
IgnoreErrors | []string | nil | Regex patterns for errors to drop |
IgnoreTransactions | []string | nil | Regex patterns for transactions to drop |
Environment Variables
| Variable | Maps to | Purpose |
|---|---|---|
SENTRY_DSN | Dsn | Data Source Name |
SENTRY_RELEASE | Release | App version (e.g., my-app@1.0.0) |
SENTRY_ENVIRONMENT | Environment | Deployment environment |
HTTP_PROXY / HTTPS_PROXY | HTTPProxy / HTTPSProxy | Outbound proxy |
Options set in ClientOptions override environment variables.
Verification
Test that Sentry is receiving events:
// In a handler or test — triggers a real error event:
sentry.CaptureMessage("Sentry Go SDK test")
// Or trigger a captured panic (with recovery middleware in place):
panic("sentry test panic")
Check the Sentry dashboard within a few seconds. If nothing appears:
- Set
Debug: trueinClientOptions— prints SDK internals to stdout - Verify the DSN is correct and the project exists
- Ensure
sentry.Flush(2 * time.Second)is called (events are async by default)
Phase 4: Cross-Link
After completing Go setup, check for a companion frontend missing Sentry coverage:
ls frontend/ web/ client/ ui/ 2>/dev/null
cat frontend/package.json web/package.json 2>/dev/null | grep -E '"react"|"svelte"|"vue"|"next"'
If a frontend directory exists without Sentry configured, suggest the matching skill:
| Frontend detected | Suggest skill |
|---|---|
| React / Next.js | sentry-react-sdk |
| Svelte / SvelteKit | sentry-svelte-sdk |
| Vue | Use @sentry/vue — see docs.sentry.io/platforms/javascript/guides/vue/ |
| Other JS/TS | sentry-react-sdk (covers generic browser JS patterns) |
Troubleshooting
| Issue | Solution |
|---|---|
| Events not appearing | Set Debug: true, check DSN, verify sentry.Flush() is called |
sentry.Init returns error | Malformed DSN — check format: https://<key>@o<org>.ingest.sentry.io/<project> |
| Panics not captured | Ensure framework middleware is registered before handlers |
defer sentry.Flush not running | os.Exit() skips defer — call sentry.Flush() explicitly before os.Exit() |
| Missing stack traces | Set AttachStacktrace: true for CaptureMessage; works automatically for CaptureException |
| Goroutine events missing context | Clone hub before spawning goroutine: hub := sentry.CurrentHub().Clone() |
| Too many transactions | Lower TracesSampleRate or use TracesSampler to drop health checks / metrics endpoints |
| Fiber/FastHTTP not recovering | Use Repanic: false, WaitForDelivery: true for fasthttp-based frameworks |
SampleRate: 0.0 sending all events | 0.0 is treated as 1.0; to drop all, set Dsn: "" instead |
FAQ
What does the sentry-go-sdk skill do?
Full Sentry SDK setup for Go. Use when asked to "add Sentry to Go", "install sentry-go", "setup Sentry in Go", or configure error monitoring, tracing, logging, metrics, or crons for Go applications. Supports net/http, Gin, Echo, Fiber, FastHTTP, Iris, Negroni, and gRPC.
How do I install sentry-go-sdk?
Run npx skills add https://github.com/getsentry/sentry-for-ai --skill sentry-go-sdk in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/sentry-go-sdk/ (personal) or .claude/skills/sentry-go-sdk/ (project).
Which AI agents can use sentry-go-sdk?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is sentry-go-sdk safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains sentry-go-sdk?
It is published by getsentry in getsentry/sentry-for-ai, and it is an official skill from the maker of the technology it covers. It has 2,196 recorded installs.
More from getsentry/sentry-for-ai
sentry-fix-issues
getsentry/sentry-for-ai
Find and fix issues from Sentry using MCP. Use when asked to fix Sentry errors, debug production issues, investigate exceptions, or resolve bugs reported in Sentry. Methodically analyzes stack traces, breadcrumbs, traces, and context to identify root causes.
sentry-react-native-sdk
getsentry/sentry-for-ai
Full Sentry SDK setup for React Native and Expo. Use when asked to "add Sentry to React Native", "install @sentry/react-native", "setup Sentry in Expo", or configure error monitoring, tracing, profiling, session replay, or logging for React Native applications. Supports Expo managed, Expo bare, and vanilla React Native.
sentry-create-alert
getsentry/sentry-for-ai
Create Sentry alerts using the workflow engine API. Use when asked to create alerts, set up notifications, configure issue priority alerts, or build workflow automations. Supports email, Slack, PagerDuty, Discord, and other notification actions.
sentry-nextjs-sdk
getsentry/sentry-for-ai
Full Sentry SDK setup for Next.js. Use when asked to "add Sentry to Next.js", "install @sentry/nextjs", or configure error monitoring, tracing, session replay, logging, profiling, AI monitoring, or crons for Next.js applications. Supports Next.js 13+ with App Router and Pages Router.
sentry-sdk-setup
getsentry/sentry-for-ai
Set up Sentry in any language or framework. Detects the user's platform and loads the right SDK skill. Use when asked to add Sentry, install an SDK, or set up error monitoring in a project.
sentry-workflow
getsentry/sentry-for-ai
Keep Sentry SDKs up to date. Use when asked to upgrade the Sentry SDK across major versions, migrate SDK versions, or fix deprecated APIs.
Popular devops & cloud skills
microsoft-foundry
microsoft/azure-skills
Build, deploy, evaluate, optimize, fine-tune, and manage Microsoft Foundry agents, models, and resources end to end. USE FOR: foundry, azd ai agent, azd provision/deploy, hosted agent scaffold/develop/run/deploy/troubleshoot, prompt agent create, managed harness agent create, GitHub Copilot harness agent, create agent, update agent, add tool to agent, invoke agent, agent insights, evaluate agent, batch eval, continuous eval, continuous monitoring, agent CI/CD, optimize prompt, improve prompt, optimize agent instructions, Agent Optimizer scaffold, dataset curation from traces, deploy model, model fine-tuning (SFT/DPO/RFT), Foundry project, RBAC, role assignment, permissions, quota, capacity, region, deployment failure, AI Services, create Foundry resource, knowledge index, customize deployment, onboard, availability, training-data, grader, distillation, large file upload. DO NOT USE FOR: Azure Functions, App Service, general Azure deploy (use azure-deploy), general Azure prep (use azure
azure-diagnostics
microsoft/azure-skills
Debug Azure production issues on Azure using AppLens, Azure Monitor, resource health, and safe triage. WHEN: debug production issues, troubleshoot app service, app service high CPU, app service deployment failure, troubleshoot container apps, container app 503 or target port mismatch, troubleshoot functions, function telemetry missing or stopped after a config/connection-string change, troubleshoot AKS, VM RDP, Linux SSH, VM black screen, can't connect to VM, reset VM password, NSG or firewall blocking, kubectl cannot connect, kube-system/CoreDNS failures, pod pending, crashloop, node not ready, upgrade failures, analyze logs, KQL, insights, image pull failures, cold start issues, health probe failures, resource health, root cause of errors, troubleshoot event hubs, troubleshoot service bus, messaging SDK error, AMQP connection failure, message lock lost, lock renewal during long-running processing, service bus dead letter.
azure-prepare
microsoft/azure-skills
Prepare azd-based Azure projects for deployment: generates azure.yaml, infrastructure (Bicep/Terraform), and Dockerfiles for the Azure Developer CLI (azd) workflow. USE ONLY when the user explicitly wants to use azd as the deployment tool, or the project already has an azure.yaml file. DO NOT USE FOR: non-azd deployments, Python App Service code-only deploys (use python-appservice-deploy), or cross-cloud migration (use azure-cloud-migrate). WHEN: prepare app for azd, create azure.yaml, set up azd infrastructure, modernize app for Azure with azd, deploy with azd, function app, timer trigger, service bus trigger, event-driven function, managed identity, generate Bicep, generate Terraform, create and deploy to Azure.
azure-ai
microsoft/azure-skills
Use for Azure AI: Search, Speech, OpenAI, Document Intelligence. Helps with search, vector/hybrid search, speech-to-text, text-to-speech, transcription, OCR. WHEN: AI Search, query search, vector search, hybrid search, semantic search, speech-to-text, text-to-speech, transcribe, OCR, convert text to speech.
azure-deploy
microsoft/azure-skills
Execute Azure deployments for ALREADY-PREPARED applications that have existing .azure/deployment-plan.md and infrastructure files. DO NOT use this skill when the user asks to CREATE a new application — use azure-prepare instead. This skill runs azd up, azd deploy, terraform apply, and az deployment commands with built-in error recovery. Requires .azure/deployment-plan.md from azure-prepare and validated status from azure-validate. WHEN: "run azd up", "run azd deploy", "execute deployment", "push to production", "push to cloud", "go live", "ship it", "bicep deploy", "terraform apply", "publish to Azure", "launch on Azure". DO NOT USE WHEN: "create and deploy", "build and deploy", "create a new app", "set up infrastructure", "create and deploy to Azure using Terraform" — use azure-prepare for these.
azure-validate
microsoft/azure-skills
Pre-deployment validation for Azure readiness. Run deep checks on configuration, infrastructure (Bicep or Terraform), RBAC role assignments, managed identity permissions, and prerequisites before deploying. WHEN: validate my app, check deployment readiness, run preflight checks, verify configuration, check if ready to deploy, validate azure.yaml, validate Bicep, test before deploying, troubleshoot deployment errors, validate Azure Functions, validate function app, validate serverless deployment, verify RBAC roles, check role assignments, review managed identity permissions, what-if analysis, validate Container Apps deployment.