Skip to content

2026-06-23

Choose a tag to compare

@github-actions github-actions released this 23 Jun 22:46
· 12 commits to main since this release

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 Tracer to diambiguate between instant(...) and writeInstant(...). (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 BufferedSink and ProtoWriter in TraceSink. (Ibd098)
  • Make Tracer discovery simple and pluggable for both Java and Android Libraries. (I99111)
  • Make it easy for library developers to discover an instance of TraceDriver that 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 TraceDriver to be used process wide. (I3f715)
  • Rename Tracer.recordException to Tracer.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 a block() throws an exception in trace / traceCoroutine create an instant event for the exception with the metadata representing the corresponding stack trace elements. (I682e5, b/501536851, b/437166283)
  • Add a setCounter(...) overload that takes a Java Long type. (Ic0469, b/356082604)
  • Tracing 2.0 now uses Long for platform specific Thread identifiers. (I67277)

Bug Fixes

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

  • TraceSink factory functions now return TraceSink and not AbstractTraceSink. 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 a TraceDriver that 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 AbstractTraceDriver really abstract, and move the Perfetto implementation into the tracing-wire module. (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 using AbstractTrace{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 InMemoryRingBufferTraceSink implementation 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.tracing no 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 support 1:N and N:1 connections, 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 the tokenForManualPropagation() 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 suspendCoroutineUninterceptedOrReturn intrinsic (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.
// isEnabled controls 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 Tracer a property of the TraceDriver. (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.tracing APIs. (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 BlackHole APIs in androidx.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 MetadataHandleCloseable to EventMetadataCloseable, and MetadataHandle to EventMetadata. Also added an optional CoroutinePropagationToken argument to Tracer.traceCoroutine to allow the developer to explicitly specify the propagation token to use. (I219f7, b/454147392)
  • Introduced a new Tracer entry 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)
  • fillCount in PooledTracePacketArray is now correctly marked volatile. (I75d2c)
  • Mark MetadataEntry @DelicateTracingApi. (I8c723)
  • Add the ability for a TraceSink to 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, PooledTracePacketArray as DelicateTracingApi. (Iaac6d)
  • Make ProcessTrack.id, ThreadTrack.id, ThreadTrack.name, CounterTrack.name and CounterTrack.parent public. (I81210)
  • Renamed the SliceTrack.traceFlow() API to traceCoroutine(). (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 WireTraceSink with a File / OutputStream. (Iecea0)
  • Removing obsolete @RequiresApi(21) annotations (Ic4792)