Skip to content

Instantly share code, notes, and snippets.

[[{"traceId":"13871f00ea84241f","name":"get","id":"13871f00ea84241f","timestamp":1458133878936000,"duration":8000,"annotations":[{"timestamp":1458133878936000,"value":"sr","endpoint":{"serviceName":"zipkin-query","ipv4":"127.0.0.1","port":9411}},{"timestamp":1458133878944000,"value":"ss","endpoint":{"serviceName":"zipkin-query","ipv4":"127.0.0.1","port":9411}}],"binaryAnnotations":[{"key":"http.path","value":"/app.min.js.map","endpoint":{"serviceName":"zipkin-query","ipv4":"127.0.0.1"}},{"key":"srv/finagle.version","value":"6.33.0","endpoint":{"serviceName":"zipkin-query","ipv4":"127.0.0.1"}},{"key":"sa","value":true,"endpoint":{"serviceName":"zipkin-query","ipv4":"127.0.0.1","port":9411}},{"key":"ca","value":true,"endpoint":{"serviceName":"zipkin-query","ipv4":"127.0.0.1","port":62726}}]}],[{"traceId":"f6ebbdd754f5ab59","name":"get","id":"f6ebbdd754f5ab59","timestamp":1458133878895000,"duration":1000,"annotations":[{"timestamp":1458133878895000,"value":"sr","endpoint":{"serviceName":"zipkin-query","ipv4":"12
@codefromthecrypt
codefromthecrypt / sample.json
Created March 23, 2016 03:10
json trace of zipkin tracing itself
[
[
{
"traceId": "bd7a977555f6b982",
"name": "get",
"id": "bd7a977555f6b982",
"timestamp": 1458702548467000,
"duration": 386000,
"annotations": [
{
@codefromthecrypt
codefromthecrypt / tracing-tracer.md
Last active April 19, 2018 12:13
How to debug finagle tracing

Questions come up some times about why things get bad data. It is hard to pin things down, as maybe you can't modify the code, or even know where to look. Here's an example of how to track down what's making bad trace ids in finagle.

Firstly, download and extract byteman so you can use it.

$ (cd /tmp; wget -q http://downloads.jboss.org/byteman/3.0.5/byteman-download-3.0.5-bin.zip; unzip byteman-download-3.0.5-bin.zip)
$ export BYTEMAN_HOME=/tmp/byteman-download-3.0.5/
$ docker inspect 97f9b5dc9c2f
[
{
"Id": "97f9b5dc9c2f850f808ffa73893e0152d543437a917bdb6d05eb6b606fe5f54c",
"Created": "2016-08-25T08:08:12.540730023Z",
"Path": "/bin/sh",
"Args": [
"-c",
"test -n \"$STORAGE_TYPE\" \u0026\u0026 source .${STORAGE_TYPE}_profile; java ${JAVA_OPTS} -cp . org.springframework.boot.loader.JarLauncher"
],
/**
* Copyright 2016 The OpenZipkin Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
@codefromthecrypt
codefromthecrypt / gist:8b73f488bfeb1d8dc86a8a2b5ee5c4ad
Created August 30, 2016 17:29
Finally got zipkin span encoding into the single-digit microsecond range
CodecBenchmarks.writeClientSpan_json_zipkin avgt 15 1.445 ± 0.036 us/op
CodecBenchmarks.writeClientSpan_thrift_libthrift avgt 15 1.951 ± 0.014 us/op
CodecBenchmarks.writeClientSpan_thrift_zipkin avgt 15 0.433 ± 0.011 us/op
CodecBenchmarks.writeLocalSpan_json_zipkin avgt 15 0.813 ± 0.010 us/op
CodecBenchmarks.writeLocalSpan_thrift_libthrift avgt 15 1.191 ± 0.016 us/op
CodecBenchmarks.writeLocalSpan_thrift_zipkin avgt 15 0.268 ± 0.004 us/op
CodecBenchmarks.writeRpcSpan_json_zipkin avgt 15 3.606 ± 0.068 us/op
CodecBenchmarks.writeRpcSpan_thrift_libthrift avgt 15 5.134 ± 0.081 us/op
CodecBenchmarks.writeRpcSpan_thrift_zipkin avgt 15 1.384 ± 0.078 us/op
CodecBenchmarks.writeRpcV6Span_json_zipkin avgt 15 3.912 ± 0.115 us/op
/**
* Instrumentation should set {@link Span#timestamp} when recording a span so that guess-work
* isn't needed. Since a lot of instrumentation don't, we have to make some guesses.
*
* <pre><ul>
* <li>If there is a {@link Constants#CLIENT_SEND}, use that</li>
* <li>Fall back to {@link Constants#SERVER_RECV}, if a root span</li>
* <li>Otherwise, return null</li>
* </ul></pre>
*/
[
{
"traceId": "4e441824ec2b6a44",
"id": "4e441824ec2b6a44",
"name": "get",
"timestamp": 1477975620117000,
"duration": 500209,
"annotations": [
{
"timestamp": 1477975620117000,
[[{"traceId":"ffdc9bb9a6453df3","id":"ffdc9bb9a6453df3","name":"http:/","timestamp":1478624611519000,"duration":11940,"annotations":[{"timestamp":1478624611519000,"value":"sr","endpoint":{"serviceName":"frontend","ipv4":"127.0.0.1","port":8081}},{"timestamp":1478624611530000,"value":"ss","endpoint":{"serviceName":"frontend","ipv4":"127.0.0.1","port":8081}}]},{"traceId":"ffdc9bb9a6453df3","id":"b89b8dfb23214f08","name":"call-backend","parentId":"ffdc9bb9a6453df3","timestamp":1478624611521000,"duration":9012,"binaryAnnotations":[{"key":"lc","value":"unknown","endpoint":{"serviceName":"frontend","ipv4":"127.0.0.1","port":8081}},{"key":"mvc.controller.class","value":"Frontend","endpoint":{"serviceName":"frontend","ipv4":"127.0.0.1","port":8081}},{"key":"mvc.controller.method","value":"callBackend","endpoint":{"serviceName":"frontend","ipv4":"127.0.0.1","port":8081}}]},{"traceId":"ffdc9bb9a6453df3","id":"a50cd5a4f50046de","name":"http:/api","parentId":"b89b8dfb23214f08","timestamp":1478624611521000,"duration":6516
public final class HttpClient4Instrumentation {
public static class Config extends ClientHandler.Config<HttpRequest, HttpResponse> {
@Override protected Parser<HttpRequest, String> spanNameParser() {
return r -> r.getRequestLine().getMethod();
}
@Override protected TagsParser<HttpRequest> requestTagsParser() {
return TagsParser.builder(HttpRequest.class)
.addParser(TraceKeys.HTTP_URL, input -> input.getRequestLine().getUri())