/** Attempt to match the host runtime to a capable Platform implementation. */ static Platform findPlatform() { Platform jre9 = Jre9.buildIfSupported(); if (jre9 != null) return jre9; Platform jre7 = Jre7.buildIfSupported(); if (jre7 != null) return jre7; // compatible with JRE 6 return new Jre6(); }
/** Returns the hex representation of the span's parent ID */ @Nullable public String parentIdString() { String r = parentIdString; if (r == null && parentId != 0L) { r = parentIdString = toLowerHex(parentId); } return r; }
@Override protected P createExtraAndClaim(long traceId, long spanId) { P result = create(); result.tryToClaim(traceId, spanId); return result; }
/** * The HTTP method, or verb, such as "GET" or "POST" or null if unreadable. * * <p>Conventionally associated with the key "http.method" */ @Nullable public abstract String method(Req request);
@Nullable public String linkLocalIp() { // uses synchronized variant of double-checked locking as getting the endpoint can be expensive if (linkLocalIp != null) return linkLocalIp; synchronized (this) { if (linkLocalIp == null) { linkLocalIp = produceLinkLocalIp(); } } return linkLocalIp; }
/** Returns the hex representation of the span's ID */ public String spanIdString() { String r = spanIdString; if (r == null) { r = spanIdString = toLowerHex(spanId); } return r; }
static long tryParse16HexCharacters(CharSequence lowerHex, int index, int end) { int endIndex = index + 16; if (endIndex > end) return 0L; return HexCodec.lenientLowerHexToUnsignedLong(lowerHex, index, endIndex); }
/** @see TraceContext#sampled() */ public Builder sampled(boolean sampled) { flags = InternalPropagation.sampled(sampled, flags); return this; }
/** * Returns the same value, an updated one, or null to drop the annotation. * * @see brave.Span#annotate(long, String) */ @Nullable String update(long timestamp, String value); }
/** Returns the hex representation of the span's local root ID */ @Nullable public String localRootIdString() { String r = localRootIdString; if (r == null && localRootId != 0L) { r = localRootIdString = toLowerHex(localRootId); } return r; }
@Override protected P createExtraAndClaim(P existing, long traceId, long spanId) { P result = create(existing); result.tryToClaim(traceId, spanId); return result; }
/** Allows you to create flags from a boolean value without allocating a builder instance */ public static SamplingFlags build(@Nullable Boolean sampled) { if (sampled != null) return sampled ? SAMPLED : NOT_SAMPLED; return EMPTY; }
public static TraceContextOrSamplingFlags create(@Nullable Boolean sampled, boolean debug) { if (debug) return DEBUG; if (sampled == null) return EMPTY; return sampled ? SAMPLED : NOT_SAMPLED; }
/** * Returns the same value, an updated one, or null to drop the tag. * * @see brave.Span#tag(String, String) */ @Nullable String update(String key, String value); }
/** * When null {@link brave.Tracing.Builder#localServiceName(String) default} will be used for * zipkin. */ @Nullable public String localServiceName() { return localServiceName; }
/** * The text representation of the primary IPv4 or IPv6 address associated with the remote side of * this connection. Ex. 192.168.99.100 null if unknown. * * @see brave.Span#remoteIpAndPort(String, int) */ @Nullable public String remoteIp() { return remoteIp; }