Fixing 1.6 and perf issues
This commit is contained in:
parent
5e92d19114
commit
31c8f3279d
|
@ -13,6 +13,10 @@
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>dd-trace</name>
|
<name>dd-trace</name>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<java.version>1.6</java.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<!-- Opentracing core -->
|
<!-- Opentracing core -->
|
||||||
|
|
|
@ -175,8 +175,10 @@ public class DDSpanContext implements io.opentracing.SpanContext {
|
||||||
this.tags.put(tag, value);
|
this.tags.put(tag, value);
|
||||||
|
|
||||||
//Call decorators
|
//Call decorators
|
||||||
for (DDSpanContextDecorator decorator : tracer.getSpanContextDecorators(tag)) {
|
if (tracer.getSpanContextDecorators(tag) != null) {
|
||||||
decorator.afterSetTag(this, tag, value);
|
for (DDSpanContextDecorator decorator : tracer.getSpanContextDecorators(tag)) {
|
||||||
|
decorator.afterSetTag(this, tag, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//Error management
|
//Error management
|
||||||
if (Tags.ERROR.getKey().equals(tag) && Boolean.TRUE.equals(value)) {
|
if (Tags.ERROR.getKey().equals(tag) && Boolean.TRUE.equals(value)) {
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class DDTracer implements io.opentracing.Tracer {
|
||||||
/**
|
/**
|
||||||
* Span context decorators
|
* Span context decorators
|
||||||
*/
|
*/
|
||||||
private final Map<String, List<DDSpanContextDecorator>> spanContextDecorators = new HashMap<>();
|
private final Map<String, List<DDSpanContextDecorator>> spanContextDecorators = new HashMap<String, List<DDSpanContextDecorator>>();
|
||||||
|
|
||||||
|
|
||||||
private final static Logger logger = LoggerFactory.getLogger(DDTracer.class);
|
private final static Logger logger = LoggerFactory.getLogger(DDTracer.class);
|
||||||
|
@ -78,12 +78,8 @@ public class DDTracer implements io.opentracing.Tracer {
|
||||||
* @return the list of span context decorators
|
* @return the list of span context decorators
|
||||||
*/
|
*/
|
||||||
public List<DDSpanContextDecorator> getSpanContextDecorators(String tag) {
|
public List<DDSpanContextDecorator> getSpanContextDecorators(String tag) {
|
||||||
List<DDSpanContextDecorator> decorators = Collections.emptyList();
|
|
||||||
String key = getHashKey(tag);
|
|
||||||
|
|
||||||
if (spanContextDecorators.containsKey(key)) {
|
List<DDSpanContextDecorator> decorators = spanContextDecorators.get(tag);
|
||||||
decorators = Collections.unmodifiableList(spanContextDecorators.get(key));
|
|
||||||
}
|
|
||||||
|
|
||||||
return decorators;
|
return decorators;
|
||||||
}
|
}
|
||||||
|
@ -94,15 +90,14 @@ public class DDTracer implements io.opentracing.Tracer {
|
||||||
* @param decorator The decorator in the list
|
* @param decorator The decorator in the list
|
||||||
*/
|
*/
|
||||||
public void addDecorator(DDSpanContextDecorator decorator) {
|
public void addDecorator(DDSpanContextDecorator decorator) {
|
||||||
String key = getHashKey(decorator.getMatchingTag());
|
|
||||||
|
|
||||||
List<DDSpanContextDecorator> list = spanContextDecorators.get(key);
|
List<DDSpanContextDecorator> list = spanContextDecorators.get(decorator.getMatchingTag());
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
list = new ArrayList<>();
|
list = new ArrayList<DDSpanContextDecorator>();
|
||||||
}
|
}
|
||||||
list.add(decorator);
|
list.add(decorator);
|
||||||
|
|
||||||
spanContextDecorators.put(key, list);
|
spanContextDecorators.put(decorator.getMatchingTag(), list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -327,9 +322,6 @@ public class DDTracer implements io.opentracing.Tracer {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getHashKey(String tag) {
|
|
||||||
return tag;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class CodecRegistry {
|
private static class CodecRegistry {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue