Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- NOTE: Our `sentry-opentelemetry-agentless-spring` is not working yet for Spring Boot 4. Please use `sentry-opentelemetry-agent` until OpenTelemetry has support for Spring Boot 4.
- Replace `UUIDGenerator` implementation with Apache licensed code ([#4662](https://github.com/getsentry/sentry-java/pull/4662))
- Replace `Random` implementation with MIT licensed code ([#4664](https://github.com/getsentry/sentry-java/pull/4664))
- Add support for `vars` attribute in `SentryStackFrame` ([#4686](https://github.com/getsentry/sentry-java/pull/4686))
Comment thread
limbonaut marked this conversation as resolved.

## 8.20.0

Expand Down
1 change: 1 addition & 0 deletions sentry/api/sentry.api
Original file line number Diff line number Diff line change
Expand Up @@ -5933,6 +5933,7 @@ public final class io/sentry/protocol/SentryStackFrame$JsonKeys {
public static final field RAW_FUNCTION Ljava/lang/String;
public static final field SYMBOL Ljava/lang/String;
public static final field SYMBOL_ADDR Ljava/lang/String;
public static final field VARS Ljava/lang/String;
public fun <init> ()V
}

Expand Down
13 changes: 10 additions & 3 deletions sentry/src/main/java/io/sentry/protocol/SentryStackFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public final class SentryStackFrame implements JsonUnknown, JsonSerializable {
private @Nullable List<String> postContext;

/** Mapping of local variables and expression names that were available in this frame. */
private @Nullable Map<String, String> vars;
private @Nullable Map<String, Object> vars;

private @Nullable List<Integer> framesOmitted;

Expand Down Expand Up @@ -170,11 +170,11 @@ public void setPostContext(final @Nullable List<String> postContext) {
this.postContext = postContext;
}

public @Nullable Map<String, String> getVars() {
public @Nullable Map<String, Object> getVars() {
return vars;
}

public void setVars(final @Nullable Map<String, String> vars) {
public void setVars(final @Nullable Map<String, Object> vars) {
this.vars = vars;
}

Expand Down Expand Up @@ -366,6 +366,7 @@ public static final class JsonKeys {
public static final String LOCK = "lock";
public static final String PRE_CONTEXT = "pre_context";
public static final String POST_CONTEXT = "post_context";
public static final String VARS = "vars";
}

@Override
Expand Down Expand Up @@ -432,6 +433,9 @@ public void serialize(final @NotNull ObjectWriter writer, final @NotNull ILogger
if (postContext != null && !postContext.isEmpty()) {
writer.name(JsonKeys.POST_CONTEXT).value(logger, postContext);
}
if (vars != null && !vars.isEmpty()) {
writer.name(JsonKeys.VARS).value(logger, vars);
}
if (unknown != null) {
for (String key : unknown.keySet()) {
Object value = unknown.get(key);
Expand Down Expand Up @@ -513,6 +517,9 @@ public static final class Deserializer implements JsonDeserializer<SentryStackFr
case JsonKeys.POST_CONTEXT:
sentryStackFrame.postContext = (List<String>) reader.nextObjectOrNull();
break;
case JsonKeys.VARS:
sentryStackFrame.vars = (Map<String, Object>) reader.nextObjectOrNull();
break;
default:
if (unknown == null) {
unknown = new ConcurrentHashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,19 @@ class SentryStackFrameSerializationTest {
"0a959b53-6bdf-45d1-93ca-936281d7897a",
"4e6085a3-1e44-4aa2-b3d9-9b79dca970ed",
)
vars =
mapOf<String, Any?>(
"int_var" to 42,
"array_var" to listOf<Any?>(true, 17, "7a3750d1-9177-4ee2-8016-3ba02fa90291"),
"string_var" to "325ad70e-1a8b-4d2d-ba92-182ee49448b7",
"object_var" to
mapOf<String, Any?>(
"int_prop" to 53,
"string_prop" to "93db3ec5-b1ec-4e95-b6d0-b9633c9e03cd",
"bool_prop" to false,
),
"bool_var" to false,
)
}
}

Expand Down
17 changes: 16 additions & 1 deletion sentry/src/test/resources/json/sentry_stack_frame.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,20 @@
"2153c99d-2f17-45f1-a173-69e08cc6a219",
"0a959b53-6bdf-45d1-93ca-936281d7897a",
"4e6085a3-1e44-4aa2-b3d9-9b79dca970ed"
]
],
"vars": {
"int_var": 42,
"array_var": [
true,
17,
"7a3750d1-9177-4ee2-8016-3ba02fa90291"
],
"string_var": "325ad70e-1a8b-4d2d-ba92-182ee49448b7",
"object_var": {
"int_prop": 53,
"string_prop": "93db3ec5-b1ec-4e95-b6d0-b9633c9e03cd",
"bool_prop": false
},
"bool_var": false
}
}
Loading