Skip to content

fix(appStart): Add frame delay data in app start span #4873

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

Draft
wants to merge 1 commit into
base: antonis/appstart-frames
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ public void fetchNativeFrames(Promise promise) {
int totalFrames = 0;
int slowFrames = 0;
int frozenFrames = 0;
int framesDelay = 0; // TODO

final SparseIntArray[] framesRates = frameMetricsAggregator.getMetrics();

Expand Down Expand Up @@ -518,6 +519,7 @@ public void fetchNativeFrames(Promise promise) {
map.putInt("totalFrames", totalFrames);
map.putInt("slowFrames", slowFrames);
map.putInt("frozenFrames", frozenFrames);
map.putInt("framesDelay", framesDelay);

promise.resolve(map);
} catch (Throwable ignored) { // NOPMD - We don't want to crash in any case
Expand Down
6 changes: 6 additions & 0 deletions packages/core/ios/RNSentry.mm
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,11 @@

#if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST
if (PrivateSentrySDKOnly.isFramesTrackingRunning) {
// TODO
CFTimeInterval framesDelay = [PrivateSentrySDKOnly getFramesDelay:0.0

Check failure on line 521 in packages/core/ios/RNSentry.mm

View workflow job for this annotation

GitHub Actions / Build ios production no-frameworks

cannot initialize a variable of type 'CFTimeInterval' (aka 'double') with an rvalue of type 'id'

Check failure on line 521 in packages/core/ios/RNSentry.mm

View workflow job for this annotation

GitHub Actions / Build ios production no-frameworks

no known class method for selector 'getFramesDelay:endSystemTimestamp:'

Check failure on line 521 in packages/core/ios/RNSentry.mm

View workflow job for this annotation

GitHub Actions / Build ios dev no-frameworks

cannot initialize a variable of type 'CFTimeInterval' (aka 'double') with an rvalue of type 'id'

Check failure on line 521 in packages/core/ios/RNSentry.mm

View workflow job for this annotation

GitHub Actions / Build ios dev no-frameworks

no known class method for selector 'getFramesDelay:endSystemTimestamp:'

Check failure on line 521 in packages/core/ios/RNSentry.mm

View workflow job for this annotation

GitHub Actions / Build legacy ios dev dynamic-frameworks

cannot initialize a variable of type 'CFTimeInterval' (aka 'double') with an rvalue of type 'id'

Check failure on line 521 in packages/core/ios/RNSentry.mm

View workflow job for this annotation

GitHub Actions / Build legacy ios dev dynamic-frameworks

no known class method for selector 'getFramesDelay:endSystemTimestamp:'

Check failure on line 521 in packages/core/ios/RNSentry.mm

View workflow job for this annotation

GitHub Actions / Build legacy ios dev no-frameworks

cannot initialize a variable of type 'CFTimeInterval' (aka 'double') with an rvalue of type 'id'

Check failure on line 521 in packages/core/ios/RNSentry.mm

View workflow job for this annotation

GitHub Actions / Build legacy ios dev no-frameworks

no known class method for selector 'getFramesDelay:endSystemTimestamp:'

Check failure on line 521 in packages/core/ios/RNSentry.mm

View workflow job for this annotation

GitHub Actions / Build new ios dev no-frameworks

cannot initialize a variable of type 'CFTimeInterval' (aka 'double') with an rvalue of type 'id'

Check failure on line 521 in packages/core/ios/RNSentry.mm

View workflow job for this annotation

GitHub Actions / Build new ios dev no-frameworks

no known class method for selector 'getFramesDelay:endSystemTimestamp:'

Check failure on line 521 in packages/core/ios/RNSentry.mm

View workflow job for this annotation

GitHub Actions / Build ios production dynamic-frameworks

cannot initialize a variable of type 'CFTimeInterval' (aka 'double') with an rvalue of type 'id'

Check failure on line 521 in packages/core/ios/RNSentry.mm

View workflow job for this annotation

GitHub Actions / Build ios production dynamic-frameworks

no known class method for selector 'getFramesDelay:endSystemTimestamp:'

Check failure on line 521 in packages/core/ios/RNSentry.mm

View workflow job for this annotation

GitHub Actions / Build legacy ios production dynamic-frameworks

cannot initialize a variable of type 'CFTimeInterval' (aka 'double') with an rvalue of type 'id'

Check failure on line 521 in packages/core/ios/RNSentry.mm

View workflow job for this annotation

GitHub Actions / Build legacy ios production dynamic-frameworks

no known class method for selector 'getFramesDelay:endSystemTimestamp:'

Check failure on line 521 in packages/core/ios/RNSentry.mm

View workflow job for this annotation

GitHub Actions / Build new ios production no-frameworks

cannot initialize a variable of type 'CFTimeInterval' (aka 'double') with an rvalue of type 'id'

Check failure on line 521 in packages/core/ios/RNSentry.mm

View workflow job for this annotation

GitHub Actions / Build new ios production no-frameworks

no known class method for selector 'getFramesDelay:endSystemTimestamp:'

Check failure on line 521 in packages/core/ios/RNSentry.mm

View workflow job for this annotation

GitHub Actions / Build ios dev dynamic-frameworks

cannot initialize a variable of type 'CFTimeInterval' (aka 'double') with an rvalue of type 'id'

Check failure on line 521 in packages/core/ios/RNSentry.mm

View workflow job for this annotation

GitHub Actions / Build ios dev dynamic-frameworks

no known class method for selector 'getFramesDelay:endSystemTimestamp:'

Check failure on line 521 in packages/core/ios/RNSentry.mm

View workflow job for this annotation

GitHub Actions / Build legacy ios production no-frameworks

cannot initialize a variable of type 'CFTimeInterval' (aka 'double') with an rvalue of type 'id'

Check failure on line 521 in packages/core/ios/RNSentry.mm

View workflow job for this annotation

GitHub Actions / Build legacy ios production no-frameworks

no known class method for selector 'getFramesDelay:endSystemTimestamp:'
endSystemTimestamp:0.0];
NSNumber *delay = [NSNumber numberWithDouble:framesDelay];

SentryScreenFrames *frames = PrivateSentrySDKOnly.currentScreenFrames;

if (frames == nil) {
Expand All @@ -532,6 +537,7 @@
@"totalFrames" : total,
@"frozenFrames" : frozen,
@"slowFrames" : slow,
@"framesDelay" : delay,
});
} else {
resolve(nil);
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/js/NativeRNSentry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export type NativeFramesResponse = {
totalFrames: number;
slowFrames: number;
frozenFrames: number;
framesDelay: number;
};

export type NativeReleaseResponse = {
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/js/tracing/integrations/appStart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ function attachFrameDataToSpan(span: SpanJSON, frames: NativeFramesResponse): vo
span.data['frames.total'] = frames.totalFrames;
span.data['frames.slow'] = frames.slowFrames;
span.data['frames.frozen'] = frames.frozenFrames;
span.data['frames.delay'] = frames.framesDelay;

logger.debug('[AppStart] Attached frame data to span.', {
spanId: span.span_id,
Expand Down
5 changes: 5 additions & 0 deletions packages/core/test/tracing/integrations/appStart.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,7 @@ describe('Frame Data Integration', () => {
totalFrames: 150,
slowFrames: 5,
frozenFrames: 2,
framesDelay: 0,
};

mockFunction(NATIVE.fetchNativeFrames).mockResolvedValue(mockEndFrames);
Expand Down Expand Up @@ -822,6 +823,7 @@ describe('Frame Data Integration', () => {
totalFrames: 200,
slowFrames: 8,
frozenFrames: 1,
framesDelay: 0,
};

mockFunction(NATIVE.fetchNativeFrames).mockResolvedValue(mockEndFrames);
Expand Down Expand Up @@ -849,6 +851,7 @@ describe('Frame Data Integration', () => {
totalFrames: 120,
slowFrames: 3,
frozenFrames: 0,
framesDelay: 0,
};

mockFunction(NATIVE.fetchNativeFrames).mockResolvedValue(mockEndFrames);
Expand Down Expand Up @@ -878,6 +881,7 @@ describe('Frame Data Integration', () => {
totalFrames: 180,
slowFrames: 12,
frozenFrames: 3,
framesDelay: 0,
};

mockFunction(NATIVE.fetchNativeFrames).mockResolvedValue(mockEndFrames);
Expand Down Expand Up @@ -907,6 +911,7 @@ describe('Frame Data Integration', () => {
totalFrames: 0,
slowFrames: 0,
frozenFrames: 0,
framesDelay: 0,
};

mockFunction(NATIVE.fetchNativeFrames).mockResolvedValue(mockEndFrames);
Expand Down
10 changes: 10 additions & 0 deletions packages/core/test/tracing/integrations/nativeframes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,13 @@ describe('NativeFramesInstrumentation', () => {
totalFrames: 100,
slowFrames: 20,
frozenFrames: 5,
framesDelay: 0,
};
const finishFrames = {
totalFrames: 200,
slowFrames: 40,
frozenFrames: 10,
framesDelay: 0,
};
mockFunction(NATIVE.fetchNativeFrames).mockResolvedValueOnce(startFrames).mockResolvedValueOnce(finishFrames);

Expand Down Expand Up @@ -99,11 +101,13 @@ describe('NativeFramesInstrumentation', () => {
totalFrames: 0,
slowFrames: 0,
frozenFrames: 0,
framesDelay: 0,
};
const finishFrames = {
totalFrames: 100,
slowFrames: 20,
frozenFrames: 5,
framesDelay: 0,
};
mockFunction(NATIVE.fetchNativeFrames).mockResolvedValueOnce(startFrames).mockResolvedValueOnce(finishFrames);

Expand Down Expand Up @@ -139,11 +143,13 @@ describe('NativeFramesInstrumentation', () => {
totalFrames: 100,
slowFrames: 20,
frozenFrames: 5,
framesDelay: 0,
};
const finishFrames = {
totalFrames: 100,
slowFrames: 20,
frozenFrames: 5,
framesDelay: 0,
};
mockFunction(NATIVE.fetchNativeFrames).mockResolvedValueOnce(startFrames).mockResolvedValueOnce(finishFrames);

Expand Down Expand Up @@ -174,6 +180,7 @@ describe('NativeFramesInstrumentation', () => {
totalFrames: 200,
slowFrames: 40,
frozenFrames: 10,
framesDelay: 0,
};
mockFunction(NATIVE.fetchNativeFrames).mockResolvedValueOnce(startFrames).mockResolvedValueOnce(finishFrames);

Expand Down Expand Up @@ -203,6 +210,7 @@ describe('NativeFramesInstrumentation', () => {
totalFrames: 100,
slowFrames: 20,
frozenFrames: 5,
framesDelay: 0,
};
const finishFrames: null = null;
mockFunction(NATIVE.fetchNativeFrames).mockResolvedValueOnce(startFrames).mockResolvedValueOnce(finishFrames);
Expand Down Expand Up @@ -244,11 +252,13 @@ describe('NativeFramesInstrumentation', () => {
totalFrames: 100,
slowFrames: 20,
frozenFrames: 5,
framesDelay: 0,
};
const finishFrames = {
totalFrames: 200,
slowFrames: 40,
frozenFrames: 10,
framesDelay: 0,
};
mockFunction(NATIVE.fetchNativeFrames).mockResolvedValueOnce(startFrames).mockResolvedValueOnce(finishFrames);

Expand Down
Loading