Skip to content
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

Feat: Add native SDK information in the replay option event #4663

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

brustolin
Copy link
Contributor

@brustolin brustolin commented Dec 23, 2024

📜 Description

Added cocoa name and version in the session replay options event for easy investigation.

image

💚 How did you test it?

Unit test

📝 Checklist

You have to check all boxes before merging:

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

Copy link

github-actions bot commented Dec 23, 2024

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 6ea51bc

CHANGELOG.md Outdated Show resolved Hide resolved
@brustolin brustolin mentioned this pull request Dec 23, 2024
7 tasks
Copy link

github-actions bot commented Dec 23, 2024

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1233.46 ms 1257.61 ms 24.15 ms
Size 22.31 KiB 769.03 KiB 746.71 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
b695b61 1221.71 ms 1249.18 ms 27.47 ms
0589699 1243.25 ms 1252.60 ms 9.35 ms
3ea21f5 1250.80 ms 1258.88 ms 8.08 ms
407ff99 1190.89 ms 1237.18 ms 46.29 ms
904d7fa 1225.73 ms 1249.22 ms 23.49 ms
c471221 1224.16 ms 1241.59 ms 17.43 ms
1928267 1200.94 ms 1227.17 ms 26.23 ms
09311b6 1238.67 ms 1255.04 ms 16.37 ms
ed49f0c 1215.94 ms 1245.63 ms 29.69 ms
973d574 1240.86 ms 1255.83 ms 14.98 ms

App size

Revision Plain With Sentry Diff
b695b61 21.90 KiB 707.65 KiB 685.75 KiB
0589699 21.58 KiB 656.60 KiB 635.02 KiB
3ea21f5 22.84 KiB 402.63 KiB 379.78 KiB
407ff99 20.76 KiB 427.86 KiB 407.10 KiB
904d7fa 20.76 KiB 432.87 KiB 412.11 KiB
c471221 22.85 KiB 413.89 KiB 391.04 KiB
1928267 22.30 KiB 730.78 KiB 708.47 KiB
09311b6 21.58 KiB 654.67 KiB 633.09 KiB
ed49f0c 21.58 KiB 632.13 KiB 610.55 KiB
973d574 21.58 KiB 542.38 KiB 520.80 KiB

Previous results on branch: feat/sdk-info-sr-tags

Startup times

Revision Plain With Sentry Diff
32a98c1 1227.61 ms 1252.87 ms 25.26 ms
b7ac501 1230.59 ms 1253.66 ms 23.07 ms
7cdca55 1240.24 ms 1256.24 ms 16.00 ms
37adb91 1240.06 ms 1261.49 ms 21.43 ms
62c1f93 1236.84 ms 1256.41 ms 19.56 ms
8e3d9eb 1225.58 ms 1258.66 ms 33.08 ms

App size

Revision Plain With Sentry Diff
32a98c1 22.32 KiB 762.11 KiB 739.79 KiB
b7ac501 22.32 KiB 761.95 KiB 739.63 KiB
7cdca55 22.32 KiB 761.54 KiB 739.22 KiB
37adb91 22.31 KiB 761.39 KiB 739.08 KiB
62c1f93 22.31 KiB 761.40 KiB 739.08 KiB
8e3d9eb 22.31 KiB 768.84 KiB 746.52 KiB

@brustolin brustolin marked this pull request as draft December 23, 2024 16:23
@brustolin brustolin marked this pull request as ready for review December 24, 2024 08:44
Copy link

codecov bot commented Dec 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.231%. Comparing base (9c173e4) to head (6ea51bc).

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##              main     #4663       +/-   ##
=============================================
+ Coverage   91.225%   91.231%   +0.005%     
=============================================
  Files          624       624               
  Lines        72083     72141       +58     
  Branches     26221     26237       +16     
=============================================
+ Hits         65758     65815       +57     
- Misses        6229      6230        +1     
  Partials        96        96               
Files with missing lines Coverage Δ
Sources/Sentry/SentryClient.m 95.184% <100.000%> (+0.034%) ⬆️
Sources/Sentry/SentryMeta.m 75.000% <100.000%> (+25.000%) ⬆️
.../SessionReplay/RRWeb/SentryRRWebOptionsEvent.swift 100.000% <100.000%> (ø)
...tegrations/SessionReplay/SentryReplayOptions.swift 95.000% <100.000%> (+0.084%) ⬆️
...tegrations/SessionReplay/SentrySessionReplay.swift 97.619% <100.000%> (+0.009%) ⬆️
...tions/SessionReplay/SentrySessionReplayTests.swift 99.111% <100.000%> (+0.041%) ⬆️
Tests/SentryTests/SentryClientTests.swift 98.054% <100.000%> (+0.019%) ⬆️

... and 7 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9c173e4...6ea51bc. Read the comment docs.

Copy link
Contributor

@philprime philprime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -248,6 +248,7 @@ class SentrySessionReplay: NSObject {
private func captureSegment(segment: Int, video: SentryVideoInfo, replayId: SentryId, replayType: SentryReplayType) {
let replayEvent = SentryReplayEvent(eventId: replayId, replayStartTimestamp: video.start, replayType: replayType, segmentId: segment)

replayEvent.sdk = self.replayOptions.sdkInfo
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should also set the same sdkInfo to the envelope header, which this replay event is a part of. And from what I see we don't set this sdkInfo to the default global one when initialized, which means we'll nullify the sdk context if we're not running on a hybrid SDK, right? @philprime @philipphofmann could you guys do that or should I take care while Dhiogo is out?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if I know how to do that yet, would be great if you or @philipphofmann can do it, with me reviewing the changes so I know afterwards.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused by this PR; see #4663 (review).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brustolin, I think we should still align with the Java approach. Using sdkInfo as a dict is acceptable, but I think we should get rid of storing the native SDK info in the Meta.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Java is wrong in this case.
The nativeSDKName and nativeSDKVersion in the replay tags should never be overwritten.
@romtsn Am I missing something here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's up to us I guess.. most important is the version and that one will be correct (i.e. the hybrid SDKs keep the native version in there), and the name doesn't really matter, since we all know it's gonna be android or ios sdk depending on what replay you're watching

Copy link
Member

@philipphofmann philipphofmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is PR highly confusing to me. The SentryMeta sdkName and SDKVersion can be changed, and only SR events would use the nativeVersionString and nativeSDKName. All other Sentry data uses the SentryMeta sdkName and sdkVersion. @romtsn, do you use a similar approach on Android? If yes, what are the reasons for that?

Sources/Sentry/SentryMeta.m Outdated Show resolved Hide resolved
@kahest kahest mentioned this pull request Jan 8, 2025
@brustolin
Copy link
Contributor Author

This is PR highly confusing to me

Replay needs the information of the native SDK on top of the hybrid SDK info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants