- My laptop benchmarks normal random long (including work to create the java object representing a context) is something like 40 per microsecond
- Desktop: 2.8Ghz macbook pro
- Using threadlocalrandom
/** | |
* All codes from stagemonitor apm, which gives a example about how to use instrumentation::appendToBootstrapClassLoaderSearch | |
* This will be very useful for instrument some class in rt.jar | |
*/ | |
private static boolean initInstrumentation() { | |
try { | |
/** | |
* this try-catch block shows two ways about instrumentation. | |
* ref issue: https://github.com/raphw/byte-buddy/issues/237 | |
*/ |
/** | |
* Created by wusheng on 2016/12/21. | |
*/ | |
public class Transaction { | |
// 当前线程事务GUID | |
private java.lang.String traceId; | |
// 相关性上级GUID | |
private java.lang.String refTraceId; | |
// 全局 GUID | |
private java.lang.String tripId; |
/** | |
* Code from | |
* https://github.com/Nike-Inc/wingtips/blob/38d8ce83207ffee3d638bf7466b8f7058bb36498/wingtips-core/src/main/java/com/nike/wingtips/TraceAndSpanIdGenerator.java#L60 | |
* Thanks to @adriancole | |
*/ | |
public static long generate64BitRandomLong() { | |
byte[] random8Bytes = new byte[8]; | |
random.nextBytes(random8Bytes); |
public final class TraceIdGenerator { | |
private static final ThreadLocal<Integer> ThreadTraceIdSequence = new ThreadLocal<Integer>(){ | |
@Override | |
protected Integer initialValue() { | |
return 0; | |
} | |
}; | |
private static final int PROCESS_UUID; |
package io.opentracing.contrib; | |
import io.opentracing.NoopTracerFactory; | |
import io.opentracing.Tracer; | |
import java.util.Iterator; | |
import java.util.ServiceLoader; | |
import java.util.logging.Level; | |
import java.util.logging.Logger; |
I've had many people ask me questions about OpenTracing, often in relation to OpenZipkin. I've seen assertions about how it is vendor neutral and is the lock-in cure. This post is not a sanctioned, polished or otherwise muted view, rather what I personally think about what it is and is not, and what it helps and does not help with. Scroll to the very end if this is too long. Feel free to add a comment if I made any factual mistakes or you just want to add a comment.
OpenTracing is documentation and library interfaces for distributed tracing instrumentation. To be "OpenTracing" requires bundling its interfaces in your work, so that others can use it to time distributed operations with the same library.
OpenTracing interfaces are targeted to authors of instrumentation libraries, and those who want to collaborate with traces created by them. Ex something started a trace somewhere and I add a notable event to that trace. Structure logging was recently added to O