Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
buenaflor committed Jun 20, 2024
1 parent 3c91268 commit 3d9c9a0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
3 changes: 3 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,7 @@ 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 +130,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 +157,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
2 changes: 2 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
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_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

0 comments on commit 3d9c9a0

Please sign in to comment.