CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 240
Releases: getsentry/sentry-go
0.34.1
Compare
The Sentry SDK team is happy to announce the immediate availability of Sentry Go SDK v0.34.1.
Bug Fixes
Assets 2
0.34.0
Compare
The Sentry SDK team is happy to announce the immediate availability of Sentry Go SDK v0.34.0.
Breaking Changes
- Logrus structured logging support replaces the
sentrylogrus.Hook
signature from a*Hook
to an interface.
var hook *sentrylogrus.Hook
hook = sentrylogrus.New(
// ... your setup
)
// should change the definition to
var hook sentrylogrus.Hook
hook = sentrylogrus.New(
// ... your setup
)
Features
ctx := context.Background()
handler := sentryslog.Option{
EventLevel: []slog.Level{slog.LevelError, sentryslog.LevelFatal}, // Only Error and Fatal as events
LogLevel: []slog.Level{slog.LevelWarn, slog.LevelInfo}, // Only Warn and Info as logs
}.NewSentryHandler(ctx)
logger := slog.New(handler)
logger.Info("hello"))
logHook, _ := sentrylogrus.NewLogHook(
[]logrus.Level{logrus.InfoLevel, logrus.WarnLevel},
sentry.ClientOptions{
Dsn: "your-dsn",
EnableLogs: true, // Required for log entries
})
defer logHook.Flush(5 * time.Secod)
logrus.RegisterExitHandler(func() {
logHook.Flush(5 * time.Second)
})
logger := logrus.New()
logger.AddHook(logHook)
logger.Infof("hello")
- Add support for flushing events with context using
FlushWithContext()
. (#935)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
if !sentry.FlushWithContext(ctx) {
// Handle timeout or cancellation
}
- Add support for custom fingerprints in slog integration. (#1039)
Deprecations
- Slog structured logging support replaces
Level
option withEventLevel
andLogLevel
options, for specifying fine-grained levels for capturing events and logs.
handler := sentryslog.Option{
EventLevel: []slog.Level{slog.LevelWarn, slog.LevelError, sentryslog.LevelFatal},
LogLevel: []slog.Level{slog.LevelDebug, slog.LevelInfo, slog.LevelWarn, slog.LevelError, sentryslog.LevelFatal},
}.NewSentryHandler(ctx)
- Logrus structured logging support replaces
New
andNewFromClient
functions toNewEventHook
,NewEventHookFromClient
, to match the newly addedNewLogHook
functions, and specify the hook type being created each time.
logHook, err := sentrylogrus.NewLogHook(
[]logrus.Level{logrus.InfoLevel},
sentry.ClientOptions{})
eventHook, err := sentrylogrus.NewEventHook([]logrus.Level{
logrus.ErrorLevel,
logrus.FatalLevel,
logrus.PanicLevel,
}, sentry.ClientOptions{})
Bug Fixes
- Fix issue where
ContinueTrace()
would panic whensentry-trace
header does not exist. (#1026) - Fix incorrect log level signature in structured logging. (#1034)
- Remove
sentry.origin
attribute from Sentry logger to prevent confusion in spans. (#1038) - Don't gate user information behind
SendDefaultPII
flag for logs. (#1032)
Misc
- Add more sensitive HTTP headers to the default list of headers that are scrubbed by default. (#1008)
Assets 2
0.33.0
Compare
The Sentry SDK team is happy to announce the immediate availability of Sentry Go SDK v0.33.0.
Breaking Changes
- Rename the internal
Logger
toDebugLogger
. This feature was only used when you setDebug: True
in yoursentry.Init()
call. If you haven't used the Logger directly, no changes are necessary. (#1012)
Features
-
Add support for Structured Logging. (#1010)
logger := sentry.NewLogger(ctx) logger.Info(ctx, "Hello, Logs!")
You can learn more about Sentry Logs on our docs and the examples.
-
Add new attributes APIs, which are currently only exposed on logs. (#1007)
Bug Fixes
- Do not push a new scope on
StartSpan
. (#1013) - Fix an issue where the propagated smapling decision wasn't used. (#995)
- [Otel] Prefer
httpRoute
overhttpTarget
for span descriptions. (#1002)
Misc
- Update
github.com/stretchr/testify
to v1.8.4. (#988)
Assets 2
0.32.0
Compare
The Sentry SDK team is happy to announce the immediate availability of Sentry Go SDK v0.32.0.
Breaking Changes
- Bump the minimum Go version to 1.22. The supported versions are 1.22, 1.23 and 1.24. (#967)
- Setting any values on
span.Extra
has no effect anymore. UseSetData(name string, value interface{})
instead. (#864)
Features
- Add a
MockTransport
andMockScope
. (#972)
Bug Fixes
- Fix writing
*http.Request
in the Logrus JSONFormatter. (#955)
Misc
- Transaction
data
attributes are now seralized as trace context data attributes, allowing you to query these attributes in the Trace Explorer.
Assets 2
0.31.1
0.31.0
Compare
Breaking Changes
-
Remove support for metrics. Read more about the end of the Metrics beta here. (#914)
-
Remove support for profiling. (#915)
-
Remove
Segment
field from theUser
struct. This field is no longer used in the Sentry product. (#928) -
Every integration is now a separate module, reducing the binary size and number of dependencies. Once you update
sentry-go
to latest version, you'll need togo get
the integration you want to use. For example, if you want to use theecho
integration, you'll need to rungo get github.com/getsentry/sentry-go/echo
(#919).
Features
-
Add the ability to override
hub
incontext
for integrations that use custom context. (#931) -
Add
HubProvider
Hook forsentrylogrus
, enabling dynamic Sentry hub allocation for each log entry or goroutine. (#936)
This change enhances compatibility with Sentry's recommendation of using separate hubs per goroutine. To ensure a separate Sentry hub for each goroutine, configure the HubProvider
like this:
hook, err := sentrylogrus.New(nil, sentry.ClientOptions{})
if err != nil {
log.Fatalf("Failed to initialize Sentry hook: %v", err)
}
// Set a custom HubProvider to generate a new hub for each goroutine or log entry
hook.SetHubProvider(func() *sentry.Hub {
client, _ := sentry.NewClient(sentry.ClientOptions{})
return sentry.NewHub(client, sentry.NewScope())
})
logrus.AddHook(hook)
Bug Fixes
- Add support for closing worker goroutines started by the
HTTPTranport
to prevent goroutine leaks. (#894)
client, _ := sentry.NewClient()
defer client.Close()
Worker can be also closed by calling Close()
method on the HTTPTransport
instance. Close
should be called after Flush
and before terminating the program otherwise some events may be lost.
transport := sentry.NewHTTPTransport()
defer transport.Close()
Misc
- Bump gin-gonic/gin to v1.9.1. (#946)
Assets 2
0.30.0
Compare
The Sentry SDK team is happy to announce the immediate availability of Sentry Go SDK v0.30.0.
Features
- Add
sentryzerolog
integration (#857) - Add
sentryslog
integration (#865) - Always set Mechanism Type to generic (#896)
Bug Fixes
- Prevent panic in
fasthttp
andfiber
integration in case a malformed URL has to be parsed (#912)
Misc
Drop support for Go 1.18, 1.19 and 1.20. The currently supported Go versions are the last 3 stable releases: 1.23, 1.22 and 1.21.
Assets 2
0.29.1
Compare
The Sentry SDK team is happy to announce the immediate availability of Sentry Go SDK v0.29.1.
Bug Fixes
- Correlate errors to the current trace (#886)
- Set the trace context when the transaction finishes (#888)
Misc
- Update the
sentrynegroni
integration to use the latest (v3.1.1) version of Negroni (#885)
Assets 2
0.29.0
Compare
The Sentry SDK team is happy to announce the immediate availability of Sentry Go SDK v0.29.0.
Breaking Changes
- Remove the
sentrymartini
integration (#861) - The
WrapResponseWriter
has been moved from thesentryhttp
package to theinternal/httputils
package. If you've imported it previosuly, you'll need to copy the implementation in your project. (#871)
Features
-
Add new convenience methods to continue a trace and propagate tracing headers for error-only use cases. (#862)
If you are not using one of our integrations, you can manually continue an incoming trace by using
sentry.ContinueTrace()
by providing thesentry-trace
andbaggage
header received from a downstream SDK.hub := sentry.CurrentHub() sentry.ContinueTrace(hub, r.Header.Get(sentry.SentryTraceHeader), r.Header.Get(sentry.SentryBaggageHeader)),
You can use
hub.GetTraceparent()
andhub.GetBaggage()
to fetch the necessary header values for outgoing HTTP requests.hub := sentry.GetHubFromContext(ctx) req, _ := http.NewRequest("GET", "https://localhost:3000", nil) req.Header.Add(sentry.SentryTraceHeader, hub.GetTraceparent()) req.Header.Add(sentry.SentryBaggageHeader, hub.GetBaggage())
Bug Fixes
- Initialize
HTTPTransport.limit
ifnil
(#844) - Fix
sentry.StartTransaction()
returning a transaction with an outdated context on existing transactions (#854) - Treat
Proxy-Authorization
as a sensitive header (#859) - Add support for the
http.Hijacker
interface to thesentrynegroni
package (#871) - Go version >= 1.23: Use value from
http.Request.Pattern
for HTTP transaction names when usingsentryhttp
&sentrynegroni
(#875) - Go version >= 1.21: Fix closure functions name grouping (#877)
Misc
- Collect
span
origins (#849)
Assets 2
0.28.1
Compare
The Sentry SDK team is happy to announce the immediate availability of Sentry Go SDK v0.28.1.
Bug Fixes
- Implement
http.ResponseWriter
to hook into various parts of the response process (#837)