Skip to content

Commit 86e2cc4

Browse files
authored
Merge branch '8.x.x' into feat/potel-32-attach-active-span-to-scope
2 parents 8cf3731 + 30fd3cf commit 86e2cc4

File tree

19 files changed

+32
-229
lines changed

19 files changed

+32
-229
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Fixes
6+
7+
- Removed user segment ([#3512](https://github.com/getsentry/sentry-java/pull/3512))
8+
- Use span id of remote parent ([#3548](https://github.com/getsentry/sentry-java/pull/3548))
9+
- Traces were broken because on an incoming request, OtelSentrySpanProcessor did not set the parentSpanId on the span correctly. Traces were not referencing the actual parent span but some other (random) span ID which the server doesn't know.
10+
311
## 8.0.0-alpha.3
412

513
### Breaking Changes

sentry-opentelemetry/sentry-opentelemetry-extra/src/main/java/io/sentry/opentelemetry/OtelSpanWrapper.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,6 @@ private void updateBaggageValues() {
217217
});
218218
baggage.setValuesFromTransaction(
219219
getSpanContext().getTraceId(),
220-
userAtomicReference.get(),
221220
scopes.getOptions(),
222221
this.getSamplingDecision(),
223222
getTransactionName(),

sentry/api/sentry.api

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ public final class io/sentry/Baggage {
5353
public fun getTransaction ()Ljava/lang/String;
5454
public fun getUnknown ()Ljava/util/Map;
5555
public fun getUserId ()Ljava/lang/String;
56-
public fun getUserSegment ()Ljava/lang/String;
5756
public fun isMutable ()Z
5857
public fun set (Ljava/lang/String;Ljava/lang/String;)V
5958
public fun setEnvironment (Ljava/lang/String;)V
@@ -64,9 +63,8 @@ public final class io/sentry/Baggage {
6463
public fun setTraceId (Ljava/lang/String;)V
6564
public fun setTransaction (Ljava/lang/String;)V
6665
public fun setUserId (Ljava/lang/String;)V
67-
public fun setUserSegment (Ljava/lang/String;)V
6866
public fun setValuesFromScope (Lio/sentry/IScope;Lio/sentry/SentryOptions;)V
69-
public fun setValuesFromTransaction (Lio/sentry/protocol/SentryId;Lio/sentry/protocol/User;Lio/sentry/SentryOptions;Lio/sentry/TracesSamplingDecision;Ljava/lang/String;Lio/sentry/protocol/TransactionNameSource;)V
67+
public fun setValuesFromTransaction (Lio/sentry/protocol/SentryId;Lio/sentry/SentryOptions;Lio/sentry/TracesSamplingDecision;Ljava/lang/String;Lio/sentry/protocol/TransactionNameSource;)V
7068
public fun toHeaderString (Ljava/lang/String;)Ljava/lang/String;
7169
public fun toTraceContext ()Lio/sentry/TraceContext;
7270
}
@@ -81,7 +79,6 @@ public final class io/sentry/Baggage$DSCKeys {
8179
public static final field TRACE_ID Ljava/lang/String;
8280
public static final field TRANSACTION Ljava/lang/String;
8381
public static final field USER_ID Ljava/lang/String;
84-
public static final field USER_SEGMENT Ljava/lang/String;
8582
public fun <init> ()V
8683
}
8784

@@ -3351,7 +3348,6 @@ public final class io/sentry/TraceContext : io/sentry/JsonSerializable, io/sentr
33513348
public fun getTransaction ()Ljava/lang/String;
33523349
public fun getUnknown ()Ljava/util/Map;
33533350
public fun getUserId ()Ljava/lang/String;
3354-
public fun getUserSegment ()Ljava/lang/String;
33553351
public fun serialize (Lio/sentry/ObjectWriter;Lio/sentry/ILogger;)V
33563352
public fun setUnknown (Ljava/util/Map;)V
33573353
}
@@ -3372,7 +3368,6 @@ public final class io/sentry/TraceContext$JsonKeys {
33723368
public static final field TRANSACTION Ljava/lang/String;
33733369
public static final field USER Ljava/lang/String;
33743370
public static final field USER_ID Ljava/lang/String;
3375-
public static final field USER_SEGMENT Ljava/lang/String;
33763371
public fun <init> ()V
33773372
}
33783373

@@ -5265,7 +5260,6 @@ public final class io/sentry/protocol/User : io/sentry/JsonSerializable, io/sent
52655260
public fun getIpAddress ()Ljava/lang/String;
52665261
public fun getName ()Ljava/lang/String;
52675262
public fun getOthers ()Ljava/util/Map;
5268-
public fun getSegment ()Ljava/lang/String;
52695263
public fun getUnknown ()Ljava/util/Map;
52705264
public fun getUsername ()Ljava/lang/String;
52715265
public fun hashCode ()I
@@ -5277,7 +5271,6 @@ public final class io/sentry/protocol/User : io/sentry/JsonSerializable, io/sent
52775271
public fun setIpAddress (Ljava/lang/String;)V
52785272
public fun setName (Ljava/lang/String;)V
52795273
public fun setOthers (Ljava/util/Map;)V
5280-
public fun setSegment (Ljava/lang/String;)V
52815274
public fun setUnknown (Ljava/util/Map;)V
52825275
public fun setUsername (Ljava/lang/String;)V
52835276
}
@@ -5296,7 +5289,6 @@ public final class io/sentry/protocol/User$JsonKeys {
52965289
public static final field IP_ADDRESS Ljava/lang/String;
52975290
public static final field NAME Ljava/lang/String;
52985291
public static final field OTHER Ljava/lang/String;
5299-
public static final field SEGMENT Ljava/lang/String;
53005292
public static final field USERNAME Ljava/lang/String;
53015293
public fun <init> ()V
53025294
}

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

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import io.sentry.protocol.SentryId;
44
import io.sentry.protocol.TransactionNameSource;
5-
import io.sentry.protocol.User;
65
import io.sentry.util.SampleRateUtils;
76
import io.sentry.util.StringUtils;
87
import java.io.UnsupportedEncodingException;
@@ -135,8 +134,6 @@ public static Baggage fromEvent(
135134
baggage.setPublicKey(new Dsn(options.getDsn()).getPublicKey());
136135
baggage.setRelease(event.getRelease());
137136
baggage.setEnvironment(event.getEnvironment());
138-
final User user = event.getUser();
139-
baggage.setUserSegment(user != null ? getSegment(user) : null);
140137
baggage.setTransaction(event.getTransaction());
141138
// we don't persist sample rate
142139
baggage.setSampleRate(null);
@@ -305,26 +302,6 @@ public void setUserId(final @Nullable String userId) {
305302
set(DSCKeys.USER_ID, userId);
306303
}
307304

308-
/**
309-
* @deprecated has no effect and will be removed in the next major update.
310-
*/
311-
@Deprecated
312-
@SuppressWarnings("InlineMeSuggester")
313-
@ApiStatus.Internal
314-
public @Nullable String getUserSegment() {
315-
return get(DSCKeys.USER_SEGMENT);
316-
}
317-
318-
/**
319-
* @deprecated has no effect and will be removed in the next major update.
320-
*/
321-
@Deprecated
322-
@SuppressWarnings("InlineMeSuggester")
323-
@ApiStatus.Internal
324-
public void setUserSegment(final @Nullable String userSegment) {
325-
set(DSCKeys.USER_SEGMENT, userSegment);
326-
}
327-
328305
@ApiStatus.Internal
329306
public @Nullable String getTransaction() {
330307
return get(DSCKeys.TRANSACTION);
@@ -382,7 +359,6 @@ public void set(final @NotNull String key, final @Nullable String value) {
382359
@ApiStatus.Internal
383360
public void setValuesFromTransaction(
384361
final @NotNull SentryId traceId,
385-
final @Nullable User user,
386362
final @NotNull SentryOptions sentryOptions,
387363
final @Nullable TracesSamplingDecision samplingDecision,
388364
final @Nullable String transactionName,
@@ -391,7 +367,6 @@ public void setValuesFromTransaction(
391367
setPublicKey(new Dsn(sentryOptions.getDsn()).getPublicKey());
392368
setRelease(sentryOptions.getRelease());
393369
setEnvironment(sentryOptions.getEnvironment());
394-
setUserSegment(user != null ? getSegment(user) : null);
395370
setTransaction(isHighQualityTransactionName(transactionNameSource) ? transactionName : null);
396371
setSampleRate(sampleRateToString(sampleRate(samplingDecision)));
397372
setSampled(StringUtils.toString(sampled(samplingDecision)));
@@ -401,34 +376,15 @@ public void setValuesFromTransaction(
401376
public void setValuesFromScope(
402377
final @NotNull IScope scope, final @NotNull SentryOptions options) {
403378
final @NotNull PropagationContext propagationContext = scope.getPropagationContext();
404-
final @Nullable User user = scope.getUser();
405379
setTraceId(propagationContext.getTraceId().toString());
406380
setPublicKey(new Dsn(options.getDsn()).getPublicKey());
407381
setRelease(options.getRelease());
408382
setEnvironment(options.getEnvironment());
409-
setUserSegment(user != null ? getSegment(user) : null);
410383
setTransaction(null);
411384
setSampleRate(null);
412385
setSampled(null);
413386
}
414387

415-
/**
416-
* @deprecated has no effect and will be removed in the next major update.
417-
*/
418-
@Deprecated
419-
private static @Nullable String getSegment(final @NotNull User user) {
420-
if (user.getSegment() != null) {
421-
return user.getSegment();
422-
}
423-
424-
final Map<String, String> userData = user.getData();
425-
if (userData != null) {
426-
return userData.get("segment");
427-
} else {
428-
return null;
429-
}
430-
}
431-
432388
private static @Nullable Double sampleRate(@Nullable TracesSamplingDecision samplingDecision) {
433389
if (samplingDecision == null) {
434390
return null;
@@ -484,15 +440,13 @@ public TraceContext toTraceContext() {
484440
final String publicKey = getPublicKey();
485441

486442
if (traceIdString != null && publicKey != null) {
487-
@SuppressWarnings("deprecation")
488443
final @NotNull TraceContext traceContext =
489444
new TraceContext(
490445
new SentryId(traceIdString),
491446
publicKey,
492447
getRelease(),
493448
getEnvironment(),
494449
getUserId(),
495-
getUserSegment(),
496450
getTransaction(),
497451
getSampleRate(),
498452
getSampled());
@@ -510,21 +464,12 @@ public static final class DSCKeys {
510464
public static final String RELEASE = "sentry-release";
511465
public static final String USER_ID = "sentry-user_id";
512466
public static final String ENVIRONMENT = "sentry-environment";
513-
public static final String USER_SEGMENT = "sentry-user_segment";
514467
public static final String TRANSACTION = "sentry-transaction";
515468
public static final String SAMPLE_RATE = "sentry-sample_rate";
516469
public static final String SAMPLED = "sentry-sampled";
517470

518471
public static final List<String> ALL =
519472
Arrays.asList(
520-
TRACE_ID,
521-
PUBLIC_KEY,
522-
RELEASE,
523-
USER_ID,
524-
ENVIRONMENT,
525-
USER_SEGMENT,
526-
TRANSACTION,
527-
SAMPLE_RATE,
528-
SAMPLED);
473+
TRACE_ID, PUBLIC_KEY, RELEASE, USER_ID, ENVIRONMENT, TRANSACTION, SAMPLE_RATE, SAMPLED);
529474
}
530475
}

sentry/src/main/java/io/sentry/SentryTracer.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import io.sentry.protocol.SentryId;
66
import io.sentry.protocol.SentryTransaction;
77
import io.sentry.protocol.TransactionNameSource;
8-
import io.sentry.protocol.User;
98
import io.sentry.util.Objects;
109
import java.util.ArrayList;
1110
import java.util.List;
@@ -653,14 +652,8 @@ public void finish(@Nullable SpanStatus status, @Nullable SentryDate finishDate)
653652
private void updateBaggageValues() {
654653
synchronized (this) {
655654
if (baggage.isMutable()) {
656-
final AtomicReference<User> userAtomicReference = new AtomicReference<>();
657-
scopes.configureScope(
658-
scope -> {
659-
userAtomicReference.set(scope.getUser());
660-
});
661655
baggage.setValuesFromTransaction(
662656
getSpanContext().getTraceId(),
663-
userAtomicReference.get(),
664657
scopes.getOptions(),
665658
this.getSamplingDecision(),
666659
getName(),

0 commit comments

Comments
 (0)