Files
spring-cloud-sleuth/spring-cloud-sleuth-zipkin-stream
Adrian Cole e3669417dd Fixes missing zipkin service name and polishes span converters.
Missing service name:

Zipkin service names were logged as null, which is invalid and led to
them showing up as "unknown" in the zipkin ui. This was due to a wiring
bug, and a special-case, which this change fixes.

The special-case was when a sleuth span had no annotations. Since zipkin
service names are attached to annotations, they are only queryable when
annotations exist. When there are no annotations, we add the "lc"
binary annotation, which makes that span attached to the correct service
in zipkin.

Polishing:

Zipkin timestamps were not always set as microseconds. This fixes that.

The de-facto label in zipkin for unknown service is "unknown". This
fixes the code, which formerly fell back to "application".

This also removes complexity in assigning timestamp and duration as we
no longer need to make pseudo-annotations "acquire" and "release".

Finally, this adds tests about above consistently to both scs-zipkin and
scs-zipkin-stream.
2015-12-29 17:10:16 +08:00
..

Running Zipkin a Query Server

There are 4 parts to Zipkin: the instrumented client apps, the web UI, the backend database and the query 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-java-server with 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).

Query 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);
	}

}

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.

Web UI in Cloud Foundry

Get the jar from the OSS and push it:

$ cf push zipkin-web -p zipkin-web/build/libs/zipkin-web*all.jar

It needs an environment variable to set the command line args:

$ cf set-env zipkin-web JBP_CONFIG_JAVA_MAIN '{arguments: "-zipkin.web.port=:\$PORT -zipkin.web.rootUrl=/ -zipkin.web.query.dest=zipkin-server.cfapps.io:80 -zipkin.web.resourcesRoot=."}'

NOTE: JBP_CONFIG_JAVA_MAIN only works with Java buildpack v3.2 and above (so not in PEZ Heritage right now).