Skip to content

Commit 2a6326d

Browse files
authored
Merge branch 'main' into dependabot/github_actions/JamesIves/github-pages-deploy-action-4.6.1
2 parents f6d2c8d + 890530d commit 2a6326d

File tree

5 files changed

+50
-4
lines changed

5 files changed

+50
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- Properly reset metric flush flag on metric emission ([#3493](https://github.com/getsentry/sentry-java/pull/3493))
1313
- Use SecureRandom in favor of Random for Metrics ([#3495](https://github.com/getsentry/sentry-java/pull/3495))
1414
- Fix UncaughtExceptionHandlerIntegration Memory Leak ([#3398](https://github.com/getsentry/sentry-java/pull/3398))
15+
- Deprecated `User.segment`. Use a custom tag or context instead. ([#3511](https://github.com/getsentry/sentry-java/pull/3511))
1516
- Fix duplicated http spans ([#3526](https://github.com/getsentry/sentry-java/pull/3526))
1617
- When capturing unhandled hybrid exception session should be ended and new start if need ([#3480](https://github.com/getsentry/sentry-java/pull/3480))
1718

sentry/src/main/java/io/sentry/Baggage.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,11 +305,21 @@ public void setUserId(final @Nullable String userId) {
305305
set(DSCKeys.USER_ID, userId);
306306
}
307307

308+
/**
309+
* @deprecated has no effect and will be removed in the next major update.
310+
*/
311+
@Deprecated
312+
@SuppressWarnings("InlineMeSuggester")
308313
@ApiStatus.Internal
309314
public @Nullable String getUserSegment() {
310315
return get(DSCKeys.USER_SEGMENT);
311316
}
312317

318+
/**
319+
* @deprecated has no effect and will be removed in the next major update.
320+
*/
321+
@Deprecated
322+
@SuppressWarnings("InlineMeSuggester")
313323
@ApiStatus.Internal
314324
public void setUserSegment(final @Nullable String userSegment) {
315325
set(DSCKeys.USER_SEGMENT, userSegment);
@@ -403,6 +413,10 @@ public void setValuesFromScope(
403413
setSampled(null);
404414
}
405415

416+
/**
417+
* @deprecated has no effect and will be removed in the next major update.
418+
*/
419+
@Deprecated
406420
private static @Nullable String getSegment(final @NotNull User user) {
407421
if (user.getSegment() != null) {
408422
return user.getSegment();
@@ -471,6 +485,7 @@ public TraceContext toTraceContext() {
471485
final String publicKey = getPublicKey();
472486

473487
if (traceIdString != null && publicKey != null) {
488+
@SuppressWarnings("deprecation")
474489
final @NotNull TraceContext traceContext =
475490
new TraceContext(
476491
new SentryId(traceIdString),

sentry/src/main/java/io/sentry/TraceContext.java

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,25 @@ public final class TraceContext implements JsonUnknown, JsonSerializable {
2626
private @Nullable Map<String, @NotNull Object> unknown;
2727

2828
TraceContext(@NotNull SentryId traceId, @NotNull String publicKey) {
29-
this(traceId, publicKey, null, null, null, null, null, null, null);
29+
this(traceId, publicKey, null, null, null, null, null, null);
3030
}
3131

32+
TraceContext(
33+
@NotNull SentryId traceId,
34+
@NotNull String publicKey,
35+
@Nullable String release,
36+
@Nullable String environment,
37+
@Nullable String userId,
38+
@Nullable String transaction,
39+
@Nullable String sampleRate,
40+
@Nullable String sampled) {
41+
this(traceId, publicKey, release, environment, userId, null, transaction, sampleRate, sampled);
42+
}
43+
44+
/**
45+
* @deprecated segment has no effect and will be removed in the next major update.
46+
*/
47+
@Deprecated
3248
TraceContext(
3349
@NotNull SentryId traceId,
3450
@NotNull String publicKey,
@@ -80,6 +96,10 @@ public final class TraceContext implements JsonUnknown, JsonSerializable {
8096
return userId;
8197
}
8298

99+
/**
100+
* @deprecated has no effect and will be removed in the next major update.
101+
*/
102+
@Deprecated
83103
public @Nullable String getUserSegment() {
84104
return userSegment;
85105
}
@@ -116,6 +136,10 @@ private TraceContextUser(final @Nullable String id, final @Nullable String segme
116136
return id;
117137
}
118138

139+
/**
140+
* @deprecated has no effect and will be removed in the next major update.
141+
*/
142+
@Deprecated
119143
public @Nullable String getSegment() {
120144
return segment;
121145
}

sentry/src/main/java/io/sentry/protocol/User.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ public final class User implements JsonUnknown, JsonSerializable {
3434
/** Username of the user. */
3535
private @Nullable String username;
3636

37-
private @Nullable String segment;
37+
/**
38+
* @deprecated has no effect and will be removed in the next major update. Use a custom tag or
39+
* context instead.
40+
*/
41+
@Deprecated private @Nullable String segment;
3842

3943
/** Remote IP address of the user. */
4044
private @Nullable String ipAddress;
@@ -224,7 +228,9 @@ public void setUsername(final @Nullable String username) {
224228
* Gets the segment of the user.
225229
*
226230
* @return the user segment.
231+
* @deprecated has no effect and will be removed in the next major update.
227232
*/
233+
@Deprecated
228234
public @Nullable String getSegment() {
229235
return segment;
230236
}
@@ -233,7 +239,9 @@ public void setUsername(final @Nullable String username) {
233239
* Sets the segment of the user.
234240
*
235241
* @param segment the segment.
242+
* @deprecated has no effect and will be removed in the next major update.
236243
*/
244+
@Deprecated
237245
public void setSegment(final @Nullable String segment) {
238246
this.segment = segment;
239247
}

sentry/src/test/java/io/sentry/SentryTracerTest.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,8 +588,6 @@ class SentryTracerTest {
588588
assertEquals("environment", it.environment)
589589
assertEquals("[email protected]", it.release)
590590
assertEquals(transaction.name, it.transaction)
591-
// assertEquals("user-id", it.userId)
592-
assertEquals("pro", it.userSegment)
593591
}
594592
}
595593

0 commit comments

Comments
 (0)