Skip to content
This repository was archived by the owner on Dec 30, 2024. It is now read-only.

Commit b3f2e47

Browse files
committed
Sentry: Add support for AttachStacktrace
1 parent 5ae2fbd commit b3f2e47

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

writer.go

+9
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ type config struct {
231231
flushTimeout time.Duration
232232
beforeSend sentry.EventProcessor
233233
tracesSampleRate float64
234+
attachStacktrace bool
234235
}
235236

236237
// WithLevels configures zerolog levels that have to be sent to Sentry.
@@ -305,6 +306,13 @@ func WithTracingSampleRate(tsr float64) WriterOption {
305306
})
306307
}
307308

309+
// WithAttachStacktrace enabled AttachStacktrace.
310+
func WithAttachStacktrace() WriterOption {
311+
return optionFunc(func(cfg *config) {
312+
cfg.attachStacktrace = true
313+
})
314+
}
315+
308316
// WithBeforeSend sets a callback which is called before event is sent.
309317
func WithBeforeSend(beforeSend sentry.EventProcessor) WriterOption {
310318
return optionFunc(func(cfg *config) {
@@ -378,6 +386,7 @@ func New(dsn string, opts ...WriterOption) (*Writer, error) {
378386
MaxErrorDepth: cfg.maxErrorDepth,
379387
BeforeSend: cfg.beforeSend,
380388
TracesSampleRate: cfg.tracesSampleRate,
389+
AttachStacktrace: cfg.attachStacktrace,
381390
})
382391
if err != nil {
383392
return nil, err

0 commit comments

Comments
 (0)