Skip to content

Instantly share code, notes, and snippets.

/**
* 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
$ 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"
],
@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/
@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": [
{
[[{"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 / example zipkin trace with 3 spans
Created October 14, 2015 01:46
example zipkin trace with 3 spans
[
{
"traceId": "5e27c67030932221",
"name": "GET",
"id": "5e27c67030932221",
"annotations": [
{
"endpoint": {
"serviceName": "zipkin-web",
"ipv4": "172.17.0.86",
@codefromthecrypt
codefromthecrypt / zk-destruction
Created April 24, 2015 15:43
So you think you're resilient?
# fun times with byteman http://byteman.jboss.org/documentation.html
cat << 'EOF' > chaos.btm
RULE throw ConnectionLoss on ZooKeeper.getData entry
CLASS org.apache.zookeeper.ZooKeeper
METHOD getData
AT ENTRY
IF true
DO traceln("ZK needs more problems");
hello
package playground.caliper;
import com.google.caliper.Benchmark;
import com.google.common.base.Charsets;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Executor;
import retrofit.RestAdapter;
import retrofit.client.Client;
@codefromthecrypt
codefromthecrypt / gist:7372371
Created November 8, 2013 15:12
checks to see how expensive a one-time reflective call to getDeclaredMethods is..
import com.google.caliper.Benchmark;
import com.google.common.base.Function;
import com.google.common.base.Supplier;
import java.io.Serializable;
import java.lang.reflect.Method;
/** tests the impact of checking an interface to see if it is functional. */
public class IsFunctionalInterfaceBench {
@Benchmark int notFunctional(int reps) {