Tabnine Logo
JsonCodec.readSpans
Code IndexAdd Tabnine to your IDE (free)

How to use
readSpans
method
in
zipkin.internal.JsonCodec

Best Java code snippets using zipkin.internal.JsonCodec.readSpans (Showing top 4 results out of 315)

origin: io.zipkin.sparkstreaming/zipkin-sparkstreaming

 @Override public Iterable<Span> call(byte[] bytes) throws Exception {
  logInitializer().run();
  if (bytes.length == 0) return Collections.emptyList();
  try {
   if (bytes[0] == '[') {
    return Codec.JSON.readSpans(bytes);
   } else {
    if (bytes[0] == 12 /* TType.STRUCT */) {
     return Codec.THRIFT.readSpans(bytes);
    } else { // historical kafka encoding of single thrift span per message
     return Collections.singletonList(Codec.THRIFT.readSpan(bytes));
    }
   }
  } catch (RuntimeException e) {
   log.warn("unable to decode spans", e);
   return Collections.emptyList();
  }
 }
}
origin: io.zipkin.java/zipkin-transport-kafka

 /**
  * Conditionally decodes depending on whether the input bytes are encoded as a single span or a
  * list.
  */
 static List<Span> fromBytes(byte[] bytes) {
  // In TBinaryProtocol encoding, the first byte is the TType, in a range 0-16
  // .. If the first byte isn't in that range, it isn't a thrift.
  //
  // When byte(0) == '[' (91), assume it is a list of json-encoded spans
  //
  // When byte(0) <= 16, assume it is a TBinaryProtocol-encoded thrift
  // .. When serializing a Span (Struct), the first byte will be the type of a field
  // .. When serializing a List[ThriftSpan], the first byte is the member type, TType.STRUCT(12)
  // .. As ThriftSpan has no STRUCT fields: so, if the first byte is TType.STRUCT(12), it is a list.
  if (bytes[0] == '[') {
   return Codec.JSON.readSpans(bytes);
  } else if (bytes[0] == 12 /* TType.STRUCT */) {
   return Codec.THRIFT.readSpans(bytes);
  } else {
   return Collections.singletonList(Codec.THRIFT.readSpan(bytes));
  }
 }
}
origin: io.zipkin.java/transport-kafka

 /**
  * Conditionally decodes depending on whether the input bytes are encoded as a single span or a
  * list.
  */
 static List<Span> fromBytes(byte[] bytes) {
  // In TBinaryProtocol encoding, the first byte is the TType, in a range 0-16
  // .. If the first byte isn't in that range, it isn't a thrift.
  //
  // When byte(0) == '[' (91), assume it is a list of json-encoded spans
  //
  // When byte(0) <= 16, assume it is a TBinaryProtocol-encoded thrift
  // .. When serializing a Span (Struct), the first byte will be the type of a field
  // .. When serializing a List[ThriftSpan], the first byte is the member type, TType.STRUCT(12)
  // .. As ThriftSpan has no STRUCT fields: so, if the first byte is TType.STRUCT(12), it is a list.
  if (bytes[0] == '[') {
   return Codec.JSON.readSpans(bytes);
  } else if (bytes[0] == 12 /* TType.STRUCT */) {
   return Codec.THRIFT.readSpans(bytes);
  } else {
   return Collections.singletonList(Codec.THRIFT.readSpan(bytes));
  }
 }
}
origin: Nike-Inc/wingtips

  byte[] deserializableBytes = (compressPayload) ? unGzip(receivedPayloadBytes) : receivedPayloadBytes;
  List<zipkin.Span> receivedSpans = Codec.JSON.readSpans(deserializableBytes);
  assertThat(receivedSpans).isEqualTo(sentSpans);
} finally {
zipkin.internalJsonCodecreadSpans

Popular methods of JsonCodec

  • writeSpans
  • writeSpan
  • readDependencyLink
  • readSpan

Popular in Java

  • Making http requests using okhttp
  • onCreateOptionsMenu (Activity)
  • scheduleAtFixedRate (Timer)
  • requestLocationUpdates (LocationManager)
  • String (java.lang)
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • JList (javax.swing)
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now