Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sentry: Add support for AttachStacktrace #23

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ type config struct {
flushTimeout time.Duration
beforeSend sentry.EventProcessor
tracesSampleRate float64
attachStacktrace bool
}

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

// WithAttachStacktrace enabled AttachStacktrace.
func WithAttachStacktrace() WriterOption {
return optionFunc(func(cfg *config) {
cfg.attachStacktrace = true
})
}

// WithBeforeSend sets a callback which is called before event is sent.
func WithBeforeSend(beforeSend sentry.EventProcessor) WriterOption {
return optionFunc(func(cfg *config) {
Expand Down Expand Up @@ -378,6 +386,7 @@ func New(dsn string, opts ...WriterOption) (*Writer, error) {
MaxErrorDepth: cfg.maxErrorDepth,
BeforeSend: cfg.beforeSend,
TracesSampleRate: cfg.tracesSampleRate,
AttachStacktrace: cfg.attachStacktrace,
})
if err != nil {
return nil, err
Expand Down
Loading