/** * Clears current span. */ public void clearCurrentSpan() { spanAndEndpoint().state().setCurrentServerSpan(null); }
/** * Sets the current Trace/Span state. Using this method indicates that a parent request has decided that we should not * trace the current request. * * @see ServerTracer#setStateCurrentTrace(long, long, Long, String) * @see ServerTracer#setStateUnknown(String) */ public void setStateNoTracing() { spanAndEndpoint().state().setCurrentServerSpan(ServerSpan.NOT_SAMPLED); }
/** * Sets the server sent event for current thread. */ public void setServerSend() { if (submitEndAnnotation(zipkinCoreConstants.SERVER_SEND, spanCollector())) { spanAndEndpoint().state().setCurrentServerSpan(null); } }
/** * Sets the current Trace/Span state. Using this method indicates that we got no information about being part of an * existing trace or about the fact that we should not trace the current request. In this case the ServerTracer will * decide what to do. * * @param spanName The name of our current request/span. */ public void setStateUnknown(String spanName) { checkNotBlank(spanName, "Null or blank span name"); long newTraceId = randomGenerator().nextLong(); if (!traceSampler().isSampled(newTraceId)) { spanAndEndpoint().state().setCurrentServerSpan(ServerSpan.NOT_SAMPLED); return; } spanAndEndpoint().state().setCurrentServerSpan( ServerSpan.create(newTraceId, newTraceId, null, spanName)); }
/** * Sets the current Trace/Span state. Using this method indicates we are part of an existing trace/span. * * @param traceId Trace id. * @param spanId Span id. * @param parentSpanId Parent span id. Can be <code>null</code>. * @param name Name should not be empty or <code>null</code>. * @see ServerTracer#setStateNoTracing() * @see ServerTracer#setStateUnknown(String) */ public void setStateCurrentTrace(long traceId, long spanId, @Nullable Long parentSpanId, @Nullable String name) { checkNotBlank(name, "Null or blank span name"); spanAndEndpoint().state().setCurrentServerSpan( ServerSpan.create(traceId, spanId, parentSpanId, name)); }