Add comments and remove unneeded code.

This commit is contained in:
Tyler Benson 2018-10-23 16:33:20 +10:00
parent a603eee841
commit 188bdf498f
3 changed files with 8 additions and 8 deletions

View File

@ -564,14 +564,7 @@ public class DDTracer implements io.opentracing.Tracer, Closeable, datadog.trace
// Get header tags whether propagating or not.
if (parentContext instanceof TagContext) {
final TagContext tagContext = (TagContext) parentContext;
if (tags.isEmpty() && !tagContext.getTags().isEmpty()) {
tags = new HashMap<>();
}
if (!tagContext.getTags().isEmpty()) {
tags.putAll(tagContext.getTags());
}
tags.putAll(((TagContext) parentContext).getTags());
}
tags.put(Config.RUNTIME_ID_TAG, runtimeId);

View File

@ -3,6 +3,9 @@ package datadog.opentracing.propagation;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* Propagated data resulting from calling tracer.extract with header data from an incoming request.
*/
public class ExtractedContext extends TagContext {
private final String traceId;
private final String spanId;

View File

@ -4,6 +4,10 @@ import io.opentracing.SpanContext;
import java.util.Collections;
import java.util.Map;
/**
* When calling extract, we allow for grabbing other configured headers as tags. Those tags are
* returned here even if the rest of the request would have returned null.
*/
public class TagContext implements SpanContext {
private final Map<String, String> tags;