Skip to content

Commit 2efd7ea

Browse files
authored
Merge branch 'main' into feat/profiling-cursor-rules
2 parents 574d4cc + 1564554 commit 2efd7ea

File tree

14 files changed

+249
-15
lines changed

14 files changed

+249
-15
lines changed

.claude/settings.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(find:*)",
5+
"Bash(ls:*)",
6+
"Bash(git:*)",
7+
"Bash(git status:*)",
8+
"Bash(git log:*)",
9+
"Bash(git diff:*)",
10+
"Bash(git show:*)",
11+
"Bash(git branch:*)",
12+
"Bash(git remote:*)",
13+
"Bash(git tag:*)",
14+
"Bash(git stash list:*)",
15+
"Bash(git rev-parse:*)",
16+
"Bash(gh pr view:*)",
17+
"Bash(gh pr list:*)",
18+
"Bash(gh pr checks:*)",
19+
"Bash(gh pr diff:*)",
20+
"Bash(gh issue view:*)",
21+
"Bash(gh issue list:*)",
22+
"Bash(gh run view:*)",
23+
"Bash(gh run list:*)",
24+
"Bash(gh run logs:*)",
25+
"Bash(gh repo view:*)",
26+
"WebFetch(domain:github.com)",
27+
"WebFetch(domain:docs.sentry.io)",
28+
"WebFetch(domain:develop.sentry.dev)",
29+
"Bash(grep:*)",
30+
"Bash(mv:*)"
31+
],
32+
"deny": []
33+
}
34+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Changelog Preview
2+
on:
3+
pull_request:
4+
types:
5+
- opened
6+
- synchronize
7+
- reopened
8+
- edited
9+
- labeled
10+
- unlabeled
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
15+
jobs:
16+
changelog-preview:
17+
uses: getsentry/craft/.github/workflows/changelog-preview.yml@v2
18+
secrets: inherit

.github/workflows/codeql-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
3737

3838
- name: Initialize CodeQL
39-
uses: github/codeql-action/init@1b168cd39490f61582a9beae412bb7057a6b2c4e # pin@v2
39+
uses: github/codeql-action/init@cdefb33c0f6224e58673d9004f47f7cb3e328b89 # pin@v2
4040
with:
4141
languages: 'java'
4242

@@ -45,4 +45,4 @@ jobs:
4545
./gradlew buildForCodeQL --no-build-cache
4646
4747
- name: Perform CodeQL Analysis
48-
uses: github/codeql-action/analyze@1b168cd39490f61582a9beae412bb7057a6b2c4e # pin@v2
48+
uses: github/codeql-action/analyze@cdefb33c0f6224e58673d9004f47f7cb3e328b89 # pin@v2

.github/workflows/generate-javadocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
run: |
2727
./gradlew aggregateJavadocs
2828
- name: Deploy
29-
uses: JamesIves/github-pages-deploy-action@9d877eea73427180ae43cf98e8914934fe157a1a # pin@4.7.6
29+
uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f # pin@4.8.0
3030
with:
3131
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3232
BRANCH: gh-pages

.github/workflows/release.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,19 @@ on:
33
workflow_dispatch:
44
inputs:
55
version:
6-
description: Version to release
7-
required: true
6+
description: Version to release (or "auto")
7+
required: false
88
force:
99
description: Force a release even when there are release-blockers (optional)
1010
required: false
1111
merge_target:
1212
description: Target branch to merge into. Uses the default branch as a fallback (optional)
1313
required: false
1414

15+
permissions:
16+
contents: write
17+
pull-requests: write
18+
1519
jobs:
1620
release:
1721
runs-on: ubuntu-latest
@@ -30,7 +34,7 @@ jobs:
3034
fetch-depth: 0
3135
submodules: 'recursive'
3236
- name: Prepare release
33-
uses: getsentry/action-prepare-release@v1
37+
uses: getsentry/craft@c6e2f04939b6ee67030588afbb5af76b127d8203 # v2
3438
env:
3539
GITHUB_TOKEN: ${{ steps.token.outputs.token }}
3640
with:

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@
55
### Features
66

