Skip to content

Brave 4.11

Compare
Choose a tag to compare
@codefromthecrypt codefromthecrypt released this 05 Dec 23:14
· 939 commits to master since this release

Brave 4.11 is about time. It takes advantage of Java 9's new clock (when present) and is generally smarter about time.

More precise time when using Java 9

Brave remains bytecode compatible with Java 6. This is important as tracing is equally valuable in applications written a decade ago, but also older versions of android as well. This said, we have some platform detection which allows us to leverage libraries only present in newer JVMs. OpenJDK 9 includes support for more precise (usually at least microsecond) resolution timestamps. We now use these by default when available.

Smarter timestamp caching

Before, we simulated microsecond granularity clock by synchronizing System.currentTimeMillis() with a reading of System.nanoTime(). This was great in so far as operations could be at a stable offset from eachother, allowing you to tell which parallel command started before another at microsecond granularity.

The tradeoff of this design was lack of coherence with system time. If you ran NTP, the tracer wouldn't notice updates. This created an ironic situation, introducing clock skew inside a single host!

We've revised this design, reducing the "tick fixing" to per-trace, as opposed to per-tracer. This gives the same advantage as before, where all timestamps in a trace for a host are both sequential and coherent. However, this reduced scope allows visibility of clock corrections between traces.

Many thanks to @jorgheymans for testing various revisions leading to this design