Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/reactivecircus/and…
Browse files Browse the repository at this point in the history
…roid-emulator-runner-2.31.0
  • Loading branch information
stefanosiano authored Jul 1, 2024
2 parents b838a5b + 890530d commit 53dcf15
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- Properly reset metric flush flag on metric emission ([#3493](https://github.com/getsentry/sentry-java/pull/3493))
- Use SecureRandom in favor of Random for Metrics ([#3495](https://github.com/getsentry/sentry-java/pull/3495))
- Fix UncaughtExceptionHandlerIntegration Memory Leak ([#3398](https://github.com/getsentry/sentry-java/pull/3398))
- Deprecated `User.segment`. Use a custom tag or context instead. ([#3511](https://github.com/getsentry/sentry-java/pull/3511))
- Fix duplicated http spans ([#3526](https://github.com/getsentry/sentry-java/pull/3526))
- When capturing unhandled hybrid exception session should be ended and new start if need ([#3480](https://github.com/getsentry/sentry-java/pull/3480))

Expand Down
15 changes: 15 additions & 0 deletions sentry/src/main/java/io/sentry/Baggage.java
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,21 @@ public void setUserId(final @Nullable String userId) {
set(DSCKeys.USER_ID, userId);
}

/**
* @deprecated has no effect and will be removed in the next major update.
*/
@Deprecated
@SuppressWarnings("InlineMeSuggester")
@ApiStatus.Internal
public @Nullable String getUserSegment() {
return get(DSCKeys.USER_SEGMENT);
}

/**
* @deprecated has no effect and will be removed in the next major update.
*/
@Deprecated
@SuppressWarnings("InlineMeSuggester")
@ApiStatus.Internal
public void setUserSegment(final @Nullable String userSegment) {
set(DSCKeys.USER_SEGMENT, userSegment);
Expand Down Expand Up @@ -403,6 +413,10 @@ public void setValuesFromScope(
setSampled(null);
}

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

if (traceIdString != null && publicKey != null) {
@SuppressWarnings("deprecation")
final @NotNull TraceContext traceContext =
new TraceContext(
new SentryId(traceIdString),
Expand Down
26 changes: 25 additions & 1 deletion sentry/src/main/java/io/sentry/TraceContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,25 @@ public final class TraceContext implements JsonUnknown, JsonSerializable {
private @Nullable Map<String, @NotNull Object> unknown;

TraceContext(@NotNull SentryId traceId, @NotNull String publicKey) {
this(traceId, publicKey, null, null, null, null, null, null, null);
this(traceId, publicKey, null, null, null, null, null, null);
}

TraceContext(
@NotNull SentryId traceId,
@NotNull String publicKey,
@Nullable String release,
@Nullable String environment,
@Nullable String userId,
@Nullable String transaction,
@Nullable String sampleRate,
@Nullable String sampled) {
this(traceId, publicKey, release, environment, userId, null, transaction, sampleRate, sampled);
}

/**
* @deprecated segment has no effect and will be removed in the next major update.
*/
@Deprecated
TraceContext(
@NotNull SentryId traceId,
@NotNull String publicKey,
Expand Down Expand Up @@ -80,6 +96,10 @@ public final class TraceContext implements JsonUnknown, JsonSerializable {
return userId;
}

/**
* @deprecated has no effect and will be removed in the next major update.
*/
@Deprecated
public @Nullable String getUserSegment() {
return userSegment;
}
Expand Down Expand Up @@ -116,6 +136,10 @@ private TraceContextUser(final @Nullable String id, final @Nullable String segme
return id;
}

/**
* @deprecated has no effect and will be removed in the next major update.
*/
@Deprecated
public @Nullable String getSegment() {
return segment;
}
Expand Down
10 changes: 9 additions & 1 deletion sentry/src/main/java/io/sentry/protocol/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ public final class User implements JsonUnknown, JsonSerializable {
/** Username of the user. */
private @Nullable String username;

private @Nullable String segment;
/**
* @deprecated has no effect and will be removed in the next major update. Use a custom tag or
* context instead.
*/
@Deprecated private @Nullable String segment;

/** Remote IP address of the user. */
private @Nullable String ipAddress;
Expand Down Expand Up @@ -224,7 +228,9 @@ public void setUsername(final @Nullable String username) {
* Gets the segment of the user.
*
* @return the user segment.
* @deprecated has no effect and will be removed in the next major update.
*/
@Deprecated
public @Nullable String getSegment() {
return segment;
}
Expand All @@ -233,7 +239,9 @@ public void setUsername(final @Nullable String username) {
* Sets the segment of the user.
*
* @param segment the segment.
* @deprecated has no effect and will be removed in the next major update.
*/
@Deprecated
public void setSegment(final @Nullable String segment) {
this.segment = segment;
}
Expand Down
2 changes: 0 additions & 2 deletions sentry/src/test/java/io/sentry/SentryTracerTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -588,8 +588,6 @@ class SentryTracerTest {
assertEquals("environment", it.environment)
assertEquals("[email protected]", it.release)
assertEquals(transaction.name, it.transaction)
// assertEquals("user-id", it.userId)
assertEquals("pro", it.userSegment)
}
}

Expand Down

0 comments on commit 53dcf15

Please sign in to comment.