-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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: release-profiler on web #44432
feat: release-profiler on web #44432
Conversation
a60b8f6
to
726184b
Compare
333d1bc
to
742b9a1
Compare
@jayeshmangwani Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
@kirillzyusko Unit tests are failing in the PR. |
ec590a1
to
c63498e
Compare
@jayeshmangwani thank you for pointing it out! I fixed that! |
@kirillzyusko IMO, the share option here should be for the native platforms (Android and iOS) only. We are doing the same with the Share logs option too. |
@jayeshmangwani do you want to rename "Share" to "Download"? Or do you want to remove that button at all? If we remove and will start automatic download, then I'm not sure such concurrent downloads will be handled correctly 🤔 |
I was thinking of removing it, as the |
@kirillzyusko We will proceed with the existing functionality added in the PR. The Profiling Share button for the web/desktop will download the file. We also need the same functionality for client-side logging. If possible, can we please add a share button to client logs in this PR that downloads the file? |
d8b3730
to
c2d7c31
Compare
@jayeshmangwani I added it here: c2d7c31 However I think it's slightly incorrect... This button on web: will trigger a download of additional {
"appVersion": "9.0.4-7",
"environment": "development",
"platform": "web",
"totalMemory": "7.45 GiB",
"usedMemory": "1.36 GiB"
} This file is an additional file for profiler stack trace, but it's not mandatory - and thus we give user an ability to download it on demand. But the trace file will be downloaded automatically. So... Should I revert changes that I made? 😅 |
😅 In my opinion, when we press the Profile Trace Share button, the |
@jayeshmangwani the small problem here is that But the problem is that in browser we don't have a direct access to FS, so we have to download file (and we can do that only once - at least that' how we designed the API): https://github.com/margelo/react-native-release-profiler/blob/80ff24f4ad7354c0b04047ed59e915735b986ea1/src/index.web.tsx#L84-L90 I'll be glad to unify the approach across platforms, but we need to keep in mind, that browser doesn't have FS nad Share API, so we are polyfilling them here 🤷♂️ |
That makes sense, it would be nice to have consistency across platforms but I think we can live without it if it means getting this out |
@muttmuure @jayeshmangwani so, should I revert changes that I made for "client-side logging" functionality? Or we can review the PR with these changes? |
@kirillzyusko For the web: I think we should hide the share option for Profile Trace, as the share button does not download the profiling file but instead downloads the App_info file. For 'client-side logging,' we should keep the share button, as it downloads the file correctly. |
c2d7c31
to
2430ed3
Compare
@jayeshmangwani got you - re-worked the code so that it meets your expectations 😊 |
@kirillzyusko Thanks for making the changes 🙏 Do we have to do any extra steps to load a file in speedscope.app? I captured a file on the web and tried to open it, but I'm getting a warning: File: |
const [sharePath, setSharePath] = useState(''); | ||
const [totalMemory, setTotalMemory] = useState(0); | ||
const [usedMemory, setUsedMemory] = useState(0); | ||
const {translate} = useLocalize(); | ||
|
||
// eslint-disable-next-line @lwc/lwc/no-async-await | ||
const stop = useCallback(async () => { | ||
const path = await stopProfiling(getPlatform() === CONST.PLATFORM.IOS); | ||
setPathIOS(path); | ||
const path = await stopProfiling(getPlatform() === CONST.PLATFORM.IOS || getPlatform() === CONST.PLATFORM.WEB, newFileName); |
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.
Do we need the condition getPlatform() === CONST.PLATFORM.WEB here?
For stopProfiling true/false both values are downloading the file in the Downloads folder for me.
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.
@jayeshmangwani without that condition it'll always throw a warning:
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.
Okay, gotcha. I was suggesting that to avoid the platform-specific code in the file, though we can pass the saveToDownloads value from the platform-specific files
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.
though we can pass the saveToDownloads value from the platform-specific files
Should I re-work this part as you are suggesting? 👀
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.
I think it's fine here. We were already using getPlatform() === CONST.PLATFORM.IOS. Sorry for the confusion. Please leave it as it is for now.
@jayeshmangwani Yes, you need to run |
b75c3e5
to
6f7f259
Compare
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.
lgtm
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/stitesExpensify in version: 9.0.11-0 🚀
|
[CP Staging] Revert "Merge pull request #44432 from margelo/feat/release-profiler-on-web"
🚀 Cherry-picked to staging by https://github.com/francoisl in version: 9.0.11-2 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
try { | ||
const data = await fs.promises.readFile(resolvedPath); | ||
callback({ | ||
mimeType: 'text/html', |
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.
Note: I believe this may have caused issue #46048 by overriding the Content-Type
response header for non-html responses.
…release-profiler-on-web"" This reverts commit d50f007.
🚀 Deployed to production by https://github.com/francoisl in version: 9.0.11-5 🚀
|
🚀 Deployed to staging by https://github.com/stitesExpensify in version: 9.0.12-0 🚀
|
🚀 Deployed to staging by https://github.com/stitesExpensify in version: 9.0.13-0 🚀
|
…release-profiler-on-web"" This reverts commit d50f007.
…release-profiler-on-web"" This reverts commit d50f007.
🚀 Deployed to staging by https://github.com/stitesExpensify in version: 9.0.17-0 🚀
|
🚀 Deployed to production by https://github.com/marcaaron in version: 9.0.17-2 🚀
|
2 similar comments
🚀 Deployed to production by https://github.com/marcaaron in version: 9.0.17-2 🚀
|
🚀 Deployed to production by https://github.com/marcaaron in version: 9.0.17-2 🚀
|
Details
Added an ability to profile web release apps.
Warning
You'll need to add
'Document-Policy': 'js-profiling'
to responses to make profiler working.Fixed Issues
$ #43363
PROPOSAL: N/A
Tests
Offline tests
N/A
QA Steps
N/A
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop