Avoid setting the error tag
and test fixes.
MODIFY
dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/OpenTracing32.java
dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/OpenTracing32.java
@@ -5,6 +5,7 @@ import static io.opentracing.propagation.Format.Builtin.TEXT_MAP_EXTRACT;
import static io.opentracing.propagation.Format.Builtin.TEXT_MAP_INJECT;
import static java.util.Collections.singletonMap;
+import datadog.opentracing.DDSpan;
import datadog.trace.api.interceptor.MutableSpan;
import datadog.trace.bootstrap.instrumentation.api.AgentPropagation;
import datadog.trace.bootstrap.instrumentation.api.AgentPropagation.Getter;
@@ -165,7 +166,11 @@ public final class OpenTracing32 implements TracerAPI {
@Override
public AgentSpan setError(final boolean error) {
+ if (span instanceof DDSpan) {
+ ((DDSpan) span).setError(error);
+ } else {
Tags.ERROR.set(span, error);
+ }
return this;
}

MODIFY
dd-java-agent/instrumentation/twilio/src/test/groovy/test/TwilioClientTest.groovy
dd-java-agent/instrumentation/twilio/src/test/groovy/test/TwilioClientTest.groovy
@@ -758,7 +758,7 @@ class TwilioClientTest extends AgentTestRunner {
1 * twilioRestClient.request(_) >> new Response(new ByteArrayInputStream(ERROR_RESPONSE_BODY.getBytes()), 500)
when:
- Message message = runUnderTrace("test") {
+ runUnderTrace("test") {
ListenableFuture<Message> future = Message.creator(
new PhoneNumber("+1 555 720 5913"), // To number
new PhoneNumber("+1 555 555 5215"), // From number

MODIFY
dd-trace-ot/src/main/java/datadog/trace/common/processor/TraceProcessor.java
dd-trace-ot/src/main/java/datadog/trace/common/processor/TraceProcessor.java
@@ -24,8 +24,8 @@ public class TraceProcessor {
new DBStatementRule(),
new ResourceNameRule(),
new SpanTypeRule(),
- new HttpStatusErrorRule(),
new ErrorRule(),
+ new HttpStatusErrorRule(),
new URLAsResourceNameRule(),
new Status404Rule(),
new AnalyticsSampleRateRule(),

MODIFY
dd-trace-ot/src/main/java/datadog/trace/common/processor/rule/HttpStatusErrorRule.java
dd-trace-ot/src/main/java/datadog/trace/common/processor/rule/HttpStatusErrorRule.java
@@ -17,8 +17,8 @@ public class HttpStatusErrorRule implements TraceProcessor.Rule {
@Override
public void processSpan(
final DDSpan span, final Map<String, Object> tags, final Collection<DDSpan> trace) {
- if (!span.context().getErrorFlag() && tags.containsKey(Tags.HTTP_STATUS.getKey())) {
final Object value = tags.get(Tags.HTTP_STATUS.getKey());
+ if (value != null && !span.context().getErrorFlag()) {
try {
final int status =
value instanceof Integer ? (int) value : Integer.parseInt(value.toString());

Avoid setting the error tag

and test fixes.