Sentry Go Sdk logo

Sentry Go Sdk

Organization
getsentry
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.

Overview

Publishergetsentry
Repositorysentry-for-ai
Skill namesentry-go-sdk
Stars
269
Forks
34
Bundled files
6
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 6 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by getsentry on GitHub. Read the source before you install it.

Installation

Install the Sentry Go Sdk AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/getsentry/sentry-for-ai/tree/main/skills-legacy/sentry-go-sdk
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/getsentry/sentry-for-ai.git /tmp/sentry-for-ai
mkdir -p .claude/skills
cp -r /tmp/sentry-for-ai/skills-legacy/sentry-go-sdk .claude/skills/sentry-go-sdk
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Sentry Go Sdk in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Sentry Go Sdk on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Sentry Go Sdk is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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:

bash
# 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-go already in go.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.md for alternatives

Recommendation logic:

FeatureRecommend when...
Error MonitoringAlways — non-negotiable baseline
Tracingnet/http, gin, echo, fiber, gRPC, or DB calls detected
Logginglogrus, zap, zerolog, or log/slog imports detected
MetricsBusiness events, SLO tracking, or counters needed
Cronsrobfig/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

bash
# 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:

go
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):

go
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:

FrameworkImport pathMiddleware callRepanicWaitForDelivery
net/http.../sentry-go/httpsentryhttp.New(opts).Handle(h)truefalse
Gin.../sentry-go/ginrouter.Use(sentrygin.New(opts))truefalse
Echo.../sentry-go/echoe.Use(sentryecho.New(opts))truefalse
Fiber.../sentry-go/fiberapp.Use(sentryfiber.New(opts))falsetrue
FastHTTP.../sentry-go/fasthttpsentryfasthttp.New(opts).Handle(h)falsetrue
Iris.../sentry-go/irisapp.Use(sentryiris.New(opts))truefalse
Negroni.../sentry-go/negronin.Use(sentrynegroni.New(opts))truefalse

Note: Fiber and FastHTTP are built on valyala/fasthttp which has no built-in recovery. Use Repanic: false, WaitForDelivery: true for those.

Hub access in handlers:

go
// 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:

go
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:

FeatureReference fileLoad when...
Error Monitoring${SKILL_ROOT}/references/error-monitoring.mdAlways (baseline)
Tracing${SKILL_ROOT}/references/tracing.mdHTTP handlers / distributed tracing
Profiling${SKILL_ROOT}/references/profiling.mdPerformance-sensitive production apps
Logging${SKILL_ROOT}/references/logging.mdlogrus / zap / zerolog / slog detected
Metrics${SKILL_ROOT}/references/metrics.mdBusiness KPIs / SLO tracking
Crons${SKILL_ROOT}/references/crons.mdScheduler / cron job patterns detected

For each feature: Read ${SKILL_ROOT}/references/<feature>.md, follow steps exactly, verify it works.


Configuration Reference

Key ClientOptions Fields

OptionTypeDefaultPurpose
Dsnstring""SDK disabled if empty; env: SENTRY_DSN
Environmentstring""e.g., "production"; env: SENTRY_ENVIRONMENT
Releasestring""e.g., "my-app@1.0.0"; env: SENTRY_RELEASE
SendDefaultPIIboolfalseInclude IP, request headers
AttachStacktraceboolfalseStack traces on CaptureMessage calls
SampleRatefloat641.0Error event sample rate (0.0 treated as 1.0)
EnableTracingboolfalseEnable performance tracing
TracesSampleRatefloat640.0Transaction sample rate
TracesSamplerTracesSamplernilCustom per-transaction sampling (overrides rate)
EnableLogsboolfalseEnable Sentry Logs feature
MaxBreadcrumbsint100Max breadcrumbs per event
MaxErrorDepthint100Max depth for unwrapping error chains
DebugboolfalseVerbose SDK debug output
BeforeSendfuncnilHook to mutate/drop error events
BeforeSendTransactionfuncnilHook to mutate/drop transaction events
IgnoreErrors[]stringnilRegex patterns for errors to drop
IgnoreTransactions[]stringnilRegex patterns for transactions to drop

Environment Variables

VariableMaps toPurpose
SENTRY_DSNDsnData Source Name
SENTRY_RELEASEReleaseApp version (e.g., my-app@1.0.0)
SENTRY_ENVIRONMENTEnvironmentDeployment environment
HTTP_PROXY / HTTPS_PROXYHTTPProxy / HTTPSProxyOutbound proxy

Options set in ClientOptions override environment variables.


Verification

Test that Sentry is receiving events:

go
// 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:

  1. Set Debug: true in ClientOptions — prints SDK internals to stdout
  2. Verify the DSN is correct and the project exists
  3. 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:

bash
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 detectedSuggest skill
React / Next.jssentry-react-sdk
Svelte / SvelteKitsentry-svelte-sdk
VueUse @sentry/vue — see docs.sentry.io/platforms/javascript/guides/vue/
Other JS/TSsentry-react-sdk (covers generic browser JS patterns)

Troubleshooting

IssueSolution
Events not appearingSet Debug: true, check DSN, verify sentry.Flush() is called
sentry.Init returns errorMalformed DSN — check format: https://<key>@o<org>.ingest.sentry.io/<project>
Panics not capturedEnsure framework middleware is registered before handlers
defer sentry.Flush not runningos.Exit() skips defer — call sentry.Flush() explicitly before os.Exit()
Missing stack tracesSet AttachStacktrace: true for CaptureMessage; works automatically for CaptureException
Goroutine events missing contextClone hub before spawning goroutine: hub := sentry.CurrentHub().Clone()
Too many transactionsLower TracesSampleRate or use TracesSampler to drop health checks / metrics endpoints
Fiber/FastHTTP not recoveringUse Repanic: false, WaitForDelivery: true for fasthttp-based frameworks
SampleRate: 0.0 sending all events0.0 is treated as 1.0; to drop all, set Dsn: "" instead

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Sentry Go Sdk AI 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.

Why use Sentry Go Sdk on TypingMind?

Because you install it once and use it with any model. Sentry Go Sdk is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Sentry Go Sdk in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/getsentry/sentry-for-ai/tree/main/skills-legacy/sentry-go-sdk. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Sentry Go Sdk?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Sentry Go Sdk?

As many as you like. As long as a model supports skills, you can use Sentry Go Sdk with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Sentry Go Sdk AI skill free?

Yes. It is published on GitHub by getsentry under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