question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Customizable screen name in Firebase Performance metrics

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
angelolloquicommented, Jun 1, 2022

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!

1reaction
shamilovtimcommented, May 27, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add custom monitoring for specific app code - Firebase - Google
You can create your own traces to monitor performance data associated with specific code in your app. With a custom code trace, you...
Read more >
[GA4] Custom dimensions and metrics - Firebase Help
Create custom metrics​​ On the left, click Configure > Custom definitions. Click Create custom metrics. Enter a name for the custom metric. You...
Read more >
Boost your Firebase Performance reports with custom traces
Performance Monitoring collects traces to help you monitor the performance of your app. A trace is a report of performance data captured between...
Read more >
Firebase Performance Monitoring | Track Metrics with Firebase
In this episode, we cover how to add Firebase Performance Monitoring to your web app and what exactly it does. You can get...
Read more >
Performance Monitoring | FlutterFire
The name provided will appear within the Firebase Console, allowing you to provide unique names for different trace metrics. When it makes sense...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found