-
-
Notifications
You must be signed in to change notification settings - Fork 452
SessionID as string #3834
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
Merged
Merged
SessionID as string #3834
Changes from all commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
22029c1
lazy uuid generation for SentryId and SpanId
lbloder f947f82
add changelog
lbloder debd140
Merge branch '8.x.x' into feat/lazy-span-id-v8
adinauer e6df0ad
add tests for lazy init, rework SentryId to cache string result
lbloder 8a93fec
Merge branch '8.x.x' into feat/lazy-span-id-v8
lbloder fe8ccb0
Merge branch '8.x.x' into feat/lazy-span-id-v8
lbloder 28b5bde
Merge branch '8.x.x' into feat/lazy-span-id-v8
lbloder f2fba85
fix changelog
lbloder 3e1a32c
Merge branch '8.x.x' into feat/lazy-span-id-v8
lbloder c7ab294
Update sentry/src/main/java/io/sentry/protocol/SentryId.java
lbloder f1e66b2
Update sentry/src/main/java/io/sentry/protocol/SentryId.java
lbloder 76b23c8
Update sentry/src/main/java/io/sentry/protocol/SentryId.java
lbloder 8599535
Update sentry/src/main/java/io/sentry/protocol/SentryId.java
lbloder 3bae1d7
Update sentry/src/main/java/io/sentry/protocol/SentryId.java
lbloder edba0c7
Format code
getsentry-bot c18a74d
Add object comparison to SpanFrameMetricsCollector only check for tim…
lbloder 35b17db
Merge branch 'feat/lazy-span-id-v8' of github.com:getsentry/sentry-ja…
lbloder a50d881
add proposed SentryUUID class
lbloder 149d59c
[WIP] use SentryUUID instead of UUID.random().toString
lbloder 6418a33
Format code
getsentry-bot 5314e83
split SentryUUID internals into separate classes for easier attribution
lbloder 58a00c4
Merge branch '8.x.x' into feat/lazy-span-id-v8
lbloder 097738b
add changelog
lbloder 3518fce
Merge branch 'feat/lazy-span-id-v8' into feat/fast-id-generation
lbloder 4070536
replace uuid with string for sessionId, use SentryUUID for generating…
lbloder df743f2
add changelog
lbloder 9803d5c
Format code
getsentry-bot d11c3cc
fix tests
lbloder 1ea4212
Merge branch '8.x.x' into feat/fast-id-generation
lbloder 81a3bdb
fix SpanId.EMPTY_ID
lbloder c15312f
Merge branch 'feat/fast-id-generation' into feat/session-id-as-string
adinauer 5d00ae5
Merge branch '8.x.x' into feat/fast-id-generation
lbloder 311c151
Merge branch 'feat/fast-id-generation' into feat/session-id-as-string
lbloder 32097ad
fix tests
lbloder 3adf03d
Format code
getsentry-bot 9a1cf0e
move changelog entry to breaking changes section, add more detail
lbloder fac412e
test normalized is never called in no-arg constructor, only called on…
lbloder d015201
add log if invalid session id is being deserialized
lbloder 9f360d1
Merge branch '8.x.x' into feat/fast-id-generation
lbloder 7828b42
Merge branch 'feat/fast-id-generation' into feat/session-id-as-string
lbloder 30b2602
fix test
lbloder fce5ac8
Merge branch 'feat/fast-id-generation' into feat/session-id-as-string
lbloder 05540a3
Format code
getsentry-bot 143c26e
use new Random Generator
lbloder 57d0a9b
Merge branch 'feat/fast-id-generation' of github.com:getsentry/sentry…
lbloder 3293382
Merge branch 'feat/fast-id-generation' into feat/session-id-as-string
lbloder 45c3cbe
fix Sentry Empty ID, replace dashes if 36 char uuid String is passed …
lbloder 5c2c580
fix Tests for SpanId, add tests for SentryUUID and UUIDStringUtils
lbloder 613cc60
Merge branch 'feat/fast-id-generation' into feat/session-id-as-string
lbloder 1e8c6a7
allow 36 and 32 character session ids
lbloder 22e215e
Merge branch '8.x.x' into feat/session-id-as-string
adinauer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ | |
import java.util.Date; | ||
import java.util.Locale; | ||
import java.util.Map; | ||
import java.util.UUID; | ||
import java.util.concurrent.ConcurrentHashMap; | ||
import java.util.concurrent.atomic.AtomicInteger; | ||
import org.jetbrains.annotations.ApiStatus; | ||
|
@@ -38,7 +37,7 @@ public enum State { | |
private final @Nullable String distinctId; | ||
|
||
/** the SessionId, sid */ | ||
private final @Nullable UUID sessionId; | ||
private final @Nullable String sessionId; | ||
|
||
/** The session init flag */ | ||
private @Nullable Boolean init; | ||
|
@@ -79,7 +78,7 @@ public Session( | |
final @Nullable Date timestamp, | ||
final int errorCount, | ||
final @Nullable String distinctId, | ||
final @Nullable UUID sessionId, | ||
final @Nullable String sessionId, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we have to apply some validation still that this is compliant with the uuid format? |
||
final @Nullable Boolean init, | ||
final @Nullable Long sequence, | ||
final @Nullable Double duration, | ||
|
@@ -115,7 +114,7 @@ public Session( | |
DateUtils.getCurrentDateTime(), | ||
0, | ||
distinctId, | ||
UUID.randomUUID(), | ||
SentryUUID.generateSentryId(), | ||
true, | ||
null, | ||
null, | ||
|
@@ -142,7 +141,7 @@ public boolean isTerminated() { | |
return distinctId; | ||
} | ||
|
||
public @Nullable UUID getSessionId() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should also be on the changelog as breaking change. |
||
public @Nullable String getSessionId() { | ||
return sessionId; | ||
} | ||
|
||
|
@@ -366,7 +365,7 @@ public void serialize(final @NotNull ObjectWriter writer, final @NotNull ILogger | |
throws IOException { | ||
writer.beginObject(); | ||
if (sessionId != null) { | ||
writer.name(JsonKeys.SID).value(sessionId.toString()); | ||
writer.name(JsonKeys.SID).value(sessionId); | ||
} | ||
if (distinctId != null) { | ||
writer.name(JsonKeys.DID).value(distinctId); | ||
|
@@ -435,7 +434,7 @@ public static final class Deserializer implements JsonDeserializer<Session> { | |
Date timestamp = null; | ||
Integer errorCount = null; // @NotNull | ||
String distinctId = null; | ||
UUID sessionId = null; | ||
String sessionId = null; | ||
Boolean init = null; | ||
State status = null; // @NotNull | ||
Long sequence = null; | ||
|
@@ -451,12 +450,11 @@ public static final class Deserializer implements JsonDeserializer<Session> { | |
final String nextName = reader.nextName(); | ||
switch (nextName) { | ||
case JsonKeys.SID: | ||
String sidString = null; | ||
try { | ||
sidString = reader.nextStringOrNull(); | ||
sessionId = UUID.fromString(sidString); | ||
} catch (IllegalArgumentException e) { | ||
logger.log(SentryLevel.ERROR, "%s sid is not valid.", sidString); | ||
String sid = reader.nextStringOrNull(); | ||
if (sid != null && (sid.length() == 36 || sid.length() == 32)) { | ||
sessionId = sid; | ||
} else { | ||
logger.log(SentryLevel.ERROR, "%s sid is not valid.", sid); | ||
} | ||
break; | ||
case JsonKeys.DID: | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should write this down in the changelog as breaking change.