android / android/nowinandroid
[FR] Support sending Firebase Performance traces to multiple destinations (e.g. log, Firebase, Hotdog, Sentry, etc.)
- Dominant language
- Kotlin
- Stars
- 21.8k
- Forks
- 4.6k
- Avg merge
- 19h 20m
- Merged PRs (30d)
- 2
Description
### Is there an existing issue for this?
- [x] 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
```kotlin
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 {
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
Contributor guide
Research direction
The issue mentions the Now in Android performance tracking utilities but names no files or tests. Start by locating those utilities and reviewing how Firebase Performance traces are currently reported; done means a clearly configurable design can forward traces to multiple destinations, with coverage for the supported reporting behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, firebase, kotlin
- Domain
- mobile-dev, observability-sre
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100