Library for common Go code
// init
cfg := config.SentryConfig{
DSN: "https://[email protected]/code2",
EnableTracing: true,
SampleRate: 0.3,
}
if err := sentryx.InitSentry(cfg); err != nil {
// handle error
}
// flush buffered events before the program terminates
defer sentry.Flush(2 * time.Second)
// capture error
sentry.CaptureException(err)
// start tracing transaction
tx := sentry.StartTransaction(ctx, "tx name")
defer tx.Finish()