Recording Traces
Embrace's Tracing API allows you to measure the performance of an operation with a defined start and end (spans). A simple example is shown below:
val span = Embrace.startSpan("load-activity") ?: return
span.addAttribute("image-name", image.name)
val image = fetchImage()
// record important event at point in time
span.addEvent("network-request-finished")
processImage(image)
// end the span
span.end()
In this example a trace measures how long it takes to fetch and process an image. The captured span will have attributes and events added to it, along with the start/end time.
The tracing API is very powerful. For further examples and detail, please see the feature reference docs.