Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sample rate to baggage as well as trace in envelope header and flatten user #2135

Merged
merged 10 commits into from Jul 1, 2022
6 changes: 6 additions & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,12 @@

- Filter out app starts with more than 60s ([#2127](https://github.com/getsentry/sentry-java/pull/2127))

## Unreleased

### Features

- Add sample rate to baggage as well as trace in envelope header and flatten user ([#2135](https://github.com/getsentry/sentry-java/pull/2135))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge main into the branch to fix the changelog.


## 6.1.3

### Fixes
Expand Down
30 changes: 7 additions & 23 deletions sentry/api/sentry.api
Expand Up @@ -30,6 +30,7 @@ public final class io/sentry/Baggage {
public fun setEnvironment (Ljava/lang/String;)V
public fun setPublicKey (Ljava/lang/String;)V
public fun setRelease (Ljava/lang/String;)V
public fun setSampleRate (Ljava/lang/String;)V
public fun setTraceId (Ljava/lang/String;)V
public fun setTransaction (Ljava/lang/String;)V
public fun setUserId (Ljava/lang/String;)V
Expand Down Expand Up @@ -1619,10 +1620,12 @@ public final class io/sentry/TraceContext : io/sentry/JsonSerializable, io/sentr
public fun getEnvironment ()Ljava/lang/String;
public fun getPublicKey ()Ljava/lang/String;
public fun getRelease ()Ljava/lang/String;
public fun getSampleRate ()Ljava/lang/String;
public fun getTraceId ()Lio/sentry/protocol/SentryId;
public fun getTransaction ()Ljava/lang/String;
public fun getUnknown ()Ljava/util/Map;
public fun getUser ()Lio/sentry/TraceContext$TraceContextUser;
public fun getUserId ()Ljava/lang/String;
public fun getUserSegment ()Ljava/lang/String;
public fun serialize (Lio/sentry/JsonObjectWriter;Lio/sentry/ILogger;)V
public fun setUnknown (Ljava/util/Map;)V
public fun toBaggage (Lio/sentry/ILogger;)Lio/sentry/Baggage;
Expand All @@ -1638,30 +1641,11 @@ public final class io/sentry/TraceContext$JsonKeys {
public static final field ENVIRONMENT Ljava/lang/String;
public static final field PUBLIC_KEY Ljava/lang/String;
public static final field RELEASE Ljava/lang/String;
public static final field SAMPLE_RATE Ljava/lang/String;
public static final field TRACE_ID Ljava/lang/String;
public static final field TRANSACTION Ljava/lang/String;
public static final field USER Ljava/lang/String;
public fun <init> ()V
}

public final class io/sentry/TraceContext$TraceContextUser : io/sentry/JsonSerializable, io/sentry/JsonUnknown {
public fun <init> (Lio/sentry/protocol/User;)V
public fun getId ()Ljava/lang/String;
public fun getSegment ()Ljava/lang/String;
public fun getUnknown ()Ljava/util/Map;
public fun serialize (Lio/sentry/JsonObjectWriter;Lio/sentry/ILogger;)V
public fun setUnknown (Ljava/util/Map;)V
}

public final class io/sentry/TraceContext$TraceContextUser$Deserializer : io/sentry/JsonDeserializer {
public fun <init> ()V
public fun deserialize (Lio/sentry/JsonObjectReader;Lio/sentry/ILogger;)Lio/sentry/TraceContext$TraceContextUser;
public synthetic fun deserialize (Lio/sentry/JsonObjectReader;Lio/sentry/ILogger;)Ljava/lang/Object;
}

public final class io/sentry/TraceContext$TraceContextUser$JsonKeys {
public static final field ID Ljava/lang/String;
public static final field SEGMENT Ljava/lang/String;
public static final field USER_ID Ljava/lang/String;
public static final field USER_SEGMENT Ljava/lang/String;
public fun <init> ()V
}

Expand Down
12 changes: 8 additions & 4 deletions sentry/src/main/java/io/sentry/Baggage.java
Expand Up @@ -153,11 +153,11 @@ private static String decode(final @NotNull String value) throws UnsupportedEnco
}

public void setTraceId(final @Nullable String traceId) {
set("sentry-traceid", traceId);
set("sentry-trace_id", traceId);
}

public void setPublicKey(final @Nullable String publicKey) {
set("sentry-publickey", publicKey);
set("sentry-public_key", publicKey);
}

public void setEnvironment(final @Nullable String environment) {
Expand All @@ -169,17 +169,21 @@ public void setRelease(final @Nullable String release) {
}

public void setUserId(final @Nullable String userId) {
set("sentry-userid", userId);
set("sentry-user_id", userId);
}

public void setUserSegment(final @Nullable String userSegment) {
set("sentry-usersegment", userSegment);
set("sentry-user_segment", userSegment);
}

public void setTransaction(final @Nullable String transaction) {
set("sentry-transaction", transaction);
}

public void setSampleRate(final @Nullable String sampleRate) {
set("sentry-sample_rate", sampleRate);
}

public void set(final @NotNull String key, final @Nullable String value) {
this.keyValues.put(key, value);
}
Expand Down