Skip to content

Commit

Permalink
chore: log warning if both tracesSampleRate and tracesSampler are set (
Browse files Browse the repository at this point in the history
…#1701)

* Log warning if both tracesSampleRate and tracesSampler are set

* Update CHANGELOG

* Update log

* Update CHANGELOG
  • Loading branch information
buenaflor authored Oct 27, 2023
1 parent ed2ae08 commit 891efac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Enhancements

- Log warning if both tracesSampleRate and tracesSampler are set ([#1701](https://github.com/getsentry/sentry-dart/pull/1701))

### Features

- Initial (alpha) support for profiling on iOS and macOS ([#1611](https://github.com/getsentry/sentry-dart/pull/1611))
Expand Down
7 changes: 6 additions & 1 deletion dart/lib/src/sentry_traces_sampler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ class SentryTracesSampler {
SentryTracesSampler(
this._options, {
Random? random,
}) : _random = random ?? Random();
}) : _random = random ?? Random() {
if (_options.tracesSampler != null && _options.tracesSampleRate != null) {
_options.logger(SentryLevel.warning,
'Both tracesSampler and traceSampleRate are set. tracesSampler will take precedence and fallback to traceSampleRate if it returns null.');
}
}

SentryTracesSamplingDecision sample(SentrySamplingContext samplingContext) {
final samplingDecision =
Expand Down

0 comments on commit 891efac

Please sign in to comment.