Formerly, `Span.getAccumulatedMillis()` worked, but could returns
imprecise measurements, particularly local spans. This changes the
internals of Span to keep track of a start tick. Using this, it can
return a more precise `Span.getAccumulatedMicros()`.
To ensure this precision isn't lost in serialization, this adds a
json field `durationMicros`, which is only set when the span is stopped.
This is set instead of start tick because `System.nanoTime()` is JVM
specific and so cannot be used across the network. `durationMicros` uses
null instead of zero comparisons because nano time can be negative.
Fixes #312
Fixed integration tests to use ZipkinRule
Introduce assertj assertions (#315)
* Introduce assertJ assertions in some tests
* Fix code formatting to be inline with Spring rules
Running Zipkin Server
There are 3 parts to Zipkin: the instrumented client apps, the backend database and the Zipkin server. The database for this implementation is MySQL.
There is a running instance on PWS: http://zipkin-web.cfapps.io. It is backed by a
zipkin-serverwith a MySQL backend and RabbitMQ (Spring Cloud Stream) for span transport.
Instrumenting Apps
Depend on Spring Cloud Sleuth Stream. Bind to a rabbit service (or redis if you prefer - normal Spring Cloud Stream process).
Zipkin Server
Depend on spring-cloud-sleuth-zipkin-stream and enable the server:
@SpringBootApplication
@EnableZipkinStreamServer
public class ZipkinStreamServerApplication {
public static void main(String[] args) throws Exception {
SpringApplication.run(ZipkinStreamServerApplication.class, args);
}
}
Zipkin has a web UI, which is enabled by default when you depend on io.zipkin.java:zipkin-autoconfigure-ui.
Bind to MySQL and the same Stream service that you did in the apps (rabbit, redis, kafka). Set spring.datasource.initialize=true the first time you start to initialize the database.
Uses the zipkin-server library from the OSS as well as spring-cloud-sleuth-stream.
NOTE: running in the "test" profile you don't need MySQL (the span store is in memory). You could even run in PWS without MySQL.