Skip to content

Customizable screen name in Firebase Performance metrics #3737

Open
@angelolloqui

Description

@angelolloqui

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:

   // AppStateMonitor
    public static String getScreenTraceName(Activity activity) {
        return "_st_" + activity.getClass().getSimpleName();
    }

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:

AppStateMonitor.getInstance().setScreenNameProvider { activity -> activity.myFragmentLogic.name }

This provider by default could be instantiated with the current logic to be backward compatible:

val screenNameProvider = { activity -> activity.getClass().getSimpleName() }

An alternative approach to the lambda could be providing some interface that the activity can implement to provide the name

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions