Skip to content

Commit

Permalink
remove merge of default client opts (#29)
Browse files Browse the repository at this point in the history
* remove merge of default client opts

* Update sinks_sentry.go

Co-authored-by: Robert Lin <robert@bobheadxi.dev>
  • Loading branch information
burmudar and bobheadxi committed Aug 18, 2022
1 parent 4bb2be0 commit a73424c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
8 changes: 0 additions & 8 deletions internal/sinkcores/sentrycore/default_sentry_client_opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,3 @@ import "github.com/getsentry/sentry-go"
var DefaultSentryClientOptions = sentry.ClientOptions{
SampleRate: 0.1,
}

// ApplySentryClientDefaultOptions merges opts with the defaults defined in DefaultSentryClientOptions.
func ApplySentryClientDefaultOptions(opts sentry.ClientOptions) sentry.ClientOptions {
if opts.SampleRate == 0 {
opts.SampleRate = DefaultSentryClientOptions.SampleRate
}
return opts
}
4 changes: 1 addition & 3 deletions sinks_sentry.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@ func NewSentrySink() Sink {
}

// NewSentrySinkWith instantiates a Sentry sink to provide to `log.Init` with the values provided in SentrySink.
// Default values are set if they do not exist in the given sink
func NewSentrySinkWith(s SentrySink) Sink {
opts := sentrycore.ApplySentryClientDefaultOptions(s.ClientOptions)
return &sentrySink{SentrySink: SentrySink{opts}}
return &sentrySink{SentrySink: SentrySink{s.ClientOptions}}
}

func (s *sentrySink) Name() string { return "SentrySink" }
Expand Down

0 comments on commit a73424c

Please sign in to comment.