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

Đang mở
#1,954 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
30/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
android, firebase, kotlin

Hướng nghiên cứu

Issue đề cập đến các tiện ích theo dõi hiệu năng của Now in Android nhưng không nêu tên tệp hoặc bài kiểm thử nào. Hãy bắt đầu bằng cách xác định các tiện ích đó và xem xét cách các trace của Firebase Performance hiện được báo cáo; công việc được xem là hoàn tất khi một thiết kế có thể cấu hình rõ ràng có thể chuyển tiếp trace đến nhiều đích và có độ bao phủ cho hành vi báo cáo được hỗ trợ.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement
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
Ngôn ngữ chính
Kotlin
Star
22.1k
Fork
4.7k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của android/nowinandroid

Tất cả issue của android/nowinandroid

Issue tương tự

Thêm issue về Kotlin

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.