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

Deprecate enableTracing #2199

Merged
merged 3 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ SentryFlutter.init((options) =>
options..prependExceptionTypeIdentifier(MyCustomExceptionIdentifier()));
```

### Deprecated

- Deprecate `enableTracing` ([#2199](https://github.com/getsentry/sentry-dart/pull/2199))
- The `enableTracing` option has been deprecated and will be removed in the next major version. We recommend removing it
in favor of the `tracesSampleRate` and `tracesSampler` options. If you want to enable performance monitoring, please set
the `tracesSampleRate` to a sample rate of your choice, or provide a sampling function as `tracesSampler` option
instead. If you want to disable performance monitoring, remove the `tracesSampler` and `tracesSampleRate` options.

### Dependencies

- Bump Android SDK from v7.12.0 to v7.12.1 ([#2198](https://github.com/getsentry/sentry-dart/pull/2198))
Expand Down
3 changes: 3 additions & 0 deletions dart/lib/src/sentry_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,8 @@ class SentryOptions {
/// Enables generation of transactions and propagation of trace data. If set
/// to null, tracing might be enabled if [tracesSampleRate] or [tracesSampler]
/// are set.
@Deprecated(
'Use either tracesSampleRate or tracesSampler instead. This will be removed in v9')
bool? enableTracing;

/// Enables sending developer metrics to Sentry.
Expand Down Expand Up @@ -537,6 +539,7 @@ class SentryOptions {
/// Returns if tracing should be enabled. If tracing is disabled, starting transactions returns
/// [NoOpSentrySpan].
bool isTracingEnabled() {
// ignore: deprecated_member_use_from_same_package
final enable = enableTracing;
if (enable != null) {
return enable;
Expand Down
1 change: 1 addition & 0 deletions dart/lib/src/sentry_traces_sampler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class SentryTracesSampler {

double? optionsRate = _options.tracesSampleRate;
double? defaultRate =
// ignore: deprecated_member_use_from_same_package
_options.enableTracing == true ? _defaultSampleRate : null;
double? optionsOrDefaultRate = optionsRate ?? defaultRate;

Expand Down
1 change: 1 addition & 0 deletions dart/test/http_client/tracing_client_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ void main() {

test('set headers from propagationContext when tracing is disabled',
() async {
// ignore: deprecated_member_use_from_same_package
fixture._options.enableTracing = false;
final sut = fixture.getSut(
client: fixture.getClient(statusCode: 200, reason: 'OK'),
Expand Down
2 changes: 2 additions & 0 deletions dart/test/sentry_options_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,15 @@ void main() {

test('when enableTracing is set to true tracing is considered enabled', () {
final options = SentryOptions.empty();
// ignore: deprecated_member_use_from_same_package
options.enableTracing = true;

expect(options.isTracingEnabled(), true);
});

test('when enableTracing is set to false tracing is considered disabled', () {
final options = SentryOptions.empty();
// ignore: deprecated_member_use_from_same_package
options.enableTracing = false;
options.tracesSampleRate = 1.0;
options.tracesSampler = (_) {
Expand Down
1 change: 1 addition & 0 deletions dart/test/sentry_traces_sampler_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ class Fixture {
options.tracesSampler = tracesSampler;
options.debug = debug;
options.logger = mockLogger;
// ignore: deprecated_member_use_from_same_package
options.enableTracing = enableTracing;
return SentryTracesSampler(options);
}
Expand Down
Loading