Tabnine Logo
Span.addTimestampedAnnotationForCurrentTime
Code IndexAdd Tabnine to your IDE (free)

How to use
addTimestampedAnnotationForCurrentTime
method
in
com.nike.wingtips.Span

Best Java code snippets using com.nike.wingtips.Span.addTimestampedAnnotationForCurrentTime (Showing top 20 results out of 315)

origin: com.nike.riposte/riposte-core

protected void addEndpointFinishAnnotation(Span span, ServerSpanNamingAndTaggingStrategy<Span> strategy) {
  // Don't allow the annotation addition to cause the endpoint execution future to fail if it
  //      fails, by surrounding with try/catch. This should never actually happen, but better
  //      safe than sorry.
  try {
    span.addTimestampedAnnotationForCurrentTime(
      strategy.endpointFinishAnnotationName()
    );
  }
  catch(Throwable t) {
    logger.error(
      "Unexpected error while annotating Span with endpoint finish timestamp.", t
    );
  }
}
origin: Nike-Inc/riposte

protected void addEndpointFinishAnnotation(Span span, ServerSpanNamingAndTaggingStrategy<Span> strategy) {
  // Don't allow the annotation addition to cause the endpoint execution future to fail if it
  //      fails, by surrounding with try/catch. This should never actually happen, but better
  //      safe than sorry.
  try {
    span.addTimestampedAnnotationForCurrentTime(
      strategy.endpointFinishAnnotationName()
    );
  }
  catch(Throwable t) {
    logger.error(
      "Unexpected error while annotating Span with endpoint finish timestamp.", t
    );
  }
}
origin: com.nike.riposte/riposte-core

protected void handleWireSendFinishAnnotationIfNecessary() {
  if (alreadyHandledWireSendFinishAnnotation) {
    return;
  }
  alreadyHandledWireSendFinishAnnotation = true;
  // Add the wire-send-finish annotation if we have a span and the annotation is desired.
  if ((spanForDownstreamCall != null) && proxySpanTaggingStrategy.shouldAddWireSendFinishAnnotation()) {
    spanForDownstreamCall.addTimestampedAnnotationForCurrentTime(
      proxySpanTaggingStrategy.wireSendFinishAnnotationName()
    );
  }
}
origin: Nike-Inc/riposte

protected void handleWireSendFinishAnnotationIfNecessary() {
  if (alreadyHandledWireSendFinishAnnotation) {
    return;
  }
  alreadyHandledWireSendFinishAnnotation = true;
  // Add the wire-send-finish annotation if we have a span and the annotation is desired.
  if ((spanForDownstreamCall != null) && proxySpanTaggingStrategy.shouldAddWireSendFinishAnnotation()) {
    spanForDownstreamCall.addTimestampedAnnotationForCurrentTime(
      proxySpanTaggingStrategy.wireSendFinishAnnotationName()
    );
  }
}
origin: com.nike.riposte/riposte-core

protected void addErrorAnnotationToOverallRequestSpan(
  @NotNull HttpProcessingState state,
  @NotNull ResponseInfo<ErrorResponseBody> responseInfo,
  @NotNull Throwable error
) {
  try {
    Span requestSpan = state.getOverallRequestSpan();
    if (
      requestSpan != null
      && spanNamingAndTaggingStrategy.shouldAddErrorAnnotationForCaughtException(responseInfo, error)
    ) {
      requestSpan.addTimestampedAnnotationForCurrentTime(
        spanNamingAndTaggingStrategy.errorAnnotationName(responseInfo, error)
      );
    }
  }
  catch (Throwable t) {
    logger.error(
      "An unexpected error occurred while trying to add an error annotation to the overall request span. "
      + "This should never happen.", t
    );
  }
}
origin: Nike-Inc/riposte

protected void addErrorAnnotationToOverallRequestSpan(
  @NotNull HttpProcessingState state,
  @NotNull ResponseInfo<ErrorResponseBody> responseInfo,
  @NotNull Throwable error
) {
  try {
    Span requestSpan = state.getOverallRequestSpan();
    if (
      requestSpan != null
      && spanNamingAndTaggingStrategy.shouldAddErrorAnnotationForCaughtException(responseInfo, error)
    ) {
      requestSpan.addTimestampedAnnotationForCurrentTime(
        spanNamingAndTaggingStrategy.errorAnnotationName(responseInfo, error)
      );
    }
  }
  catch (Throwable t) {
    logger.error(
      "An unexpected error occurred while trying to add an error annotation to the overall request span. "
      + "This should never happen.", t
    );
  }
}
origin: com.nike.riposte/riposte-core

@Override
public PipelineContinuationBehavior doChannelRead(ChannelHandlerContext ctx, Object msg) {
  // We may get multiple messages for a single HTTP request since riposte handles each individual HTTP message
  //      object (including individual payload content messages).
  //      We only do the processing for HttpRequest which is the first message in a request chain.
  if (shouldHandleDoChannelReadMessage(msg)) {
    try {
      startTrace((HttpRequest) msg, ctx);
    }
    catch (Throwable t) {
      logger.error(
        "An unexpected error occurred while starting the distributed tracing overall request span. This "
        + "exception will be swallowed to avoid breaking the Netty pipeline, but it should be "
        + "investigated as it shouldn't ever happen.", t
      );
    }
  }
  if (msg instanceof LastHttpContent) {
    HttpProcessingState httpProcessingState = ChannelAttributes.getHttpProcessingStateForChannel(ctx).get();
    // Add the "we received the last bytes of the request on the wire" annotation to the span if possible
    //      and desired.
    Span requestSpan = handlerUtils.getOverallRequestSpan(httpProcessingState);
    if (requestSpan != null && spanNamingAndTaggingStrategy.shouldAddWireReceiveFinishAnnotation()) {
      requestSpan.addTimestampedAnnotationForCurrentTime(
        spanNamingAndTaggingStrategy.wireReceiveFinishAnnotationName()
      );
    }
  }
  return PipelineContinuationBehavior.CONTINUE;
}
origin: Nike-Inc/riposte

@Override
public PipelineContinuationBehavior doChannelRead(ChannelHandlerContext ctx, Object msg) {
  // We may get multiple messages for a single HTTP request since riposte handles each individual HTTP message
  //      object (including individual payload content messages).
  //      We only do the processing for HttpRequest which is the first message in a request chain.
  if (shouldHandleDoChannelReadMessage(msg)) {
    try {
      startTrace((HttpRequest) msg, ctx);
    }
    catch (Throwable t) {
      logger.error(
        "An unexpected error occurred while starting the distributed tracing overall request span. This "
        + "exception will be swallowed to avoid breaking the Netty pipeline, but it should be "
        + "investigated as it shouldn't ever happen.", t
      );
    }
  }
  if (msg instanceof LastHttpContent) {
    HttpProcessingState httpProcessingState = ChannelAttributes.getHttpProcessingStateForChannel(ctx).get();
    // Add the "we received the last bytes of the request on the wire" annotation to the span if possible
    //      and desired.
    Span requestSpan = handlerUtils.getOverallRequestSpan(httpProcessingState);
    if (requestSpan != null && spanNamingAndTaggingStrategy.shouldAddWireReceiveFinishAnnotation()) {
      requestSpan.addTimestampedAnnotationForCurrentTime(
        spanNamingAndTaggingStrategy.wireReceiveFinishAnnotationName()
      );
    }
  }
  return PipelineContinuationBehavior.CONTINUE;
}
origin: com.nike.riposte/riposte-core

endpointExecutionSpan.addTimestampedAnnotationForCurrentTime(
  spanTaggingStrategy.endpointStartAnnotationName()
);
origin: Nike-Inc/riposte

endpointExecutionSpan.addTimestampedAnnotationForCurrentTime(
  spanTaggingStrategy.endpointStartAnnotationName()
);
origin: Nike-Inc/riposte

verify(spanMock).addTimestampedAnnotationForCurrentTime(
  distributedTracingConfig.getServerSpanNamingAndTaggingStrategy().wireReceiveFinishAnnotationName()
);
verify(spanMock, never()).addTimestampedAnnotationForCurrentTime(anyString());
origin: Nike-Inc/riposte

@UseDataProvider("errorAnnotationScenarioDataProvider")
@Test
public void addErrorAnnotationToOverallRequestSpan_works_as_expected(
  ErrorAnnotationScenario scenario
) {
  // given
  HttpProcessingState stateSpy = spy(state);
  doReturn(scenario.overallRequestSpanMock).when(stateSpy).getOverallRequestSpan();
  ResponseInfo<ErrorResponseBody> responseInfoMock = mock(ResponseInfo.class);
  Throwable errorMock = mock(Throwable.class);
  doReturn(scenario.addErrorAnnotationConfigValue)
    .when(serverSpanNamingAndTaggingStrategyMock).shouldAddErrorAnnotationForCaughtException(any(), any());
  String annotationValueFromStrategy = UUID.randomUUID().toString();
  doReturn(annotationValueFromStrategy)
    .when(serverSpanNamingAndTaggingStrategyMock).errorAnnotationName(any(), any());
  // when
  handler.addErrorAnnotationToOverallRequestSpan(stateSpy, responseInfoMock, errorMock);
  // then
  if (scenario.expectAnnotation) {
    verify(scenario.overallRequestSpanMock).addTimestampedAnnotationForCurrentTime(annotationValueFromStrategy);
    verify(serverSpanNamingAndTaggingStrategyMock).errorAnnotationName(responseInfoMock, errorMock);
  }
  if (scenario.overallRequestSpanMock != null) {
    verify(serverSpanNamingAndTaggingStrategyMock)
      .shouldAddErrorAnnotationForCaughtException(responseInfoMock, errorMock);
  }
}
origin: Nike-Inc/riposte

                        ? times(1)
                        : never();
verify(spanMock, startAnnotationVerification).addTimestampedAnnotationForCurrentTime(
  scenario.startAnnotationName
);
                        ? times(1)
                        : never();
verify(spanMock, finishAnnotationVerification).addTimestampedAnnotationForCurrentTime(
  scenario.finishAnnotationName
);
origin: Nike-Inc/riposte

overallRequestSpan.addTimestampedAnnotationForCurrentTime(
  spanNamingAndTaggingStrategy.wireSendStartAnnotationName()
);
Span overallRequestSpan = state.getOverallRequestSpan();
if (overallRequestSpan != null && spanNamingAndTaggingStrategy.shouldAddWireSendFinishAnnotation()) {
  overallRequestSpan.addTimestampedAnnotationForCurrentTime(
    spanNamingAndTaggingStrategy.wireSendFinishAnnotationName()
  );
origin: com.nike.riposte/riposte-core

overallRequestSpan.addTimestampedAnnotationForCurrentTime(
  spanNamingAndTaggingStrategy.wireSendStartAnnotationName()
);
Span overallRequestSpan = state.getOverallRequestSpan();
if (overallRequestSpan != null && spanNamingAndTaggingStrategy.shouldAddWireSendFinishAnnotation()) {
  overallRequestSpan.addTimestampedAnnotationForCurrentTime(
    spanNamingAndTaggingStrategy.wireSendFinishAnnotationName()
  );
origin: com.nike.riposte/riposte-core

        currentSpan.addTimestampedAnnotationForCurrentTime(
          proxySpanTaggingStrategy.wireReceiveFinishAnnotationName()
        );
  && proxySpanTaggingStrategy.shouldAddWireReceiveStartAnnotation()
) {
  spanForDownstreamCall.addTimestampedAnnotationForCurrentTime(
    proxySpanTaggingStrategy.wireReceiveStartAnnotationName()
  );
origin: Nike-Inc/riposte

        currentSpan.addTimestampedAnnotationForCurrentTime(
          proxySpanTaggingStrategy.wireReceiveFinishAnnotationName()
        );
  && proxySpanTaggingStrategy.shouldAddWireReceiveStartAnnotation()
) {
  spanForDownstreamCall.addTimestampedAnnotationForCurrentTime(
    proxySpanTaggingStrategy.wireReceiveStartAnnotationName()
  );
origin: Nike-Inc/wingtips

span.addTimestampedAnnotationForCurrentTime(annotationValue);
long nanoTimeAfterMethodCall = System.nanoTime();
origin: com.nike.riposte/riposte-core

newSpan.addTimestampedAnnotationForCurrentTime(
  spanNamingAndTaggingStrategy.wireReceiveStartAnnotationName()
);
origin: Nike-Inc/riposte

newSpan.addTimestampedAnnotationForCurrentTime(
  spanNamingAndTaggingStrategy.wireReceiveStartAnnotationName()
);
com.nike.wingtipsSpanaddTimestampedAnnotationForCurrentTime

Javadoc

Adds a TimestampedAnnotation to this Span's #getTimestampedAnnotations() list, with the current time in epoch microseconds as the timestamp and the given value.

NOTE: Since the span keeps track of its duration in nanoseconds, this method results in a TimestampedAnnotation with a TimestampedAnnotation#getTimestampEpochMicros() that is more accurate than if you created the TimestampedAnnotation directly (i.e. this method uses TimestampedAnnotation#forEpochMicrosWithNanoOffset(long,long,String)). This method should therefore be used anytime you want to add an annotation to a Span with a timestamp of "right now".

Popular methods of Span

  • getTraceId
  • getParentSpanId
  • getSpanId
  • getSpanName
  • getDurationNanos
  • getTags
  • isSampleable
  • newBuilder
  • getSpanPurpose
  • getSpanStartTimeEpochMicros
  • getTimestampedAnnotations
  • getUserId
  • getTimestampedAnnotations,
  • getUserId,
  • close,
  • isCompleted,
  • toKeyValueString,
  • <init>,
  • addTimestampedAnnotation,
  • generateRootSpanForNewTrace,
  • putTag

Popular in Java

  • Reading from database using SQL prepared statement
  • requestLocationUpdates (LocationManager)
  • getSharedPreferences (Context)
  • onRequestPermissionsResult (Fragment)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • JTable (javax.swing)
  • CodeWhisperer alternatives
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