-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the problem
Description
It would be extremely helpful if the Now in Android sample app (and its performance tracking utilities) could support sending performance trace data not only to Firebase Performance Monitoring but also to other destinations such as:
- Logcat (for quick local debugging)
- Firebase Performance Dashboard (default destination)
- Hotdog
- Sentry
- (Any other custom tools)
Motivation
Developers often need performance data in multiple contexts simultaneously. For instance:
- Logcat: Useful for immediate debugging during development, CI builds, or local testing.
- Firebase: Great for aggregate analytics and real user monitoring.
- Hotdog / Sentry / etc.: Useful for centralized error/performance dashboards, custom dashboards, or alternative monitoring solutions.
Serving multiple destinations would make debugging and monitoring smoother and more flexible.
Proposed approach
- Create an abstraction layer over performance trace reporting, e.g., a
PerformanceReporter
interface. - Implement multiple reporters (e.g.,
LogcatReporter
,FirebaseReporter
,HotdogReporter
,SentryReporter
). - Make these reporters configurable (via dependency injection or a simple registry), so users can opt in to any combination they need.
Example usage
val performanceReporters = listOf(LogcatReporter(), FirebaseReporter(), SentryReporter())
PerformanceReporting.initialize(performanceReporters)
trace("user_login") {
// Business logic here
}
### Describe the solution
interface PerformanceReporter {
fun onTraceStart(name: String)
fun onTraceEnd(name: String, durationMs: Long)
}
Each destination will implement this interface, for example:
kotlin
Copy code
class FirebaseReporter : PerformanceReporter { /* ... */ }
class LogcatReporter : PerformanceReporter { /* ... */ }
class SentryReporter : PerformanceReporter { /* ... */ }
class HotdogReporter : PerformanceReporter { /* ... */ }
2. Create a CompositePerformanceReporter
This class will manage a list of reporters and forward trace events to all of them:
kotlin
Copy code
class CompositePerformanceReporter(
private val reporters: List<PerformanceReporter>
) : PerformanceReporter {
override fun onTraceStart(name: String) {
reporters.forEach { it.onTraceStart(name) }
}
override fun onTraceEnd(name: String, durationMs: Long) {
reporters.forEach { it.onTraceEnd(name, durationMs) }
}
}
### Additional context
_No response_
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request