Skip to content

[FR] Support sending Firebase Performance traces to multiple destinations (e.g. log, Firebase, Hotdog, Sentry, etc.) #1954

@ame6hv37-lab

Description

@ame6hv37-lab

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

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions