Skip to content

Releases: getsentry/sentry-go

0.35.1

13 Aug 10:16
Compare
Choose a tag to compare

The Sentry SDK team is happy to announce the immediate availability of Sentry Go SDK v0.35.1.

Bug Fixes

  • Fix race conditions when accessing the scope during logging operations (#1050)
  • Fix nil pointer dereference with malformed URLs when tracing is enabled in fasthttp and fiber integrations (#1055)

Misc

  • Bump github.com/gofiber/fiber/v2 from 2.52.5 to 2.52.9 in /fiber (#1067)

0.35.0

31 Jul 21:07
Compare
Choose a tag to compare

The Sentry SDK team is happy to announce the immediate availability of Sentry Go SDK v0.35.0.

Breaking Changes

  • Changes to the logging API (#1046)

The logging API now supports a fluent interface for structured logging with attributes:

// usage before
logger := sentry.NewLogger(ctx)
// attributes weren't being set permanently
logger.SetAttributes(
    attribute.String("version", "1.0.0"),
)
logger.Infof(ctx, "Message with parameters %d and %d", 1, 2)

// new behavior
ctx := context.Background()
logger := sentry.NewLogger(ctx)

// Set permanent attributes on the logger
logger.SetAttributes(
    attribute.String("version", "1.0.0"),
)

// Chain attributes on individual log entries
logger.Info().
    String("key.string", "value").
    Int("key.int", 42).
    Bool("key.bool", true).
    Emitf("Message with parameters %d and %d", 1, 2)

Bug Fixes

  • Correctly serialize FailureIssueThreshold and RecoveryThreshold onto check-in payloads (#1060)

0.34.1

07 Jul 16:16
Compare
Choose a tag to compare

The Sentry SDK team is happy to announce the immediate availability of Sentry Go SDK v0.34.1.

Bug Fixes

  • Allow flush to be used multiple times without issues, particularly for the batch logger (#1051)
  • Fix race condition in Scope.GetSpan() method by adding proper mutex locking (#1044)
  • Guard transport on Close() to prevent panic when called multiple times (#1044)

0.34.0

23 Jun 14:19
Compare
Choose a tag to 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

  • Structured logging support for slog. (#1033)
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 with EventLevel and LogLevel 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 and NewFromClient functions to NewEventHook, NewEventHookFromClient, to match the newly added NewLogHook 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 when sentry-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)

0.33.0

15 May 12:15
Compare
Choose a tag to 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 to DebugLogger. This feature was only used when you set Debug: True in your sentry.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 over httpTarget for span descriptions. (#1002)

Misc

  • Update github.com/stretchr/testify to v1.8.4. (#988)

0.32.0

10 Apr 09:06
Compare
Choose a tag to 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. Use SetData(name string, value interface{}) instead. (#864)

Features

  • Add a MockTransport and MockScope. (#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.

0.31.1

02 Jan 15:59
454d469
Compare
Choose a tag to compare

The Sentry SDK team is happy to announce the immediate availability of Sentry Go SDK v0.31.1.

Bug Fixes

  • Correct wrong module name for sentry-go/logrus (#950)

0.31.0

02 Jan 13:13
17ceb6c
Compare
Choose a tag to 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 the User 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 to go get the integration you want to use. For example, if you want to use the echo integration, you'll need to run go get github.com/getsentry/sentry-go/echo (#919).

Features

  • Add the ability to override hub in context for integrations that use custom context. (#931)

  • Add HubProvider Hook for sentrylogrus, 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

0.30.0

03 Dec 15:36
c93781f
Compare
Choose a tag to 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 and fiber 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.

0.29.1

14 Oct 11:23
Compare
Choose a tag to 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)