Skip to content

Commit

Permalink
Merge branch 'main' into kw/fix-ttfd-ends-before-ttid
Browse files Browse the repository at this point in the history
  • Loading branch information
krystofwoldrich authored Jun 7, 2024
2 parents 91f8c4c + 10d066c commit f744414
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 11 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,19 @@
### Fix

- Add missing logs to dropped App Start spans ([#3861](https://github.com/getsentry/sentry-react-native/pull/3861))
- Make all options of `startTimeToInitialDisplaySpan` optional ([#3867](https://github.com/getsentry/sentry-react-native/pull/3867))
- Add Span IDs to Time to Display debug logs ([#3868](https://github.com/getsentry/sentry-react-native/pull/3868))
- Use TTID end timestamp when TTFD should be updated with an earlier timestamp ([#3869](https://github.com/getsentry/sentry-react-native/pull/3869))

### Dependencies

- Bump Cocoa SDK from v8.27.0 to v8.28.0 ([#3866](https://github.com/getsentry/sentry-react-native/pull/3866))
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8280)
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.27.0...8.28.0)
- Bump Android SDK from v7.8.0 to v7.10.0 ([#3805](https://github.com/getsentry/sentry-react-native/pull/3805))
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#7100)
- [diff](https://github.com/getsentry/sentry-java/compare/7.8.0...7.10.0)

## 5.23.0

### Features
Expand Down
2 changes: 1 addition & 1 deletion RNSentry.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Pod::Spec.new do |s|
s.preserve_paths = '*.js'

s.dependency 'React-Core'
s.dependency 'Sentry/HybridSDK', '8.27.0'
s.dependency 'Sentry/HybridSDK', '8.28.0'

s.source_files = 'ios/**/*.{h,m,mm}'
s.public_header_files = 'ios/RNSentry.h'
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ android {

dependencies {
implementation 'com.facebook.react:react-native:+'
api 'io.sentry:sentry-android:7.8.0'
api 'io.sentry:sentry-android:7.10.0'
}
19 changes: 12 additions & 7 deletions src/js/tracing/timetodisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ function TimeToDisplay(props: {
* Returns current span if already exists in the currently active span.
*/
export function startTimeToInitialDisplaySpan(
options?: Exclude<StartSpanOptions, 'op' | 'name'> & { name?: string; isAutoInstrumented?: boolean },
options?: Omit<StartSpanOptions, 'op' | 'name'> & {
name?: string;
isAutoInstrumented?: boolean
},
): Span | undefined {
const activeSpan = getActiveSpan();
if (!activeSpan) {
Expand Down Expand Up @@ -224,6 +227,7 @@ function updateInitialDisplaySpan(frameTimestampSeconds: number): void {

if (fullDisplayBeforeInitialDisplay.has(activeSpan)) {
fullDisplayBeforeInitialDisplay.delete(activeSpan);
logger.debug(`[TimeToDisplay] Updating full display with initial display (${span.spanContext().spanId}) end.`);
updateFullDisplaySpan(frameTimestampSeconds, span);
}

Expand All @@ -233,7 +237,7 @@ function updateInitialDisplaySpan(frameTimestampSeconds: number): void {
function updateFullDisplaySpan(frameTimestampSeconds: number, passedInitialDisplaySpan?: Span): void {
const activeSpan = getActiveSpan();
if (!activeSpan) {
logger.warn(`[TimeToDisplay] No active span found to attach ui.load.full_display to.`);
logger.warn(`[TimeToDisplay] No active span found to update ui.load.full_display in.`);
return;
}

Expand All @@ -247,18 +251,19 @@ function updateFullDisplaySpan(frameTimestampSeconds: number, passedInitialDispl
const initialDisplayEndTimestamp = existingInitialDisplaySpan && spanToJSON(existingInitialDisplaySpan).timestamp;
if (!initialDisplayEndTimestamp) {
fullDisplayBeforeInitialDisplay.set(activeSpan, true);
logger.warn(`[TimeToDisplay] Full display called before initial display for active span.`);
logger.warn(`[TimeToDisplay] Full display called before initial display for active span (${activeSpan.spanContext().spanId}).`);
return;
}

const span = startTimeToFullDisplaySpan();
if (!span) {
logger.warn(`[TimeToDisplay] No span found or created, possibly performance is disabled.`);
logger.warn(`[TimeToDisplay] No TimeToFullDisplay span found or created, possibly performance is disabled.`);
return;
}

if (spanToJSON(span).timestamp) {
logger.warn(`[TimeToDisplay] ${spanToJSON(span).description} span already ended.`);
const spanJSON = spanToJSON(span);
if (spanJSON.timestamp) {
logger.warn(`[TimeToDisplay] ${spanJSON.description} (${spanJSON.span_id}) span already ended.`);
return;
}

Expand All @@ -270,7 +275,7 @@ function updateFullDisplaySpan(frameTimestampSeconds: number, passedInitialDispl
}

span.setStatus('ok');
logger.debug(`[TimeToDisplay] ${spanToJSON(span).description} span updated with end timestamp.`);
logger.debug(`[TimeToDisplay] ${spanJSON.description} (${spanJSON.span_id}) span updated with end timestamp.`);

setSpanDurationAsMeasurement('time_to_full_display', span);
}
4 changes: 2 additions & 2 deletions test/perf/metrics-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ startupTimeTest:
diffMax: 150

binarySizeTest:
diffMin: 200 KiB
diffMax: 600 KiB
diffMin: 600 KiB
diffMax: 1000 KiB

0 comments on commit f744414

Please sign in to comment.