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

Question about sentry cocoa profiler #4550

Open
barisyild opened this issue Nov 18, 2024 · 20 comments
Open

Question about sentry cocoa profiler #4550

barisyild opened this issue Nov 18, 2024 · 20 comments

Comments

@barisyild
Copy link

Problem Statement

I want to measure the performance in the enter frame event, so I need to create transactions, but the server cannot handle 60 transactions per second, even if it receives 1 frame per second, it cannot handle it.

Is there a way to send only the transaction with slow frames?

Solution Brainstorm

No response

Are you willing to submit a PR?

No response

@armcknight
Copy link
Member

Hi @barisyild , IIUC, you want to capture a profile of what is going on at the time that a slow frame occurs, and discard any other transactions? My best guess to filter out transactions using SentryOptions.beforeSend, but I'm not sure you can tell from the SentryEvent that hands you whether there is a slow frame in there or not. @philipphofmann could any of those properties be used to dig for that specific info? I don't think we write it into SentryEvent.context, .extra, or as a breadcrumb.

@philipphofmann
Copy link
Member

I want to measure the performance in the enter frame event, so I need to create transactions,

@barisyild, our transactions, and spans already contain frame statistics. We have slow and frozen frames and we also have frame delay data, for which we still need to add user-facing docs. Do these not provide enough information for you? If not, what are you missing?

@barisyild
Copy link
Author

barisyild commented Nov 19, 2024

I want to measure the performance in the enter frame event, so I need to create transactions,

@barisyild, our transactions, and spans already contain frame statistics. We have slow and frozen frames and we also have frame delay data, for which we still need to add user-facing docs. Do these not provide enough information for you? If not, what are you missing?

It says in the device logs that a slow frame was detected, but I'm not sure if it was sent to sentry.

I'm not running any transactions, could it be because of that?

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Nov 19, 2024
@philipphofmann
Copy link
Member

@barisyild, the SDK only attaches frame information to transactions, yes. So you need a transaction running.

@barisyild
Copy link
Author

@barisyild, the SDK only attaches frame information to transactions, yes. So you need a transaction running.

If I start and close transaction each frame, won't it send a transaction for each frame?

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Nov 20, 2024
@philipphofmann
Copy link
Member

I wouldn't recommend creating a transaction for every frame. Transactions should represent a user action and should contain more information than just one span. It's also very expensive to create one transaction per frame. If you really want to get exact frame data you could create a transaction and create spans for each frame, but we currently don't expose that information from the SDK.

@barisyild
Copy link
Author

I wouldn't recommend creating a transaction for every frame. Transactions should represent a user action and should contain more information than just one span. It's also very expensive to create one transaction per frame. If you really want to get exact frame data you could create a transaction and create spans for each frame, but we currently don't expose that information from the SDK.

This way it is not possible to capture functions that are triggered every frame.

Since this is a game, there can be a lot of performance issues even without user interaction.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Nov 20, 2024
@philipphofmann
Copy link
Member

philipphofmann commented Nov 20, 2024

I want to measure the performance in the enter frame event, so I need to create transactions,

It's not 100% clear to me what you want to achieve.

Let's take a step back. Please describe your use case, @barisyild. From what you wrote, I assume you want to know exactly when slow frames occur at any time when the game runs.

@barisyild
Copy link
Author

I want to measure the performance in the enter frame event, so I need to create transactions,

It's not 100% clear to me what you want to achieve.

Let's take a step back. Please describe your use case, @barisyild. From what you wrote, I assume you want to know exactly when slow frames occur at any time when the game runs.

Yes, enterFrame events can potentially slow down at any time and do not require interaction.

@philipphofmann
Copy link
Member

@barisyild, what do you mean by this? Do you mean continuous profiling or manual transactions? And what are interaction based slow downs?

@barisyild
Copy link
Author

@barisyild, what do you mean by this? Do you mean continuous profiling or manual transactions? And what are interaction based slow downs?

Yes, I am talking about continuous profiling.

image

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Nov 21, 2024
@philipphofmann
Copy link
Member

Those aren't continuous profiles but UI interaction transactions.. You can learn how to setup profiling here: https://docs.sentry.io/platforms/apple/guides/ios/profiling/.

The profile will show UI frames here:

Image

@barisyild
Copy link
Author

Those aren't continuous profiles but UI interaction transactions.. You can learn how to setup profiling here: https://docs.sentry.io/platforms/apple/guides/ios/profiling/.

The profile will show UI frames here:

Image

I don't quite understand how to enable continuous profiling, is it enough to enable enableAppLaunchProfiling or call startProfiler?

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Nov 23, 2024
@philipphofmann
Copy link
Member

@barisyild, you don't have to do anything to enable continuous profiling. Just call SentrySDK.startProfiler() and SentrySDK.stopProfile(): see https://docs.sentry.io/platforms/apple/guides/ios/profiling/#continuous-profiling.

@barisyild
Copy link
Author

@barisyild, you don't have to do anything to enable continuous profiling. Just call SentrySDK.startProfiler() and SentrySDK.stopProfile(): see https://docs.sentry.io/platforms/apple/guides/ios/profiling/#continuous-profiling.

I think I still need to start a transaction, but I still don't understand, doesn't this mean that all transactions will be sent?

Can I do something like start a transaction and never close it?

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Nov 26, 2024
@philipphofmann
Copy link
Member

No, with continuous profiling, you don't need to start transactions. Continuous profiles are detached from transactions.

@barisyild
Copy link
Author

No, with continuous profiling, you don't need to start transactions. Continuous profiles are detached from transactions.

I run the startProfiler function immediately after calling startWithConfigureOptions but it doesn't work.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Nov 27, 2024
@philipphofmann
Copy link
Member

@barisyild, can you set options.debug = true and share the log output with us, please? That should help us to investigate the problem.

@kahest kahest moved this from Needs Discussion to Needs More Information in Mobile & Cross Platform SDK Dec 4, 2024
@getsantry getsantry bot moved this to Waiting for: Community in GitHub Issues with 👀 3 Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Waiting for: Community
Status: Needs More Information
Development

No branches or pull requests

4 participants