77
- Added `io.sentry.ndk.sdk-name` Android manifest option to configure the native SDK's name ([#5027](https://github.com/getsentry/sentry-java/pull/5027))
8+
- Replace `sentry.trace.parent_span_id` attribute with `spanId` property on `SentryLogEvent` ([#5040](https://github.com/getsentry/sentry-java/pull/5040))
9+
10+
### Fixes
11+
12+
- Only attach user attributes to logs if `sendDefaultPii` is enabled ([#5036](https://github.com/getsentry/sentry-java/pull/5036))
13+
14+
### Fixes
15+
16+
- Reject new logs if `LoggerBatchProcessor` is shutting down ([#5041](https://github.com/getsentry/sentry-java/pull/5041))
17+
18+
### Dependencies
19+
20+
- Bump Native SDK from v0.12.2 to v0.12.3 ([#5012](https://github.com/getsentry/sentry-java/pull/5012))
21+
- [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0123)
22+
- [diff](https://github.com/getsentry/sentry-native/compare/0.12.2...0.12.3)
823

924
## 8.30.0
1025

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ quartz = { module = "org.quartz-scheduler:quartz", version = "2.3.0" }
147147
reactor-core = { module = "io.projectreactor:reactor-core", version = "3.5.3" }
148148
retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }
149149
retrofit-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "retrofit" }
150-
sentry-native-ndk = { module = "io.sentry:sentry-native-ndk", version = "0.12.2" }
150+
sentry-native-ndk = { module = "io.sentry:sentry-native-ndk", version = "0.12.3" }
151151
servlet-api = { module = "javax.servlet:javax.servlet-api", version = "3.1.0" }
152152
servlet-jakarta-api = { module = "jakarta.servlet:jakarta.servlet-api", version = "6.1.0" }
153153
slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }

sentry/api/sentry.api

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3238,15 +3238,19 @@ public final class io/sentry/SentryLogEvent : io/sentry/JsonSerializable, io/sen
32383238
public fun getBody ()Ljava/lang/String;
32393239
public fun getLevel ()Lio/sentry/SentryLogLevel;
32403240
public fun getSeverityNumber ()Ljava/lang/Integer;
3241+
public fun getSpanId ()Lio/sentry/SpanId;
32413242
public fun getTimestamp ()Ljava/lang/Double;
3243+
public fun getTraceId ()Lio/sentry/protocol/SentryId;
32423244
public fun getUnknown ()Ljava/util/Map;
32433245
public fun serialize (Lio/sentry/ObjectWriter;Lio/sentry/ILogger;)V
32443246
public fun setAttribute (Ljava/lang/String;Lio/sentry/SentryLogEventAttributeValue;)V
32453247
public fun setAttributes (Ljava/util/Map;)V
32463248
public fun setBody (Ljava/lang/String;)V
32473249
public fun setLevel (Lio/sentry/SentryLogLevel;)V
32483250
public fun setSeverityNumber (Ljava/lang/Integer;)V
3251+
public fun setSpanId (Lio/sentry/SpanId;)V
32493252
public fun setTimestamp (Ljava/lang/Double;)V
3253+
public fun setTraceId (Lio/sentry/protocol/SentryId;)V
32503254
public fun setUnknown (Ljava/util/Map;)V
32513255
}
32523256

@@ -3261,6 +3265,7 @@ public final class io/sentry/SentryLogEvent$JsonKeys {
32613265
public static final field BODY Ljava/lang/String;
32623266
public static final field LEVEL Ljava/lang/String;
32633267
public static final field SEVERITY_NUMBER Ljava/lang/String;
3268+
public static final field SPAN_ID Ljava/lang/String;
32643269
public static final field TIMESTAMP Ljava/lang/String;
32653270
public static final field TRACE_ID Ljava/lang/String;
32663271
public fun <init> ()V

sentry/src/main/java/io/sentry/SentryLogEvent.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
public final class SentryLogEvent implements JsonUnknown, JsonSerializable {
1414

1515
private @NotNull SentryId traceId;
16+
private @Nullable SpanId spanId;
1617
private @NotNull Double timestamp;
1718
private @NotNull String body;
1819
private @NotNull SentryLogLevel level;
@@ -92,10 +93,27 @@ public void setSeverityNumber(final @Nullable Integer severityNumber) {
9293
this.severityNumber = severityNumber;
9394
}
9495

96+
public @Nullable SpanId getSpanId() {
97+
return spanId;
98+
}
99+
100+
public void setSpanId(final @Nullable SpanId spanId) {
101+
this.spanId = spanId;
102+
}
103+
104+
public @NotNull SentryId getTraceId() {
105+
return traceId;
106+
}
107+
108+
public void setTraceId(final @NotNull SentryId traceId) {
109+
this.traceId = traceId;
110+
}
111+
95112
// region json
96113
public static final class JsonKeys {
97114
public static final String TIMESTAMP = "timestamp";
98115
public static final String TRACE_ID = "trace_id";
116+
public static final String SPAN_ID = "span_id";
99117
public static final String LEVEL = "level";
100118
public static final String SEVERITY_NUMBER = "severity_number";
101119
public static final String BODY = "body";
@@ -109,6 +127,9 @@ public void serialize(final @NotNull ObjectWriter writer, final @NotNull ILogger
109127
writer.beginObject();
110128
writer.name(JsonKeys.TIMESTAMP).value(logger, doubleToBigDecimal(timestamp));
111129
writer.name(JsonKeys.TRACE_ID).value(logger, traceId);
130+
if (spanId != null) {
131+
writer.name(JsonKeys.SPAN_ID).value(logger, spanId);
132+
}
112133
writer.name(JsonKeys.BODY).value(body);
113134
writer.name(JsonKeys.LEVEL).value(logger, level);
114135
if (severityNumber != null) {
@@ -145,6 +166,7 @@ public static final class Deserializer implements JsonDeserializer<SentryLogEven
145166
final @NotNull ObjectReader reader, final @NotNull ILogger logger) throws Exception {
146167
@Nullable Map<String, Object> unknown = null;
147168
@Nullable SentryId traceId = null;
169+
@Nullable SpanId spanId = null;
148170
@Nullable Double timestamp = null;
149171
@Nullable String body = null;
150172
@Nullable SentryLogLevel level = null;
@@ -158,6 +180,9 @@ public static final class Deserializer implements JsonDeserializer<SentryLogEven
158180
case JsonKeys.TRACE_ID:
159181
traceId = reader.nextOrNull(logger, new SentryId.Deserializer());
160182
break;
183+
case JsonKeys.SPAN_ID:
184+
spanId = reader.nextOrNull(logger, new SpanId.Deserializer());
185+
break;
161186
case JsonKeys.TIMESTAMP:
162187
timestamp = reader.nextDoubleOrNull();
163188
break;
@@ -216,6 +241,7 @@ public static final class Deserializer implements JsonDeserializer<SentryLogEven
216241

217242
logEvent.setAttributes(attributes);
218243
logEvent.setSeverityNumber(severityNumber);
244+
logEvent.setSpanId(spanId);
219245
logEvent.setUnknown(unknown);
220246

221247
return logEvent;

sentry/src/main/java/io/sentry/logger/LoggerApi.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ private void captureLog(
131131
span == null ? propagationContext.getSpanId() : span.getSpanContext().getSpanId();
132132
final SentryLogEvent logEvent =
133133
new SentryLogEvent(traceId, timestampToUse, messageToUse, level);
134-
logEvent.setAttributes(createAttributes(params, message, spanId, args));
134+
logEvent.setSpanId(spanId);
135+
logEvent.setAttributes(createAttributes(params, message, args));
135136
logEvent.setSeverityNumber(level.getSeverityNumber());
136137

137138
scopes.getClient().captureLog(logEvent, combinedScope);
@@ -160,7 +161,6 @@ private void captureLog(
160161
private @NotNull HashMap<String, SentryLogEventAttributeValue> createAttributes(
161162
final @NotNull SentryLogParameters params,
162163
final @NotNull String message,
163-
final @NotNull SpanId spanId,
164164
final @Nullable Object... args) {
165165
final @NotNull HashMap<String, SentryLogEventAttributeValue> attributes = new HashMap<>();
166166
final @NotNull String origin = params.getOrigin();
@@ -239,15 +239,13 @@ private void captureLog(
239239
"sentry.release", new SentryLogEventAttributeValue(SentryAttributeType.STRING, release));
240240
}
241241

242-
attributes.put(
243-
"sentry.trace.parent_span_id",
244-
new SentryLogEventAttributeValue(SentryAttributeType.STRING, spanId));
245-
246242
if (Platform.isJvm()) {
247243
setServerName(attributes);
248244
}
249245

250-
setUser(attributes);
246+
if (scopes.getOptions().isSendDefaultPii()) {
247+
setUser(attributes);
248+
}
251249

252250
return attributes;
253251
}

0 commit comments

Comments
 (0)