2026-06-23
Tracing: v2.0.0-alpha09
June 23, 2026
androidx.tracing:tracing-*:2.0.0-alpha09 is released. Version 2.0.0-alpha09 contains these commits.
API Changes
- Minor API change in
Tracerto diambiguate betweeninstant(...)andwriteInstant(...). (I0935a) - Add support for propagation tokens in instant events. (I99f81)
- Allow full usage of Perfetto flows in the experimental manual context propagation API. (I20cb6)
- Defer creation of the
BufferedSinkandProtoWriterinTraceSink. (Ibd098) - Make
Tracerdiscovery simple and pluggable for both Java and Android Libraries. (I99111) - Make it easy for library developers to discover an instance of
TraceDriverthat can be used for in-process tracing. (Ia503e)
Version 2.0.0-alpha08
May 19, 2026
androidx.tracing:tracing-*:2.0.0-alpha08 is released. Version 2.0.0-alpha08 contains these commits.
API Changes
- Add the ability to discover and override instances of
TraceDriverto be used process wide. (I3f715) - Rename
Tracer.recordExceptiontoTracer.recordExceptionAndThrow. (I4411f, b/503092450)
Version 2.0.0-alpha07
May 06, 2026
androidx.tracing:tracing-*:2.0.0-alpha07 is released. Version 2.0.0-alpha07 contains these commits.
API Changes
- Add a API to obtain a stub tracer that can be used when tracing is disabled. (I84c98)
- Make tracing lifecycle consistent with system tracing. (Ib391b)
- Counter APIs are now entirely allocation free. (I5e73a)
Bug Fixes
- Fixed a keep rule for the Perfetto SDK (
tracing-perfetto) which ensures that the Perfetto SDK can be enabled. (I1d227) - Add the ability to trace
flush()events. (I38014, b/495852704)
Version 2.0.0-alpha06
April 22, 2026
androidx.tracing:tracing-*:2.0.0-alpha06 is released. Version 2.0.0-alpha06 contains these commits.
API Changes
- Unrestrict
File.createPerfettoFile()so others can safely create sinks. When ablock()throws an exception intrace/traceCoroutinecreate aninstantevent for the exception with the metadata representing the corresponding stack trace elements. (I682e5, b/501536851, b/437166283) - Add a
setCounter(...)overload that takes a JavaLongtype. (Ic0469, b/356082604) - Tracing 2.0 now uses
Longfor platform specificThreadidentifiers. (I67277)
Bug Fixes
- Improve documentation for
AttributeEntry.reset(). (I5d3a1, b/496079439)
Version 2.0.0-alpha05
April 08, 2026
androidx.tracing:tracing-*:2.0.0-alpha05 is released. Version 2.0.0-alpha05 contains these commits.
API Changes
TraceSinkfactory functions now returnTraceSinkand notAbstractTraceSink. Files now have a unique suffix. We make sure that we can atomically create a new file that will be used to store trace packets. (I4c4aa, b/496298726)- Simplify and make coroutine context propagation faster. (Ia62db)
- Introduce the optional
attributes()when constructing aTraceDriverthat provides a way to add metadata pertaining to a trace. (Ia147e)
Bug Fixes
- Process threads and counter tracks are now synchronized. This fixes exceptions of the form:
java.lang.NullPointerException: Cannot invoke "androidx.tracing.ThreadTrack.flush$tracing()" because "threadTrack" is null - Avoid emitting sink events when tracing is disabled.
Version 2.0.0-alpha04
March 25, 2026
androidx.tracing:tracing-*:2.0.0-alpha04 is released. Version 2.0.0-alpha04 contains these commits.
API Changes
- Make
AbstractTraceDriverreally abstract, and move thePerfettoimplementation into thetracing-wiremodule. (Ie2f59) - Give more descriptive names to base implementations to avoid using the wrong one. For developers previously extending
androidx.tracing.Trace{Sink|Driver}they will now need to switch to usingAbstractTrace{Sink|Driver}. (I9b46d)
Version 2.0.0-alpha03
March 11, 2026
androidx.tracing:tracing-*:2.0.0-alpha03 is released. Version 2.0.0-alpha03 contains these commits.
API Changes
- Added an experimental
InMemoryRingBufferTraceSinkimplementation which allows setting a capacity restriction and avoids writing to disk unless explicitly asking for it. (I1dc44, b/484409653, I65a37, b/484409653) - Fix race condition when emitting trace events for coroutine suspends and resumes. (Ie145e)
Bug Fixes
androidx.tracingno longer attempts to draw connections from parent to child coroutines in traces by default. This has been confusing, since the underlying trace format doesn't support1:NandN:1connections, resulting in a nest of arrows due to ambiguity about which coroutine slice connects to what. You can still manually opt-in to propagation with thetokenForManualPropagation()API when it's important for your use case. (Ib2cf9)
Version 2.0.0-alpha02
February 25, 2026
androidx.tracing:tracing-*:2.0.0-alpha02 is released. Version 2.0.0-alpha02 contains these commits.
New Features
- Improved performance for the Perfetto Trace Sink implementation by using the
suspendCoroutineUninterceptedOrReturnintrinsic (2ea97b).
Version 2.0.0-alpha01
January 28, 2026
androidx.tracing:tracing-*:2.0.0-alpha01 is released. Version 2.0.0-alpha01 contains these commits.
New Features
AndroidX Tracing 2.0 introduces a significant new API surface for low-overhead, in-process tracing, as a complement to the existing android.os.Tracing-based APIs in Tracing 1.0. The new APIs are available both on Android and host JVM, which enables host tools to emit low overhead traces for performance analysis, using the same standard Perfetto trace format.
Emitted traces are supported both by Android Studio and Perfetto, and can be recorded with an expanded feature set including tagging slices with metadata (such as function arguments!), and coroutine context trace propagation.
This initial alpha is only meant for in-process tracing workflows, and does not yet integrate with Android OS tracing or Studio Profiler System Tracing - these will be coming in a future alpha.
/** * A [TraceSink] defines how traces are serialized. * * [androidx.tracing.wire.TraceSink] uses the `Perfetto` trace packet format. */ fun createSink(): TraceSink { val outputDirectory = File(/* pathname = */ "/tmp/perfetto") // We are using the factory function defined in androidx.tracing.wire return TraceSink( sequenceId = 1, directory = outputDirectory ) }/**
* Creates a new instance of [androidx.tracing.TraceDriver].
*/
fun createTraceDriver(): TraceDriver {
// We are using a factory function from androidx.tracing.wire here.
//isEnabledcontrols whether tracing is enabled for the application.
val driver = TraceDriver(sink = createSink(), isEnabled = true)
return driver
}
fun main() {
val driver = createTraceDriver()
driver.use {
driver.tracer.trace(category = CATEGORY_MAIN, name = "basic") {
Thread.sleep(100L)
}
}
}
API Changes
- Make
Tracera property of theTraceDriver. (Iabd9b) - Add support for manual context propagation. (I899ff)
- Add the ability to add call stack information in a trace section. (If6a1b)
- Introduce the new
androidx.tracingAPIs. (I5102b) - Allow instant events to contain metadata, and add counters to instants & counters. (Ia2ed3)
- Reduce the surface area of the API annotated with
@DelicateTracingApi. Nothing in the top level API should require the use of@DelicateTracingApi. (I565e0) - Simplify context propagation by unifying
PropagationTokens. (Iab839) - Stabilize
BlackHoleAPIs inandroidx.benchmark. (I2b67e, b/451749438) - Add the ability to annotate the trace section as a root span. (Ic8365)
- Allow the developer to explicit about propagation tokens. (I06bb1)
- Renamed
MetadataHandleCloseabletoEventMetadataCloseable, andMetadataHandletoEventMetadata. Also added an optionalCoroutinePropagationTokenargument toTracer.traceCoroutineto allow the developer to explicitly specify the propagation token to use. (I219f7, b/454147392) - Introduced a new
Tracerentry point which gives developers a lot more control on how to trace. (I24a7b) - Add the ability to control how context propagation happens in a
SliceTrack. (Ieb8fc) fillCountinPooledTracePacketArrayis now correctly marked volatile. (I75d2c)- Mark
MetadataEntry@DelicateTracingApi. (I8c723) - Add the ability for a
TraceSinkto be able to handle lost trace events (when the pool is exhausted). (I3b374) - Add the ability to conditionally emit trace events based on a predicate. (I621b4)
- Add the ability to add categories to a trace event. (I449c2)
- Mark
TraceEvent,PooledTracePacketArrayasDelicateTracingApi. (Iaac6d) - Make
ProcessTrack.id,ThreadTrack.id,ThreadTrack.name,CounterTrack.nameandCounterTrack.parentpublic. (I81210) - Renamed the
SliceTrack.traceFlow()API totraceCoroutine(). (I79ad0) - Add the ability to add contextual information to slices via debug annotations in a Perfetto trace. (Ic2b56)
- Make it possible to construct an instance of
WireTraceSinkwith aFile/OutputStream. (Iecea0) - Removing obsolete
@RequiresApi(21)annotations (Ic4792)