The official Go SDK for Sentry (sentry.io)
The Sentry SDK team is happy to announce the immediate availability of Sentry Go SDK v0.20.0.
Note: this release has some breaking changes, which are listed below.
Remove the following methods: Scope.SetTransaction()
, Scope.Transaction()
(#605)
Span.Name should be used instead to access the transaction's name.
For example, the following TracesSampler
function should be now written as follows:
Before:
TracesSampler: func(ctx sentry.SamplingContext) float64 {
hub := sentry.GetHubFromContext(ctx.Span.Context())
if hub.Scope().Transaction() == "GET /health" {
return 0
}
return 1
},
After:
TracesSampler: func(ctx sentry.SamplingContext) float64 {
if ctx.Span.Name == "GET /health" {
return 0
}
return 1
},
Span.SetContext()
method (#599)
hub.Scope().SetContext
when setting or updating context on transactions.DebugMeta
interface to Event
and extend Frame
structure with more fields (#606)
github.com/kataras/iris/v12
to 12.2.0, github.com/labstack/echo/v4
to v4.10.0 (#595)
google.golang.org/protobuf
minimum required version to 1.29.1 (#604)
otel
module when building in GOPATH mode (#615)The Sentry SDK team is happy to announce the immediate availability of Sentry Go SDK v0.19.0.
golang.org/x/text
minimum required version to 0.3.8 (#586)
The Sentry SDK team is happy to announce the immediate availability of Sentry Go SDK v0.18.0. This release contains initial support for OpenTelemetry and various other bug fixes and improvements.
Note: This is the last release supporting Go 1.17.
Initial support for OpenTelemetry. You can now send all your OpenTelemetry spans to Sentry.
Install the otel
module
go get github.com/getsentry/sentry-go \
github.com/getsentry/sentry-go/otel
Configure the Sentry and OpenTelemetry SDKs
import (
"go.opentelemetry.io/otel"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
"github.com/getsentry/sentry-go"
"github.com/getsentry/sentry-go/otel"
// ...
)
// Initlaize the Sentry SDK
sentry.Init(sentry.ClientOptions{
Dsn: "__DSN__",
EnableTracing: true,
TracesSampleRate: 1.0,
})
// Set up the Sentry span processor
tp := sdktrace.NewTracerProvider(
sdktrace.WithSpanProcessor(sentryotel.NewSentrySpanProcessor()),
// ...
)
otel.SetTracerProvider(tp)
// Set up the Sentry propagator
otel.SetTextMapPropagator(sentryotel.NewSentryPropagator())
You can read more about using OpenTelemetry with Sentry in our docs.
span.ToBaggage()
(#566)The Sentry SDK team is happy to announce the immediate availability of Sentry Go SDK v0.17.0.
This release contains a new BeforeSendTransaction
hook option and corrects two regressions introduced in 0.16.0
.
BeforeSendTransaction
hook to ClientOptions
(#517)
ClientOptions.SendDefaultPii
is set to false
(#524)
The Sentry SDK team is happy to announce the immediate availability of Sentry Go SDK v0.16.0.
Due to ongoing work towards a stable API for v1.0.0
, we sadly had to include two breaking changes in this release.
EnableTracing
, a boolean option flag to enable performance monitoring (false
by default).
If you're using TracesSampleRate
or TracesSampler
, this option is required to enable performance monitoring.
sentry.Init(sentry.ClientOptions{
EnableTracing: true,
TracesSampleRate: 1.0,
})
TracesSampler
was changed to a callback that must return a float64
between 0.0
and 1.0
.
For example, you can apply a sample rate of 1.0
(100%) to all /api
transactions, and a sample rate of 0.5
(50%) to all other transactions.
You can read more about this in our SDK docs.
sentry.Init(sentry.ClientOptions{
TracesSampler: sentry.TracesSampler(func(ctx sentry.SamplingContext) float64 {
hub := sentry.GetHubFromContext(ctx.Span.Context())
name := hub.Scope().Transaction()
if strings.HasPrefix(name, "GET /api") {
return 1.0
}
return 0.5
}),
}
sentry.ClientOptions.Debug: true
.max-depth
options (#428)Context
type mapping to a map[string]interface{}
for all event contexts (#444)ioutil
pkg with os
& io
(#454)stacktrace.go
from size and speed (#467)go1.19
and go1.18
, drop go1.16
and go1.15
support (#432, #477)NOTE: This version drops support for Go 1.16 and Go 1.15. The currently supported Go versions are the last 3 stable releases: 1.19, 1.18 and 1.17.
PC
field (#393)NOTE:
This version drops support for Go 1.14, however no changes have been made that would make the SDK not work with Go 1.14. The currently supported Go versions are the last 3 stable releases: 1.15, 1.16 and 1.17.
There are two behavior changes related to LastEventID
, both of which were intended to align the behavior of the Sentry Go SDK with other Sentry SDKs.
The new automatic release detection feature makes it easier to use Sentry and separate events per release without requiring extra work from users. We intend to improve this functionality in a future release by utilizing information that will be available in runtime starting with Go 1.18. The tracking issue is #401.
go doc
documentation (#344, #350, #351)NOTE:
This version drops support for Go 1.13. The currently supported Go versions are the last 3 stable releases: 1.14, 1.15 and 1.16.
Users of the tracing functionality (StartSpan
, etc) should upgrade to this version to benefit from separate rate limits for errors and transactions.
There are no breaking changes and upgrading should be a smooth experience for all users.