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: user segment #2119

Merged
merged 5 commits into from
Jun 25, 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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- Support WebAssembly compilation (dart2wasm) ([#2113](https://github.com/getsentry/sentry-dart/pull/2113))

### Deprecated

- User segment is now deprecated and will be removed in version 9.0.0. Use a custom tag or context instead. ([#2119](https://github.com/getsentry/sentry-dart/pull/2119))

### Dependencies

- Bump Cocoa SDK from v8.29.0 to v8.29.1 ([#2109](https://github.com/getsentry/sentry-dart/pull/2109))
Expand Down
4 changes: 4 additions & 0 deletions dart/lib/src/protocol/sentry_user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ class SentryUser {
final String? ipAddress;

/// The user segment, for apps that divide users in user segments.
@Deprecated(
'Will be removed in v9. Use a custom tag or context instead to capture this information.')
final String? segment;

/// Any other user context information that may be helpful.
Expand Down Expand Up @@ -129,6 +131,7 @@ class SentryUser {
if (username != null) 'username': username,
if (email != null) 'email': email,
if (ipAddress != null) 'ip_address': ipAddress,
// ignore: deprecated_member_use_from_same_package
if (segment != null) 'segment': segment,
if (data?.isNotEmpty ?? false) 'data': data,
// ignore: deprecated_member_use_from_same_package
Expand All @@ -155,6 +158,7 @@ class SentryUser {
username: username ?? this.username,
email: email ?? this.email,
ipAddress: ipAddress ?? this.ipAddress,
// ignore: deprecated_member_use_from_same_package
segment: segment ?? this.segment,
data: data ?? this.data,
// ignore: deprecated_member_use_from_same_package
Expand Down
4 changes: 4 additions & 0 deletions dart/lib/src/sentry_baggage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ class SentryBaggage {
if (scope.user?.id != null) {
setUserId(scope.user!.id!);
}
// ignore: deprecated_member_use_from_same_package
if (scope.user?.segment != null) {
// ignore: deprecated_member_use_from_same_package
setUserSegment(scope.user!.segment!);
}
}
Expand Down Expand Up @@ -176,6 +178,8 @@ class SentryBaggage {
set('sentry-user_id', value);
}

@Deprecated(
'Will be removed in v9 since functionality has been removed from Sentry')
void setUserSegment(String value) {
set('sentry-user_segment', value);
}
Expand Down
5 changes: 5 additions & 0 deletions dart/lib/src/sentry_trace_context_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class SentryTraceContextHeader {
final String? release;
final String? environment;
final String? userId;
@Deprecated(
'Will be removed in v9 since functionality has been removed from Sentry')
final String? userSegment;
final String? transaction;
final String? sampleRate;
Expand Down Expand Up @@ -48,6 +50,7 @@ class SentryTraceContextHeader {
if (release != null) 'release': release,
if (environment != null) 'environment': environment,
if (userId != null) 'user_id': userId,
// ignore: deprecated_member_use_from_same_package
if (userSegment != null) 'user_segment': userSegment,
if (transaction != null) 'transaction': transaction,
if (sampleRate != null) 'sample_rate': sampleRate,
Expand All @@ -71,7 +74,9 @@ class SentryTraceContextHeader {
if (userId != null) {
baggage.setUserId(userId!);
}
// ignore: deprecated_member_use_from_same_package
if (userSegment != null) {
// ignore: deprecated_member_use_from_same_package
baggage.setUserSegment(userSegment!);
}
if (transaction != null) {
Expand Down
1 change: 1 addition & 0 deletions dart/lib/src/sentry_tracer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ class SentryTracer extends ISentrySpan {
release: _hub.options.release,
environment: _hub.options.environment,
userId: null, // because of PII not sending it for now
// ignore: deprecated_member_use_from_same_package
userSegment: user?.segment,
transaction:
_isHighQualityTransactionName(transactionNameSource) ? name : null,
Expand Down
1 change: 1 addition & 0 deletions dart/test/protocol/sentry_baggage_header_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ void main() {
baggage.setRelease('release');
baggage.setEnvironment('environment');
baggage.setUserId('userId');
// ignore: deprecated_member_use_from_same_package
baggage.setUserSegment('userSegment');
baggage.setTransaction('transaction');
baggage.setSampleRate('1.0');
Expand Down
1 change: 1 addition & 0 deletions dart/test/protocol/sentry_user_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ void main() {
expect('email1', copy.email);
expect('ipAddress1', copy.ipAddress);
expect({'key1': 'value1'}, copy.data);
// ignore: deprecated_member_use_from_same_package
expect('seg1', copy.segment);
});
});
Expand Down
1 change: 1 addition & 0 deletions dart/test/sentry_trace_context_header_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ void main() {
expect(context.release, 'release');
expect(context.environment, 'environment');
expect(context.userId, 'user_id');
// ignore: deprecated_member_use_from_same_package
expect(context.userSegment, 'user_segment');
expect(context.transaction, 'transaction');
expect(context.sampleRate, '1.0');
Expand Down
1 change: 1 addition & 0 deletions dart/test/sentry_tracer_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,7 @@ void main() {
expect(context.publicKey, 'abc');
expect(context.release, 'release');
expect(context.environment, 'environment');
// ignore: deprecated_member_use_from_same_package
expect(context.userSegment, 'segment');
expect(context.transaction, 'name');
expect(context.sampleRate, '1');
Expand Down
Loading