-
-
Notifications
You must be signed in to change notification settings - Fork 444
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
Calculate frame delay on a span level #3197
Conversation
|
Performance metrics 🚀
|
Revision | Plain | With Sentry | Diff |
---|---|---|---|
93a76ca | 377.96 ms | 447.52 ms | 69.56 ms |
baaf637 | 462.32 ms | 579.22 ms | 116.90 ms |
2465853 | 411.39 ms | 461.10 ms | 49.72 ms |
c3f503e | 360.41 ms | 434.67 ms | 74.27 ms |
93a76ca | 381.08 ms | 459.22 ms | 78.14 ms |
c7e2fbc | 393.98 ms | 478.24 ms | 84.27 ms |
2465853 | 422.61 ms | 491.20 ms | 68.58 ms |
5e04ee8 | 302.68 ms | 343.36 ms | 40.68 ms |
283d83e | 416.81 ms | 497.22 ms | 80.41 ms |
d6d2b2e | 413.20 ms | 486.76 ms | 73.56 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
93a76ca | 1.72 MiB | 2.29 MiB | 576.75 KiB |
baaf637 | 1.72 MiB | 2.27 MiB | 558.42 KiB |
2465853 | 1.70 MiB | 2.27 MiB | 583.82 KiB |
c3f503e | 1.72 MiB | 2.29 MiB | 577.04 KiB |
93a76ca | 1.72 MiB | 2.29 MiB | 576.75 KiB |
c7e2fbc | 1.72 MiB | 2.29 MiB | 576.40 KiB |
2465853 | 1.70 MiB | 2.27 MiB | 583.82 KiB |
5e04ee8 | 1.70 MiB | 2.27 MiB | 584.64 KiB |
283d83e | 1.72 MiB | 2.29 MiB | 577.69 KiB |
d6d2b2e | 1.72 MiB | 2.27 MiB | 555.05 KiB |
Previous results on branch: feat/frame-delay-per-span
Startup times
Revision | Plain | With Sentry | Diff |
---|---|---|---|
cd12d56 | 391.75 ms | 461.53 ms | 69.78 ms |
af827fa | 439.17 ms | 516.45 ms | 77.28 ms |
2d2263f | 348.71 ms | 388.90 ms | 40.18 ms |
2248393 | 448.29 ms | 525.46 ms | 77.17 ms |
d9a60b1 | 405.83 ms | 465.22 ms | 59.39 ms |
8dff466 | 390.89 ms | 469.38 ms | 78.49 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
cd12d56 | 1.70 MiB | 2.27 MiB | 586.08 KiB |
af827fa | 1.70 MiB | 2.27 MiB | 586.30 KiB |
2d2263f | 1.70 MiB | 2.27 MiB | 586.22 KiB |
2248393 | 1.70 MiB | 2.27 MiB | 586.38 KiB |
d9a60b1 | 1.70 MiB | 2.27 MiB | 586.30 KiB |
8dff466 | 1.70 MiB | 2.27 MiB | 586.42 KiB |
sentry-android-core/src/main/java/io/sentry/android/core/SpanFrameMetricsCollector.java
Show resolved
Hide resolved
sentry-android-core/src/main/java/io/sentry/android/core/SpanFrameMetricsCollector.java
Outdated
Show resolved
Hide resolved
sentry-android-core/src/main/java/io/sentry/android/core/SpanFrameMetricsCollector.java
Outdated
Show resolved
Hide resolved
sentry-android-core/src/main/java/io/sentry/android/core/SpanFrameMetricsCollector.java
Outdated
Show resolved
Hide resolved
sentry-android-core/src/test/java/io/sentry/android/core/SpanFrameMetricsCollectorTest.kt
Show resolved
Hide resolved
sentry-android-core/src/main/java/io/sentry/android/core/SpanFrameMetricsCollector.java
Show resolved
Hide resolved
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.
It looks good overall.
I guess we have to revisit the SpanFrameMetricsCollector
, as it doesn't work correctly for multiple spans at the same time.
Maybe there is also a way to get rid of those intermediate classes (SpanStart
and NanoTimeStamp
), too?
sentry-android-core/src/main/java/io/sentry/android/core/SpanFrameMetricsCollector.java
Outdated
Show resolved
Hide resolved
I've resolved the issue for multi-spans, mixed up head/tailSet APIs 🙈 |
sentry-android-core/src/main/java/io/sentry/android/core/SpanFrameMetricsCollector.java
Outdated
Show resolved
Hide resolved
sentry-android-core/src/main/java/io/sentry/android/core/SpanFrameMetricsCollector.java
Outdated
Show resolved
Hide resolved
sentry-android-core/src/main/java/io/sentry/android/core/SpanFrameMetricsCollector.java
Show resolved
Hide resolved
return; | ||
} | ||
|
||
final long spanDurationNanos = spanEndNanos - spanStartNanos; |
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.
just trying to wrap my head around - why this wasn't working and why do we need a separate collection to track start timestamps?
final long spanDurationNanos = spanFinishDate.diff(span.getStartDate());
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.
in this case it should work fine
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.
Because our ISpans
only have SentryDate
, which itself has no guarantees around precision - it could be e.g. a time synced unix timestamp. SentryDate
is also not Comparable
, so it can't be saved in an ordered set.
I'd be happy to change this within the whole SDK though. Maybe an extra one, to not blow this PR up too much 😅
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.
but SentryDate
is an abstract class, in the end it'll be either SentryNanotimeDate
or SentryInstantDate
which both have the nanoseconds precision. And it's actually Comparable
;)
sentry-java/sentry/src/main/java/io/sentry/SentryDate.java
Lines 48 to 51 in a537f8a
@Override | |
public int compareTo(@NotNull SentryDate otherDate) { | |
return Long.valueOf(nanoTimestamp()).compareTo(otherDate.nanoTimestamp()); | |
} |
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.
Alright, I've looked into it and got it working by applying a little trick
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.
you can remove that trick if you use the SentryNanotimeDate
in the Frame
object, instead of nanoseconds
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.
Great stuff overall, I just have a couple of questions to clarify. Great work with the new sample screen for testing this stuff, looks really helpful 🚀
sentry-android-core/src/main/java/io/sentry/android/core/SpanFrameMetricsCollector.java
Outdated
Show resolved
Hide resolved
} | ||
|
||
@ApiStatus.Internal | ||
public static class Frame implements Comparable<Frame> { |
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.
this class can be private
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.
just make Frame
class private and we're good to go.
Your call if you want to change the nanoseconds to SentryNanotimeDate
(or evaluate to do it in another PR)
very nice!
📜 Description
Fixes #3183
💡 Motivation and Context
Screen_recording_20240208_093207.mp4
💚 How did you test it?
📝 Checklist
sendDefaultPII
is enabled.🔮 Next steps