Repository navigation
Releases
Releases · getsentry/sentry-go
1.0.0-alpha.1
Breaking Changes 🛠
- Replace the event-based transports with envelope-based ones. Custom transports need to implement the new
Transportinterface. See the transport section of the migration guide for details. by @giortzisg in #1427- Custom transports need to implement
SendEnvelope(ctx, envelope)in place ofSendEvent(event), andFlushWithContext(ctx)in place ofFlush(timeout). The envelope types live in the new publicprotocolpackage. - The transport
Timeoutnow applies to every request, including when a customHTTPClientis set. ClientOptions.DisableTelemetryBufferis removed. The telemetry buffer is always used.- Transport
BufferSizenow counts envelopes instead of events, and defaults to 1000 instead of 30.
// Before func (t *customTransport) SendEvent(event *sentry.Event) {} func (t *customTransport) Flush(timeout time.Duration) bool { return true } // After func (t *customTransport) SendEnvelope(ctx context.Context, envelope *protocol.Envelope) error { return nil } func (t *customTransport) FlushWithContext(ctx context.Context) bool { return true }
- Custom transports need to implement
- Remove the
HubAPI. Scopes and clients are now carried oncontext.Context, so users need to pass the request or job context to Sentry functions instead of using a hub. See the migration guide for every replacement. by @giortzisg in #1407CaptureException,CaptureMessage,CaptureEvent,CaptureCheckIn,AddBreadcrumb,RecoverandWithMonitornow take a context as their first argument. Hints and levels are passed as options, such assentry.WithEventHint(hint)andsentry.WithLevel(level).- Use
ctx, scope := sentry.WithScope(ctx)to isolate data for a request or job, instead of cloning a hub or callingPushScope. Usesentry.GlobalScope()for application-wide data, instead ofConfigureScope. - Use
sentry.ScopeFromContext(ctx)andsentry.ClientFromContext(ctx)to read the current scope and client, andsentry.ContextWithScopeandsentry.ContextWithClientto attach your own, instead ofNewHubandSetHubOnContext. - In Gin, Echo, Iris, Fiber and FastHTTP handlers, call the integration's
GetContext(c)and pass the result to Sentry functions.GetHubFromContext,SetHubOnContextandGetSpanFromContextare removed. - Use
sentry.ContinueFromHeaders(trace, baggage)to continue a trace andsentry.SpanFromContext(ctx)to read the active span.ContinueTrace,ContinueFromTrace,Scope.GetSpanandScope.SetSpanare removed. EventModifierand theClient.EventFromMessage,EventFromExceptionandEventFromCheckInhelpers are removed. UseBeforeSendor an event processor to modify events.- Tags and a level set directly on an event are no longer overwritten by the scope.
sentry.AddBreadcrumbandsentry.LastEventIDneed a context that carries a scope. On a bare context such ascontext.Background()the breadcrumb is dropped and the ID is empty. Users should create a scope withsentry.WithScopefirst.- A context that carries neither a scope nor a span, such as
context.Background(), no longer propagates a trace.GetTraceparent,GetTraceparentW3CandGetBaggagereturn an empty string for it, outgoing HTTP and gRPC requests made with it carry no trace headers, and each event, log and metric captured with it gets its own trace ID. Requests handled by the middleware and contexts fromsentry.WithScopeare unaffected.
// Before: isolate a request hub := sentry.CurrentHub().Clone() hub.Scope().SetTag("route", "checkout") ctx := sentry.SetHubOnContext(r.Context(), hub) hub.CaptureException(err) // After: isolate a request ctx, scope := sentry.WithScope(r.Context()) scope.SetTag("route", "checkout") sentry.CaptureException(ctx, err) // Before: use your own client hub := sentry.NewHub(client, sentry.NewScope()) ctx := sentry.SetHubOnContext(r.Context(), hub) // After: use your own client ctx := sentry.ContextWithClient(r.Context(), client) // Before, in a Gin handler sentrygin.GetHubFromContext(c).CaptureException(err) // After, in a Gin handler sentry.CaptureException(sentrygin.GetContext(c), err)
- The Logrus and Zerolog integrations now take a
context.Context. A client can now be attached to a context withsentry.ContextWithClient, so the separate client-specific constructors are no longer needed. The integrations now use the client initialized fromsentry.Init. by @giortzisg in #1417- Logrus: remove
NewLogHookFromClient,Hook.SetHubProvider,Hook.SetFallbackandFallbackFunc.NewLogHookno longer creates a client or returns an error. - Zerolog: remove
ConfigandNewWithHub. Client options move tosentry.Initorsentry.NewClient.
// Before hook, err := sentrylogrus.NewLogHook(levels, clientOptions) hook := sentrylogrus.NewLogHookFromClient(levels, client) writer, err := sentryzerolog.New(sentryzerolog.Config{ClientOptions: clientOptions, Options: writerOptions}) writer, err := sentryzerolog.NewWithHub(hub, writerOptions) // After: uses the client from sentry.Init hook := sentrylogrus.NewLogHook(ctx, levels) writer, err := sentryzerolog.New(ctx, writerOptions) // After: with a dedicated client ctx = sentry.ContextWithClient(ctx, client) hook := sentrylogrus.NewLogHook(ctx, levels) writer, err := sentryzerolog.New(ctx, writerOptions)
- Logrus: remove
- Add support for Go 1.27 and raise the minimum supported Go version to 1.26 by @giortzisg in #1409
New Features ✨
- (docs) Add migration guide for v1 by @giortzisg in #1457
Internal Changes 🔧
- (deps) Bump golangci-lint to 1.24 by @giortzisg in #1451
0.50.0
Breaking Changes 🛠
- adds NoopClient implementation. The SDK now returns a non-nil noop client and handles the previous nil checks with checking for a disabled client. Code paths that were using nil checks now need to check for
client.IsEnabled. by @giortzisg in #1365
New Features ✨
Crons
- Add
sentry.WithMonitorandHub.WithMonitorto wrap a job in cron check-ins and create or update the monitor from code. by @wedamija in #1443 - Add
sentrycron.AddFuncto report robfig/cron jobs to Sentry Crons, using the job's spec as the monitor schedule. by @wedamija in #1443 - Docs: getsentry/sentry-docs#19778 by @wedamija in #1443
Bug Fixes 🐛
- (dsn) Build envelope URL without re-parsing by @giortzisg in #1436
- (httpclient) Decouple span creation from trace propagation by @giortzisg in #1421
- (slog) Stop replaceAttrs from mutating the handler's grouped attrs by @breken-ai in #1439
- (zerolog) Unescape JSON string values before sending to Sentry by @breken-ai in #1440
- Guard concurrent flushes by @giortzisg in #1449
- Keep http.Hijacker when wrapping a response writer by @knQzx in #1387
Internal Changes 🔧
Deps
- Bump getsentry/craft from 2.30.1 to 2.31.2 by @dependabot in #1441
- Bump getsentry/github-workflows/validate-pr from 4013fc6e1aeb1be1f9d3b4d232624f0ec1afa613 to 36c729264d2edc29ebae61950c50e1e9f043ad7e by @dependabot in #1442
- Bump go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp from 1.43.0 to 1.45.0 in /otel/otlp by @dependabot in #1430
- Bump go.opentelemetry.io/otel/sdk from 1.44.0 to 1.45.0 by @dependabot in #1431
- Bump google.golang.org/grpc from 1.83.1 to 1.83.2 by @dependabot in #1422
- Bump getsentry/craft from 2.27.2 to 2.30.1 by @dependabot in #1411
- Bump google.golang.org/grpc from 1.82.1 to 1.83.1 by @dependabot in #1413
0.49.0
Breaking Changes 🛠
- removing DisableLogs and DisableMetrics client options. Sending metrics and logs is already gated by the usage of our APIs already, so having a global kill switch is counter intuitive. Users that won't to opt out should just not call the relevant APIs or setup the integrations. by @giortzisg in #1392
New Features ✨
- add
WithProxyoption for OTLP. This allows setting anotlptracehttp.HTTPTransportProxyFuncfor the span exporter by @pierrre in #1377
Bug Fixes 🐛
- (echo) Propagate span through request context by @EricGusmao in #1385
- Skip recover frames on panic. This changes stacktrace behavior for captured panics, removing
sentry.Recoverframes to focus on the actual panic frames. The changes might affect issue grouping. by @giortzisg in #1364
Internal Changes 🔧
Deps
- Bump github.com/labstack/echo/v5 from 5.0.3 to 5.2.0 in /echo by @dependabot in #1399
- Bump github.com/gorilla/websocket from 1.5.1 to 1.5.3 by @dependabot in #1397
- Bump getsentry/craft from 2.26.6 to 2.27.2 by @dependabot in #1381
- Bump actions/setup-go from 6.4.0 to 7.0.0 by @dependabot in #1382
- Bump actions/checkout from 6.0.3 to 7.0.1 by @dependabot in #1380
- Bump google.golang.org/grpc to 1.82.1 and golang.org/x/sys to 0.46.0 by @dependabot in #1375
- Bump golang.org/x/text to v0.39.0 and x/net to v0.56.0 by @giortzisg in #1374
0.48.0
Breaking Changes 🛠
- Remove issue creation from logging integrations by @giortzisg in #1340
New Features ✨
- Add
ClientOptions.DataCollectionfor granular control over data collected by automatic instrumentation, replacing the broadSendDefaultPIIswitch.DataCollectioncan independently configure automaticuser.*population, cookies, request/response headers, HTTP bodies, and query parameters. When configured, it is the source of truth andSendDefaultPIIis ignored. by @giortzisg in #1339- For backwards compatibility, clients that do not configure
DataCollectionkeep a best-effort mapping of the previousSendDefaultPIIbehavior. To opt in to the new defaults, pass an emptyDataCollectionand then restrict individual categories as needed.
sentry.Init(sentry.ClientOptions{ Dsn: "https://public@example.com/1", // Opt in to the new data collection defaults. Omitted fields use their // defaults: user info, cookies, headers, query params, and supported HTTP // bodies are collected, with sensitive values filtered. DataCollection: &sentry.DataCollection{}, })
- To opt in while disabling automatic user info and HTTP bodies, configure those fields explicitly:
sentry.Init(sentry.ClientOptions{ Dsn: "https://public@example.com/1", DataCollection: &sentry.DataCollection{ UserInfo: sentry.Set(false), HTTPBodies: []sentry.BodyType{}, }, })
- For backwards compatibility, clients that do not configure
- PushScope shorthand now returns the new scope reference by @DoctorJohn in #1335
Bug Fixes 🐛
- Fix fiber route name when using middlewares by @giortzisg in #1363
- Omit empty event id for standalone client reports by @giortzisg in #1362
- Preserve '%' literal in log messages by @giortzisg in #1358
- Unaligned 64-bit atomic panic on 32-bit platforms in telemetry buffers by @Kirill-INQ in #1355
- Isolate event processor across clones by @giortzisg in #1337
Internal Changes 🔧
Deps
- Bump fiber/v2 to 2.52.14 by @giortzisg in #1359
- Bump actions/checkout from 6.0.3 to 7.0.0 by @dependabot in #1349
- Bump golangci/golangci-lint-action from 9.2.1 to 9.3.0 by @dependabot in #1346
- Bump codecov/codecov-action from 6.0.0 to 7.0.0 by @dependabot in #1347
- Bump actions/setup-go from 6.4.0 to 6.5.0 by @dependabot in #1343
- Bump golang.org/x/crypto to 0.52.0 and golang/x/net to 0.55.0 by @giortzisg in #1341
- Bump getsentry/github-workflows/validate-pr from c802283cd9075b7a2b7a32655019c21c21676e34 to 4013fc6e1aeb1be1f9d3b4d232624f0ec1afa613 by @dependabot in #1344
Other
- Remove changelog-preview and codecov actions by @giortzisg in #1357
- Add govulncheck audit action by @giortzisg in #1342
- Limit changelog-preview secret access by @giortzisg in #1350
- Move limited buffer under utils by @giortzisg in #1338
0.47.0
Breaking Changes 🛠
- Fix
transaction_infosource getting set incorrectly across HTTP middleware integrations (http, fasthttp, fiber). Users should now expect traces to properly get grouped with their parameterized path. Transactions in affected integrations may regroup after upgrading. by @giortzisg in #1325 - remove deprecated
otel.NewSentrySpanProcessor. Users should now use thesentryotlp.NewTraceExporterinstead by @giortzisg in #1307// Before sentry.Init(sentry.ClientOptions{Dsn: dsn, EnableTracing: true, TracesSampleRate: 1.0}) tp := sdktrace.NewTracerProvider( sdktrace.WithSpanProcessor(sentryotel.NewSentrySpanProcessor()), ) otel.SetTextMapPropagator(sentryotel.NewSentryPropagator()) otel.SetTracerProvider(tp) // After: sentry.Init(sentry.ClientOptions{ Dsn: dsn, EnableTracing: true, TracesSampleRate: 1.0, Integrations: func(i []sentry.Integration) []sentry.Integration { return append(i, sentryotel.NewOtelIntegration()) }, }) exporter, _ := sentryotlp.NewTraceExporter(ctx, dsn) tp := sdktrace.NewTracerProvider(sdktrace.WithBatcher(exporter)) otel.SetTracerProvider(tp)
- Enable logs by default to skip double allow behavior. Enabling logs now happens once when setting up either
sentry.NewLoggeror any supported integration. Also the EnableLogs flag changes to DisableLogs for a global override switch by @giortzisg in #1306 - Remove the
ContextifyFramesintegration. The recommended way to add source context is SCM by @giortzisg in #1302
New Features ✨
- Add fiber v3 integration by @giortzisg in #1324
- Bump fasthttp from 1.51.0 to 1.71.0 by @giortzisg in #1324
- Add sentrysql SQL tracing integration by @giortzisg in #1305
- Supports multiple integration paths depending on how your app opens database connections:
sentrysql.Open(...),sentrysql.OpenDB(...), and wrapped drivers/connectors for custom setups. - Database metadata is not inferred in every setup. If the database name is not discoverable automatically, pass
sentrysql.WithDatabaseName(...)so spans are populated correctly. - Example:
// Simple driver-based setup db, err := sentrysql.Open("sqlite", ":memory:", sentrysql.WithDatabaseSystem(sentrysql.SystemSQLite), sentrysql.WithDatabaseName("main"), )
- Supports multiple integration paths depending on how your app opens database connections:
Internal Changes 🔧
Deps
- Sync go.work by @giortzisg in #1326
- Bump github.com/stretchr/testify from 1.8.4 to 1.11.1 by @giortzisg in #1326
- Bump github.com/google/go-cmp from 0.5.9 to 0.7.0 by @giortzisg in #1326
- Bump getsentry/github-workflows from 71588ddf95134f804e82c5970a8098588e2eaecd to c802283cd9075b7a2b7a32655019c21c21676e34 by @dependabot in #1314
- Bump actions/create-github-app-token from 3.0.0 to 3.2.0 by @dependabot in #1316
- Bump actions/checkout from 6.0.2 to 6.0.3 by @dependabot in #1313
- Bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.26.2 to 2.26.6 by @dependabot in #1317
- Bump getsentry/craft from 2.26.2 to 2.26.6 by @dependabot in #1318
- Bump golangci/golangci-lint-action from 9.2.0 to 9.2.1 by @dependabot in #1315
- Bump github.com/gofiber/fiber/v2 from 2.52.12 to 2.52.13 in /fiber by @dependabot in #1300
- Bump github.com/gofiber/fiber/v2 from 2.52.12 to 2.52.13 in /crosstest by @dependabot in #1301
- Bump getsentry/craft from 2.25.2 to 2.26.2 by @dependabot in #1293
- Bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.25.2 to 2.26.2 by @dependabot in #1294
Other
- (otel) Remove unused semconv helpers by @giortzisg in #1321
- Update bump-version script to also bump crosstest by @giortzisg in #1327
0.46.2
Bug Fixes 🐛
- Add attachments to new event path by @giortzisg in #1295
0.46.1
Bug Fixes 🐛
- Correctly capture request body for fasthttp and fiber by @giortzisg in #1284
- (http) Avoid async transport shutdown panics by @giortzisg in #1288
- (httpclient) Clone request before adding trace headers by @giortzisg in #1290
- (scope) Use scoped client for request PII by @giortzisg in #1289
- Safe concurrent access for span and scope by @giortzisg in #1285
0.46.0
Breaking Changes 🛠
- Remove SetExtra by @giortzisg in #1274
- Update compatibility policy to align with Go, supporting only the last two major Go versions by @giortzisg in #1264
- Drop support for Go 1.24 by @giortzisg in #1264
New Features ✨
- Add internal_sdk_error client report on serialization fail by @giortzisg in #1273
- Add grpc integration support by @ribice in #938
- Re-enable Telemetry Processor by default. To disable the behavior use the
DisableTelemetryBufferflag by @giortzisg in #1254 - Simplify client DSN storage to
internal/protocol.Dsnand make it safe to access by @giortzisg in #1254
Internal Changes 🔧
Deps
- Bump github.com/labstack/echo/v5 from 5.0.0 to 5.0.3 in /echo by @dependabot in #1253
- Bump github.com/labstack/echo/v5 from 5.0.0 to 5.0.3 in /crosstest by @dependabot in #1272
- Bump golangci-lint action from 2.1.1 to 2.11.4 by @giortzisg in #1265
- Bump go.opentelemetry.io/otel/sdk from 1.40.0 to 1.43.0 in /otel by @dependabot in #1256
- Bump go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp from 1.40.0 to 1.43.0 in /otel/otlp by @dependabot in #1255
Other
- Improve ci by @giortzisg in #1271
- Add crosstest package by @giortzisg in #1269
- Add sentrytest package by @giortzisg in #1267
0.45.1
Bug Fixes 🐛
- Add missing TracesSampler fields for SamplingContext by @giortzisg in #1259
0.45.0
Breaking Changes 🛠
New Features ✨
- Add OTLP trace exporter via new otel/otlp sub-module by @giortzisg in #1229
- sentryotlp.NewTraceExporter sends OTel spans directly to Sentry's OTLP endpoint.
- sentryotel.NewOtelIntegration links Sentry errors, logs, and metrics to the active OTel trace. Works with both direct-to-Sentry and collector-based setups.
- NewSentrySpanProcessor, NewSentryPropagator, and SentrySpanMap are deprecated and will be removed in 0.47.0. To Migrate use
sentryotlp.NewTraceExporterinstead:
// Before sentry.Init(sentry.ClientOptions{Dsn: dsn, EnableTracing: true, TracesSampleRate: 1.0}) tp := sdktrace.NewTracerProvider( sdktrace.WithSpanProcessor(sentryotel.NewSentrySpanProcessor()), ) otel.SetTextMapPropagator(sentryotel.NewSentryPropagator()) otel.SetTracerProvider(tp) // After: sentry.Init(sentry.ClientOptions{ Dsn: dsn, EnableTracing: true, TracesSampleRate: 1.0, Integrations: func(i []sentry.Integration) []sentry.Integration { return append(i, sentryotel.NewOtelIntegration()) }, }) exporter, _ := sentryotlp.NewTraceExporter(ctx, dsn) tp := sdktrace.NewTracerProvider(sdktrace.WithBatcher(exporter)) otel.SetTracerProvider(tp)
- Add IsSensitiveHeader helper to easily distinguish which headers to scrub for PII. by @giortzisg in #1239
Bug Fixes 🐛
- (ci) Update validate-pr action to remove draft enforcement by @stephanie-anderson in #1237
- (fiber) Use UserContext for transaction to enable OTel trace linking by @giortzisg in #1252
- Race condition when getting envelope identifier by @giortzisg in #1250
Internal Changes 🔧
Deps
- Bump OpenTelemetry SDK to 1.40.0 by @giortzisg in #1243
- Bump changelog-preview.yml from 2.24.1 to 2.25.2 by @dependabot in #1247
- Bump getsentry/craft from 2.24.1 to 2.25.2 by @dependabot in #1248
- Bump codecov/codecov-action from 5.5.2 to 6.0.0 by @dependabot in #1245
- Bump actions/create-github-app-token from 2.2.1 to 3.0.0 by @dependabot in #1246
- Bump actions/setup-go from 6.3.0 to 6.4.0 by @dependabot in #1244
Other
- Update validate-pr workflow by @stephanie-anderson in #1242
- Add PR validation workflow by @stephanie-anderson in #1234