Tabnine Logo
TraceAndSpanIdGenerator.longToUnsignedLowerHexString
Code IndexAdd Tabnine to your IDE (free)

How to use
longToUnsignedLowerHexString
method
in
com.nike.wingtips.TraceAndSpanIdGenerator

Best Java code snippets using com.nike.wingtips.TraceAndSpanIdGenerator.longToUnsignedLowerHexString (Showing top 4 results out of 315)

origin: Nike-Inc/wingtips

/**
 * @return A newly-generated random 64-bit long encoded as a String <b>UNSIGNED AND IN HEX FORMAT</b> - intended for use as a trace or span ID.
 *          The returned string will have a length of 16 characters (zeroes will be prepended as padding if necessary to
 *          reach a string length of 16). The hex format is necessary to be fully B3 compatible and therefore fully Zipkin compatible
 *          (see <a href="http://zipkin.io/pages/instrumenting.html">http://zipkin.io/pages/instrumenting.html</a>). If you simply want a full 64-bit
 *          random normal *signed* Java long encoded in *decimal* format for other reasons then you can call {@link String#valueOf(long)} and pass in a
 *          long created by {@link #generate64BitRandomLong()}.
 *          <p>You can convert the unsigned hex-encoded longs returned by this method back into normal Java long primitives by passing them to
 *          {@link #unsignedLowerHexStringToLong(String)}.
 */
public static String generateId() {
  return longToUnsignedLowerHexString(generate64BitRandomLong());
}
origin: Nike-Inc/wingtips

String sanitizedId = TraceAndSpanIdGenerator.longToUnsignedLowerHexString(originalIdAsRawLong);
logger.info(SANITIZED_ID_LOG_MSG, originalId, sanitizedId);
return sanitizedId;
origin: com.nike.wingtips/wingtips-zipkin2

String sanitizedId = TraceAndSpanIdGenerator.longToUnsignedLowerHexString(originalIdAsRawLong);
logger.info(SANITIZED_ID_LOG_MSG, originalId, sanitizedId);
return sanitizedId;
origin: Nike-Inc/wingtips

@DataProvider(value = {
  "0000000000000000   |   0",
  "0000000000000001   |   1",
  "ffffffffffffffff   |   18446744073709551615",
  "fffffffffffffffe   |   18446744073709551614",
  "7fae59489091369a   |   9200389256962455194",
  "eb5e7aaefeb92b4f   |   16960128138740312911",
  "d2153abe4c047408   |   15138070311469347848",
  "9041ee0d07d6c72c   |   10394851154681317164",
  "6470a5ce0e9262f4   |   7237466905610707700",
  "000003c8a251fb93   |   4160251624339",
}, splitBy = "\\|")
@Test
public void longToUnsignedLowerHexString_and_unsignedLowerHexStringToLong_work_as_expected_for_known_values(String actualHexValue, String actualUnsignedDecimalValue) {
  // given
  long actualSignedPrimitive = new BigInteger(actualUnsignedDecimalValue).longValue();
  // when
  String calculatedHexValue = TraceAndSpanIdGenerator.longToUnsignedLowerHexString(actualSignedPrimitive);
  long calculatedPrimitiveValue = TraceAndSpanIdGenerator.unsignedLowerHexStringToLong(actualHexValue);
  // then
  assertThat(calculatedHexValue).isEqualTo(actualHexValue);
  assertThat(calculatedPrimitiveValue).isEqualTo(actualSignedPrimitive);
}
com.nike.wingtipsTraceAndSpanIdGeneratorlongToUnsignedLowerHexString

Popular methods of TraceAndSpanIdGenerator

  • generateId
  • unsignedLowerHexStringToLong
  • convertBytesToLong
    Converts the given 8 bytes to a long value. Implementation for this taken from java.util.UUID#UUID(b
  • generate64BitRandomLong
  • getRandomInstance
    Tries to retrieve and return the SecureRandom with the given implementation using SecureRandom#getIn

Popular in Java

  • Start an intent from android
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • startActivity (Activity)
  • findViewById (Activity)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • Option (scala)
  • Top plugins for Android Studio
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