@Nullable @Override public Integer statusCode(@Nonnull Response response) { return response.getStatusCode(); } }
byte[] write(Span onlySpan) { int sizeOfValue = SPAN.sizeOfValue(onlySpan); Buffer result = new Buffer(sizeOfLengthDelimitedField(sizeOfValue)); writeSpan(onlySpan, sizeOfValue, result); return result.toByteArray(); }
static byte[] legacyEndpointBytes(@Nullable Endpoint localEndpoint) { if (localEndpoint == null) return null; Buffer buffer = new Buffer(ThriftEndpointCodec.sizeInBytes(localEndpoint)); ThriftEndpointCodec.write(localEndpoint, buffer); return buffer.toByteArray(); }
static void writeAnnotation(long timestamp, String value, @Nullable byte[] endpoint, Buffer b) { b.writeAscii("{\"timestamp\":").writeAscii(timestamp); b.writeAscii(",\"value\":\"").writeUtf8(jsonEscape(value)).writeByte('"'); if (endpoint != null) b.writeAscii(",\"endpoint\":").write(endpoint); b.writeByte('}'); } }
static byte[] legacyEndpointBytes(@Nullable Endpoint localEndpoint) { if (localEndpoint == null) return null; Buffer buffer = new Buffer(endpointSizeInBytes(localEndpoint, true)); V2SpanWriter.writeEndpoint(localEndpoint, buffer, true); return buffer.toByteArray(); }
@Override @Nullable public Span decodeOne(byte[] span) { return JsonCodec.readOne(new V2SpanReader(), span); }
static void write(long timestamp, String value, byte[] endpointBytes, Buffer buffer) { TIMESTAMP.write(buffer); ThriftCodec.writeLong(buffer, timestamp); VALUE.write(buffer); ThriftCodec.writeLengthPrefixed(buffer, value); if (endpointBytes != null) { ENDPOINT.write(buffer); buffer.write(endpointBytes); } buffer.writeByte(TYPE_STOP); } }
/** Attempt to match the host runtime to a capable Platform implementation. */ static Platform findPlatform() { Platform jre8 = Jre8.buildIfSupported(); if (jre8 != null) return jre8; Platform jre7 = Jre7.buildIfSupported(); if (jre7 != null) return jre7; // compatible with JRE 6 return Jre6.build(); }
@Override public int encodeList(List<Span> spans, byte[] out, int pos) { return JsonCodec.writeList(new V1JsonSpanWriter(), spans, out, pos); } },
@Nullable @Override public Integer statusCode(@Nonnull Response response) { return response.getStatusCode(); } }
static void writeBinaryAnnotation(String key, String value, @Nullable byte[] endpoint, Buffer b) { b.writeAscii("{\"key\":\"").writeUtf8(jsonEscape(key)); b.writeAscii("\",\"value\":\"").writeUtf8(jsonEscape(value)).writeByte('"'); if (endpoint != null) b.writeAscii(",\"endpoint\":").write(endpoint); b.writeAscii("}"); } }
@Nullable @Override public String requestHeader(@Nonnull Invocation invocation, @Nonnull String key) { return invocation.getContext().get(key); }
@Nullable @Override public String requestHeader(@Nonnull Invocation invocation, @Nonnull String key) { return invocation.getContext().get(key); }
@Nullable @Override public String url(@Nonnull Invocation invocation) { return invocation.getEndpoint().getEndpoint(); }
@Nullable @Override public String method(@Nonnull Invocation invocation) { return invocation.getOperationMeta().getHttpMethod(); }
@Nullable @Override public String path(@Nonnull Invocation request) { return request.getOperationMeta().getOperationPath(); }
@Nullable @Override public String url(@Nonnull Invocation invocation) { return invocation.getEndpoint().getEndpoint(); }
@Nullable @Override public String method(@Nonnull Invocation invocation) { return invocation.getOperationMeta().getHttpMethod(); }
@Nullable @Override public String path(@Nonnull Invocation request) { return request.getOperationMeta().getOperationPath(); }