Skip to content

Commit

Permalink
Add deprecation to setUserSegment
Browse files Browse the repository at this point in the history
  • Loading branch information
buenaflor committed Jun 20, 2024
1 parent f1a18e6 commit df3f463
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dart/lib/src/protocol/sentry_user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +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.')
@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
2 changes: 2 additions & 0 deletions dart/lib/src/sentry_baggage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -178,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/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/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

0 comments on commit df3f463

Please sign in to comment.