Codota Logo
WingtipsToZipkinSpanConverter
Code IndexAdd Codota to your IDE (free)

How to use
WingtipsToZipkinSpanConverter
in
com.nike.wingtips.zipkin2.util

Best Java code snippets using com.nike.wingtips.zipkin2.util.WingtipsToZipkinSpanConverter (Showing top 4 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Point p =
  • Codota Iconnew Point(x, y)
  • Codota Iconnew Point()
  • Codota IconMouseEvent e;e.getPoint()
  • Smart code suggestions by Codota
}
origin: Nike-Inc/wingtips

  @Override
  public void spanCompleted(Span span) {
    try {
      zipkin2.Span zipkinSpan = zipkinSpanConverter.convertWingtipsSpanToZipkinSpan(span, zipkinEndpoint);
      zipkinSpanReporter.report(zipkinSpan);
    }
    catch(Throwable ex) {
      long currentBadSpanCount = spanHandlingErrorCounter.incrementAndGet();

      // Only log once every MIN_SPAN_HANDLING_ERROR_LOG_INTERVAL_MILLIS time interval to prevent log spam from a malicious (or broken) caller.
      long currentTimeMillis = System.currentTimeMillis();
      long timeSinceLastLogMsgMillis = currentTimeMillis - lastSpanHandlingErrorLogTimeEpochMillis;
      if (timeSinceLastLogMsgMillis >= MIN_SPAN_HANDLING_ERROR_LOG_INTERVAL_MILLIS) {
        // We're not synchronizing the read and write to lastSpanHandlingErrorLogTimeEpochMillis, and that's ok. If we get a few extra
        //      log messages due to a race condition it's not the end of the world - we're still satisfying the goal of not allowing a
        //      malicious caller to endlessly spam the logs.
        lastSpanHandlingErrorLogTimeEpochMillis = currentTimeMillis;

        zipkinConversionOrReportingErrorLogger.warn(
          "There have been {} spans that were not Zipkin compatible, or that experienced an error during span handling. Latest example: "
          + "wingtips_span_with_error=\"{}\", conversion_or_handling_error=\"{}\"",
          currentBadSpanCount, span.toKeyValueString(), ex.toString());
      }
    }
  }
}
origin: com.nike.wingtips/wingtips-zipkin2

  @Override
  public void spanCompleted(Span span) {
    try {
      zipkin2.Span zipkinSpan = zipkinSpanConverter.convertWingtipsSpanToZipkinSpan(span, zipkinEndpoint);
      zipkinSpanReporter.report(zipkinSpan);
    }
    catch(Throwable ex) {
      long currentBadSpanCount = spanHandlingErrorCounter.incrementAndGet();

      // Only log once every MIN_SPAN_HANDLING_ERROR_LOG_INTERVAL_MILLIS time interval to prevent log spam from a malicious (or broken) caller.
      long currentTimeMillis = System.currentTimeMillis();
      long timeSinceLastLogMsgMillis = currentTimeMillis - lastSpanHandlingErrorLogTimeEpochMillis;
      if (timeSinceLastLogMsgMillis >= MIN_SPAN_HANDLING_ERROR_LOG_INTERVAL_MILLIS) {
        // We're not synchronizing the read and write to lastSpanHandlingErrorLogTimeEpochMillis, and that's ok. If we get a few extra
        //      log messages due to a race condition it's not the end of the world - we're still satisfying the goal of not allowing a
        //      malicious caller to endlessly spam the logs.
        lastSpanHandlingErrorLogTimeEpochMillis = currentTimeMillis;

        zipkinConversionOrReportingErrorLogger.warn(
          "There have been {} spans that were not Zipkin compatible, or that experienced an error during span handling. Latest example: "
          + "wingtips_span_with_error=\"{}\", conversion_or_handling_error=\"{}\"",
          currentBadSpanCount, span.toKeyValueString(), ex.toString());
      }
    }
  }
}
origin: Nike-Inc/wingtips

@Test
public void spanCompleted_does_not_propagate_exceptions_generated_by_span_converter() {
  // given
  doThrow(new RuntimeException("kaboom")).when(spanConverterMock).convertWingtipsSpanToZipkinSpan(any(Span.class), any(Endpoint.class));
  // when
  Throwable ex = catchThrowable(() -> listener.spanCompleted(spanMock));
  // then
  verify(spanConverterMock).convertWingtipsSpanToZipkinSpan(spanMock, listener.zipkinEndpoint);
  verifyZeroInteractions(spanReporterMock);
  assertThat(ex).isNull();
}
origin: Nike-Inc/wingtips

@Test
public void spanCompleted_converts_to_zipkin_span_and_passes_it_to_zipkinSpanReporter() {
  // given
  zipkin2.Span zipkinSpan = zipkin2.Span.newBuilder().traceId("42").id("4242").name("foo").build();
  doReturn(zipkinSpan).when(spanConverterMock).convertWingtipsSpanToZipkinSpan(any(Span.class), any(Endpoint.class));
  // when
  listener.spanCompleted(spanMock);
  // then
  verify(spanConverterMock).convertWingtipsSpanToZipkinSpan(spanMock, listener.zipkinEndpoint);
  verify(spanReporterMock).report(zipkinSpan);
}
com.nike.wingtips.zipkin2.utilWingtipsToZipkinSpanConverter

Javadoc

Simple interface for a class that knows how to convert a Wingtips Span to a zipkin2.Span.

Most used methods

  • convertWingtipsSpanToZipkinSpan

Popular in Java

  • Finding current android device location
  • onCreateOptionsMenu (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • getContentResolver (Context)
  • MalformedURLException (java.net)
    Thrown to indicate that a malformed URL has occurred. Either no legal protocol could be found in a s
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement.A servlet is a small Java program that runs within
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now