Skip to content

FR: PerfMon trace() KTX with trace name as argument #2029

Closed
@thatfiredev

Description

@thatfiredev

What feature would you like to see?

I just saw the release of Firebase PerfMon KTX and would like to propose adding one more function:

inline fun <E> trace(name : String, block: (Trace) -> E): E {
    val trace = startTrace(name)
    return try {
        block(trace)
    } finally {
        trace.stop()
    }
}

I would also like to point out that I found this code on @JvmName 's article Tracking Performance in Kotlin Suspending Functions with Firebase Performance Monitoring. All credits are theirs.

How would you use it?

This allows us to start a trace with a name using:

trace("some-trace") {
    // the operations we woud like to trace
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions