/** * {@inheritDoc} */ @Override public ServerSpan getCurrentServerSpan() { return serverSpanState.getCurrentServerSpan(); }
/** * {@inheritDoc} */ @Override public void setStateNoTracing() { state.setCurrentServerSpan(NOT_SAMPLED); }
/** * {@inheritDoc} */ @Override Endpoint getEndPoint() { return state.getServerEndPoint(); }
/** * {@inheritDoc} */ @Override public void setServerSend() { final Span currentSpan = state.getCurrentServerSpan().getSpan(); if (currentSpan != null) { submitAnnotation(zipkinCoreConstants.SERVER_SEND); final long threadDuration = state.getServerSpanThreadDuration(); if (threadDuration > 0) { submitBinaryAnnotation(BraveAnnotations.THREAD_DURATION, String.valueOf(threadDuration)); } collector.collect(currentSpan); state.setCurrentServerSpan(null); } }
public final Builder state(ServerSpanState state) { this.currentSpan = new ServerSpanThreadBinder(state); this.localEndpoint = state.endpoint(); return this; }
/** * {@inheritDoc} */ @Override public long getThreadDuration() { return state.getServerSpanThreadDuration(); }
/** * {@inheritDoc} */ @Override public Endpoint endpoint() { return state().endpoint(); } }
/** * {@inheritDoc} */ @Override public void setCurrentSpan(final ServerSpan span) { serverSpanState.setCurrentServerSpan(span); }
/** * {@inheritDoc} */ @Override Span getSpan() { return state.getCurrentServerSpan().getSpan(); }
/** * {@inheritDoc} */ @Override public Endpoint endpoint() { return state().endpoint(); } }
/** * {@inheritDoc} */ @Override Endpoint getEndPoint() { return state.getServerEndPoint(); }
/** * Binds given span to current thread. This should typically be called when code is invoked in new thread to bind the * span from the thread in which we received the request to the new execution thread. * * @param span Span to bind to current execution thread. Should not be <code>null</code>. */ public void setCurrentSpan(final ServerSpan span) { state.setCurrentServerSpan(span); }
/** * This should be called in the thread in which the request was received before executing code in new threads. * <p> * It returns the current server span which you can keep and bind to a new thread using * {@link ServerSpanThreadBinder#setCurrentSpan(ServerSpan)}. * * @see ServerSpanThreadBinder#setCurrentSpan(ServerSpan) * @return Returned Span can be bound to different executing threads. */ @Nullable public ServerSpan getCurrentServerSpan() { return state.getCurrentServerSpan(); }
/** * Binds given span to current thread. This should typically be called when code is invoked in new thread to bind the * span from the thread in which we received the request to the new execution thread. * * @param span Span to bind to current execution thread. Should not be <code>null</code>. */ public void setCurrentSpan(final ServerSpan span) { state.setCurrentServerSpan(span); } }
/** * {@inheritDoc} */ @Override Span getSpan() { return state.getCurrentServerSpan().getSpan(); }
/** * {@inheritDoc} */ @Override public void clearCurrentSpan() { state.setCurrentServerSpan(null); }
/** * This should be called in the thread in which the request was received before executing code in new threads. * <p> * It returns the current server span which you can keep and bind to a new thread using * {@link ServerSpanThreadBinder#setCurrentSpan(ServerSpan)}. * * @see ServerSpanThreadBinder#setCurrentSpan(ServerSpan) * @return Returned Span can be bound to different executing threads. */ @Nullable public ServerSpan getCurrentServerSpan() { return state.getCurrentServerSpan(); }
/** * {@inheritDoc} */ @Override public void setStateUnknown(final String spanName) { Validate.notBlank(spanName, "Span name should not be null."); for (final TraceFilter traceFilter : traceFilters) { if (traceFilter.trace(spanName) == false) { state.setCurrentServerSpan(NOT_SAMPLED); return; } } final long newSpanId = randomGenerator.nextLong(); state.setCurrentServerSpan(new ServerSpanImpl(newSpanId, newSpanId, null, spanName)); }
/** * {@inheritDoc} */ @Override public Span span() { return state().getCurrentServerSpan().getSpan(); }
/** * Clears current span. */ public void clearCurrentSpan() { spanAndEndpoint().state().setCurrentServerSpan(null); }