Open angelolloqui opened 2 years ago
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
BTW, maybe a better approach to also support single activity apps would be to provide APIs in AppStateMonitor
to start a metric and end a metric by screen, so instead of having a map of Activities->traces, you could have a map of Strings->traces. This way, a developer could do something like:
// On fragment resume
AppStateMonitor.getInstance().startMonitoringScreen("MyFragmentName")
// On fragment stop
AppStateMonitor.getInstance().stopMonitoringScreen("MyFragmentName")
Hey @angelolloqui , we are releasing a new feature (automatically instrument Fragment screen traces) soon that would solve the use-case of the "classic single Activity project" where each fragment is a "screen" or "navigation destination". But it may or may not satisfy your use-case, so I want to ask some clarification questions for your case.
Is my understanding correct that each instance of your Activity (say ExampleActivity) dynamically populate its content?
Then, is each instance of your Activity using a unique Fragment class? For example, ExampleActivity (instance 1) only contains AlphaFragment ExampleActivity (instance 2) only contains BetaFragment ExampleActivity (instance 3) only contains GammaFragment ...
Is the Fragment inside your Activity most of the content? Meaning, your Activity doesn't do anything before Fragment is loaded and after the Fragment is removed, so there's nothing worth capturing for that Activity if you already have a Fragment trace captured?
If yes to all of these questions, then our next release should cover your use case.
Hi @leotianlizhan ! thanks for the quick answer!
Yes, that is indeed my use case, so I am willing to update to your next version
Regards!
@angelolloqui That feature has just been released on version 20.1.0 (BoM 30.1.0) of Firebase Performance! Give it a try and let us know if it fixes your issue :)
I think we still need the custom screen name for react native and would need to be able to disable the Fragment workflow. See #3756
Thanks @thatfiredev ! I am giving it a try and seems to work like a charm. I will put in on pro next week. I will let you know if any issue arises. Regards!
What feature would you like to see?
When using Firebase Performance in my app, I see we have all screens tracked under the same screen name, making it unusuable since it aggregates all screens together. This is happening since I have a parent activity that dynamically starts new fragments with the appropriate content. Note that this is not identical to a classic single activity project, since in my case we do open multiple activities, but the activity class name is always the same. Checking the code I think the info from the screen name comes from here:
Could you provide an API to instead of always getting the name from the class, to allow for custom namings? this way I would just add my own logic to show a custom screen name, and so I can distinguish the different screens with their appropriate frame metrics.
How would you use it?
I would like to be able to setup something during my app startup like:
This provider by default could be instantiated with the current logic to be backward compatible:
An alternative approach to the lambda could be providing some interface that the activity can implement to provide the name