Merge pull request #216 from DataDog/tyler/error-object
Use Field.ERROR_OBJECT instead of string
This commit is contained in:
commit
103d7d7b64
|
@ -1,5 +1,7 @@
|
||||||
package datadog.trace.instrumentation.apachehttpclient;
|
package datadog.trace.instrumentation.apachehttpclient;
|
||||||
|
|
||||||
|
import static io.opentracing.log.Fields.ERROR_OBJECT;
|
||||||
|
|
||||||
import datadog.trace.api.DDSpanTypes;
|
import datadog.trace.api.DDSpanTypes;
|
||||||
import datadog.trace.api.DDTags;
|
import datadog.trace.api.DDTags;
|
||||||
import io.opentracing.Scope;
|
import io.opentracing.Scope;
|
||||||
|
@ -158,7 +160,7 @@ public class DDTracingClientExec implements ClientExecChain {
|
||||||
} catch (IOException | HttpException | RuntimeException e) {
|
} catch (IOException | HttpException | RuntimeException e) {
|
||||||
// error tags
|
// error tags
|
||||||
Tags.ERROR.set(networkSpan, Boolean.TRUE);
|
Tags.ERROR.set(networkSpan, Boolean.TRUE);
|
||||||
networkSpan.log(Collections.singletonMap("error.object", e));
|
networkSpan.log(Collections.singletonMap(ERROR_OBJECT, e));
|
||||||
|
|
||||||
throw e;
|
throw e;
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package datadog.trace.instrumentation.jdbc;
|
package datadog.trace.instrumentation.jdbc;
|
||||||
|
|
||||||
|
import static io.opentracing.log.Fields.ERROR_OBJECT;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
||||||
|
@ -87,7 +88,7 @@ public final class PreparedStatementInstrumentation extends Instrumenter.Configu
|
||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
final Span span = scope.span();
|
final Span span = scope.span();
|
||||||
Tags.ERROR.set(span, true);
|
Tags.ERROR.set(span, true);
|
||||||
span.log(Collections.singletonMap("error.object", throwable));
|
span.log(Collections.singletonMap(ERROR_OBJECT, throwable));
|
||||||
}
|
}
|
||||||
scope.close();
|
scope.close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package datadog.trace.instrumentation.jdbc;
|
package datadog.trace.instrumentation.jdbc;
|
||||||
|
|
||||||
|
import static io.opentracing.log.Fields.ERROR_OBJECT;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
||||||
|
@ -88,7 +89,7 @@ public final class StatementInstrumentation extends Instrumenter.Configurable {
|
||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
final Span span = scope.span();
|
final Span span = scope.span();
|
||||||
Tags.ERROR.set(span, true);
|
Tags.ERROR.set(span, true);
|
||||||
span.log(Collections.singletonMap("error.object", throwable));
|
span.log(Collections.singletonMap(ERROR_OBJECT, throwable));
|
||||||
}
|
}
|
||||||
scope.close();
|
scope.close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package datadog.trace.instrumentation.jms1;
|
||||||
|
|
||||||
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
|
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
|
||||||
import static datadog.trace.instrumentation.jms.util.JmsUtil.toResourceName;
|
import static datadog.trace.instrumentation.jms.util.JmsUtil.toResourceName;
|
||||||
|
import static io.opentracing.log.Fields.ERROR_OBJECT;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
||||||
|
@ -90,7 +91,7 @@ public final class JMS1MessageConsumerInstrumentation extends Instrumenter.Confi
|
||||||
|
|
||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
Tags.ERROR.set(span, Boolean.TRUE);
|
Tags.ERROR.set(span, Boolean.TRUE);
|
||||||
span.log(Collections.singletonMap("error.object", throwable));
|
span.log(Collections.singletonMap(ERROR_OBJECT, throwable));
|
||||||
}
|
}
|
||||||
span.setTag(DDTags.RESOURCE_NAME, "Consumed from " + toResourceName(message, null));
|
span.setTag(DDTags.RESOURCE_NAME, "Consumed from " + toResourceName(message, null));
|
||||||
scope.close();
|
scope.close();
|
||||||
|
|
|
@ -2,6 +2,7 @@ package datadog.trace.instrumentation.jms1;
|
||||||
|
|
||||||
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
|
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
|
||||||
import static datadog.trace.instrumentation.jms.util.JmsUtil.toResourceName;
|
import static datadog.trace.instrumentation.jms.util.JmsUtil.toResourceName;
|
||||||
|
import static io.opentracing.log.Fields.ERROR_OBJECT;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
||||||
|
@ -80,7 +81,7 @@ public final class JMS1MessageListenerInstrumentation extends Instrumenter.Confi
|
||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
final Span span = scope.span();
|
final Span span = scope.span();
|
||||||
Tags.ERROR.set(span, Boolean.TRUE);
|
Tags.ERROR.set(span, Boolean.TRUE);
|
||||||
span.log(Collections.singletonMap("error.object", throwable));
|
span.log(Collections.singletonMap(ERROR_OBJECT, throwable));
|
||||||
}
|
}
|
||||||
scope.close();
|
scope.close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package datadog.trace.instrumentation.jms1;
|
||||||
|
|
||||||
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
|
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
|
||||||
import static datadog.trace.instrumentation.jms.util.JmsUtil.toResourceName;
|
import static datadog.trace.instrumentation.jms.util.JmsUtil.toResourceName;
|
||||||
|
import static io.opentracing.log.Fields.ERROR_OBJECT;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
||||||
|
@ -95,7 +96,7 @@ public final class JMS1MessageProducerInstrumentation extends Instrumenter.Confi
|
||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
final Span span = scope.span();
|
final Span span = scope.span();
|
||||||
Tags.ERROR.set(span, Boolean.TRUE);
|
Tags.ERROR.set(span, Boolean.TRUE);
|
||||||
span.log(Collections.singletonMap("error.object", throwable));
|
span.log(Collections.singletonMap(ERROR_OBJECT, throwable));
|
||||||
}
|
}
|
||||||
scope.close();
|
scope.close();
|
||||||
}
|
}
|
||||||
|
@ -135,7 +136,7 @@ public final class JMS1MessageProducerInstrumentation extends Instrumenter.Confi
|
||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
final Span span = scope.span();
|
final Span span = scope.span();
|
||||||
Tags.ERROR.set(span, Boolean.TRUE);
|
Tags.ERROR.set(span, Boolean.TRUE);
|
||||||
span.log(Collections.singletonMap("error.object", throwable));
|
span.log(Collections.singletonMap(ERROR_OBJECT, throwable));
|
||||||
}
|
}
|
||||||
scope.close();
|
scope.close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package datadog.trace.instrumentation.jms2;
|
||||||
|
|
||||||
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
|
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
|
||||||
import static datadog.trace.instrumentation.jms.util.JmsUtil.toResourceName;
|
import static datadog.trace.instrumentation.jms.util.JmsUtil.toResourceName;
|
||||||
|
import static io.opentracing.log.Fields.ERROR_OBJECT;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
||||||
|
@ -91,7 +92,7 @@ public final class JMS2MessageConsumerInstrumentation extends Instrumenter.Confi
|
||||||
|
|
||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
Tags.ERROR.set(span, Boolean.TRUE);
|
Tags.ERROR.set(span, Boolean.TRUE);
|
||||||
span.log(Collections.singletonMap("error.object", throwable));
|
span.log(Collections.singletonMap(ERROR_OBJECT, throwable));
|
||||||
}
|
}
|
||||||
span.setTag(DDTags.RESOURCE_NAME, "Consumed from " + toResourceName(message, null));
|
span.setTag(DDTags.RESOURCE_NAME, "Consumed from " + toResourceName(message, null));
|
||||||
scope.close();
|
scope.close();
|
||||||
|
|
|
@ -2,6 +2,7 @@ package datadog.trace.instrumentation.jms2;
|
||||||
|
|
||||||
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
|
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
|
||||||
import static datadog.trace.instrumentation.jms.util.JmsUtil.toResourceName;
|
import static datadog.trace.instrumentation.jms.util.JmsUtil.toResourceName;
|
||||||
|
import static io.opentracing.log.Fields.ERROR_OBJECT;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
||||||
|
@ -80,7 +81,7 @@ public final class JMS2MessageListenerInstrumentation extends Instrumenter.Confi
|
||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
final Span span = scope.span();
|
final Span span = scope.span();
|
||||||
Tags.ERROR.set(span, Boolean.TRUE);
|
Tags.ERROR.set(span, Boolean.TRUE);
|
||||||
span.log(Collections.singletonMap("error.object", throwable));
|
span.log(Collections.singletonMap(ERROR_OBJECT, throwable));
|
||||||
}
|
}
|
||||||
scope.close();
|
scope.close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package datadog.trace.instrumentation.jms2;
|
||||||
|
|
||||||
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
|
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
|
||||||
import static datadog.trace.instrumentation.jms.util.JmsUtil.toResourceName;
|
import static datadog.trace.instrumentation.jms.util.JmsUtil.toResourceName;
|
||||||
|
import static io.opentracing.log.Fields.ERROR_OBJECT;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
||||||
|
@ -95,7 +96,7 @@ public final class JMS2MessageProducerInstrumentation extends Instrumenter.Confi
|
||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
final Span span = scope.span();
|
final Span span = scope.span();
|
||||||
Tags.ERROR.set(span, Boolean.TRUE);
|
Tags.ERROR.set(span, Boolean.TRUE);
|
||||||
span.log(Collections.singletonMap("error.object", throwable));
|
span.log(Collections.singletonMap(ERROR_OBJECT, throwable));
|
||||||
}
|
}
|
||||||
scope.close();
|
scope.close();
|
||||||
}
|
}
|
||||||
|
@ -134,7 +135,7 @@ public final class JMS2MessageProducerInstrumentation extends Instrumenter.Confi
|
||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
final Span span = scope.span();
|
final Span span = scope.span();
|
||||||
Tags.ERROR.set(span, Boolean.TRUE);
|
Tags.ERROR.set(span, Boolean.TRUE);
|
||||||
span.log(Collections.singletonMap("error.object", throwable));
|
span.log(Collections.singletonMap(ERROR_OBJECT, throwable));
|
||||||
}
|
}
|
||||||
scope.close();
|
scope.close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package datadog.trace.instrumentation.kafka_clients;
|
package datadog.trace.instrumentation.kafka_clients;
|
||||||
|
|
||||||
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
|
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
|
||||||
|
import static io.opentracing.log.Fields.ERROR_OBJECT;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
|
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||||
|
@ -120,7 +121,7 @@ public final class KafkaProducerInstrumentation extends Instrumenter.Configurabl
|
||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
final Span span = scope.span();
|
final Span span = scope.span();
|
||||||
Tags.ERROR.set(span, true);
|
Tags.ERROR.set(span, true);
|
||||||
span.log(Collections.singletonMap("error.object", throwable));
|
span.log(Collections.singletonMap(ERROR_OBJECT, throwable));
|
||||||
span.finish();
|
span.finish();
|
||||||
}
|
}
|
||||||
scope.close();
|
scope.close();
|
||||||
|
@ -140,7 +141,7 @@ public final class KafkaProducerInstrumentation extends Instrumenter.Configurabl
|
||||||
public void onCompletion(final RecordMetadata metadata, final Exception exception) {
|
public void onCompletion(final RecordMetadata metadata, final Exception exception) {
|
||||||
if (exception != null) {
|
if (exception != null) {
|
||||||
Tags.ERROR.set(scope.span(), Boolean.TRUE);
|
Tags.ERROR.set(scope.span(), Boolean.TRUE);
|
||||||
scope.span().log(Collections.singletonMap("error.object", exception));
|
scope.span().log(Collections.singletonMap(ERROR_OBJECT, exception));
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package datadog.trace.instrumentation.kafka_streams;
|
package datadog.trace.instrumentation.kafka_streams;
|
||||||
|
|
||||||
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
|
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
|
||||||
|
import static io.opentracing.log.Fields.ERROR_OBJECT;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
|
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isPackagePrivate;
|
import static net.bytebuddy.matcher.ElementMatchers.isPackagePrivate;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
||||||
|
@ -134,7 +135,7 @@ public class KafkaStreamsProcessorInstrumentation {
|
||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
final Span span = scope.span();
|
final Span span = scope.span();
|
||||||
Tags.ERROR.set(span, Boolean.TRUE);
|
Tags.ERROR.set(span, Boolean.TRUE);
|
||||||
span.log(Collections.singletonMap("error.object", throwable));
|
span.log(Collections.singletonMap(ERROR_OBJECT, throwable));
|
||||||
}
|
}
|
||||||
scope.close();
|
scope.close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package datadog.trace.instrumentation.mongo;
|
package datadog.trace.instrumentation.mongo;
|
||||||
|
|
||||||
|
import static io.opentracing.log.Fields.ERROR_OBJECT;
|
||||||
|
|
||||||
import com.mongodb.event.CommandFailedEvent;
|
import com.mongodb.event.CommandFailedEvent;
|
||||||
import com.mongodb.event.CommandListener;
|
import com.mongodb.event.CommandListener;
|
||||||
import com.mongodb.event.CommandStartedEvent;
|
import com.mongodb.event.CommandStartedEvent;
|
||||||
|
@ -39,36 +41,36 @@ public class DDTracingCommandListener implements CommandListener {
|
||||||
/** requestID -> span */
|
/** requestID -> span */
|
||||||
private final Map<Integer, Span> cache = new ConcurrentHashMap<>();
|
private final Map<Integer, Span> cache = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public DDTracingCommandListener(Tracer tracer) {
|
public DDTracingCommandListener(final Tracer tracer) {
|
||||||
this.tracer = tracer;
|
this.tracer = tracer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void commandStarted(CommandStartedEvent event) {
|
public void commandStarted(final CommandStartedEvent event) {
|
||||||
Span span = buildSpan(event);
|
final Span span = buildSpan(event);
|
||||||
cache.put(event.getRequestId(), span);
|
cache.put(event.getRequestId(), span);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void commandSucceeded(CommandSucceededEvent event) {
|
public void commandSucceeded(final CommandSucceededEvent event) {
|
||||||
Span span = cache.remove(event.getRequestId());
|
final Span span = cache.remove(event.getRequestId());
|
||||||
if (span != null) {
|
if (span != null) {
|
||||||
span.finish();
|
span.finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void commandFailed(CommandFailedEvent event) {
|
public void commandFailed(final CommandFailedEvent event) {
|
||||||
Span span = cache.remove(event.getRequestId());
|
final Span span = cache.remove(event.getRequestId());
|
||||||
if (span != null) {
|
if (span != null) {
|
||||||
Tags.ERROR.set(span, Boolean.TRUE);
|
Tags.ERROR.set(span, Boolean.TRUE);
|
||||||
span.log(Collections.singletonMap("error.object", event.getThrowable()));
|
span.log(Collections.singletonMap(ERROR_OBJECT, event.getThrowable()));
|
||||||
span.finish();
|
span.finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Span buildSpan(CommandStartedEvent event) {
|
private Span buildSpan(final CommandStartedEvent event) {
|
||||||
Tracer.SpanBuilder spanBuilder =
|
final Tracer.SpanBuilder spanBuilder =
|
||||||
tracer.buildSpan(MONGO_OPERATION).withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_CLIENT);
|
tracer.buildSpan(MONGO_OPERATION).withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_CLIENT);
|
||||||
|
|
||||||
final Span span = spanBuilder.startManual();
|
final Span span = spanBuilder.startManual();
|
||||||
|
@ -81,7 +83,7 @@ public class DDTracingCommandListener implements CommandListener {
|
||||||
return span;
|
return span;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void decorate(Span span, CommandStartedEvent event) {
|
public static void decorate(final Span span, final CommandStartedEvent event) {
|
||||||
// scrub the Mongo command so that parameters are removed from the string
|
// scrub the Mongo command so that parameters are removed from the string
|
||||||
final BsonDocument scrubbed = scrub(event.getCommand());
|
final BsonDocument scrubbed = scrub(event.getCommand());
|
||||||
final String mongoCmd = scrubbed.toString();
|
final String mongoCmd = scrubbed.toString();
|
||||||
|
@ -92,7 +94,7 @@ public class DDTracingCommandListener implements CommandListener {
|
||||||
|
|
||||||
Tags.PEER_HOSTNAME.set(span, event.getConnectionDescription().getServerAddress().getHost());
|
Tags.PEER_HOSTNAME.set(span, event.getConnectionDescription().getServerAddress().getHost());
|
||||||
|
|
||||||
InetAddress inetAddress =
|
final InetAddress inetAddress =
|
||||||
event.getConnectionDescription().getServerAddress().getSocketAddress().getAddress();
|
event.getConnectionDescription().getServerAddress().getSocketAddress().getAddress();
|
||||||
if (inetAddress instanceof Inet4Address) {
|
if (inetAddress instanceof Inet4Address) {
|
||||||
Tags.PEER_HOST_IPV4.set(span, inetAddress.getHostAddress());
|
Tags.PEER_HOST_IPV4.set(span, inetAddress.getHostAddress());
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package datadog.trace.instrumentation.servlet2;
|
package datadog.trace.instrumentation.servlet2;
|
||||||
|
|
||||||
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
|
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
|
||||||
|
import static io.opentracing.log.Fields.ERROR_OBJECT;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
||||||
|
@ -109,7 +110,7 @@ public final class FilterChain2Instrumentation extends Instrumenter.Configurable
|
||||||
|
|
||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
ServletFilterSpanDecorator.STANDARD_TAGS.onError(req, resp, throwable, span);
|
ServletFilterSpanDecorator.STANDARD_TAGS.onError(req, resp, throwable, span);
|
||||||
span.log(Collections.singletonMap("error.object", throwable));
|
span.log(Collections.singletonMap(ERROR_OBJECT, throwable));
|
||||||
} else {
|
} else {
|
||||||
ServletFilterSpanDecorator.STANDARD_TAGS.onResponse(req, resp, span);
|
ServletFilterSpanDecorator.STANDARD_TAGS.onResponse(req, resp, span);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package datadog.trace.instrumentation.servlet2;
|
package datadog.trace.instrumentation.servlet2;
|
||||||
|
|
||||||
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
|
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
|
||||||
|
import static io.opentracing.log.Fields.ERROR_OBJECT;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isProtected;
|
import static net.bytebuddy.matcher.ElementMatchers.isProtected;
|
||||||
|
@ -109,7 +110,7 @@ public final class HttpServlet2Instrumentation extends Instrumenter.Configurable
|
||||||
|
|
||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
ServletFilterSpanDecorator.STANDARD_TAGS.onError(req, resp, throwable, span);
|
ServletFilterSpanDecorator.STANDARD_TAGS.onError(req, resp, throwable, span);
|
||||||
span.log(Collections.singletonMap("error.object", throwable));
|
span.log(Collections.singletonMap(ERROR_OBJECT, throwable));
|
||||||
} else {
|
} else {
|
||||||
ServletFilterSpanDecorator.STANDARD_TAGS.onResponse(req, resp, span);
|
ServletFilterSpanDecorator.STANDARD_TAGS.onResponse(req, resp, span);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package datadog.trace.instrumentation.servlet3;
|
package datadog.trace.instrumentation.servlet3;
|
||||||
|
|
||||||
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
|
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
|
||||||
|
import static io.opentracing.log.Fields.ERROR_OBJECT;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
||||||
|
@ -110,7 +111,7 @@ public final class FilterChain3Instrumentation extends Instrumenter.Configurable
|
||||||
|
|
||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
ServletFilterSpanDecorator.STANDARD_TAGS.onError(req, resp, throwable, span);
|
ServletFilterSpanDecorator.STANDARD_TAGS.onError(req, resp, throwable, span);
|
||||||
span.log(Collections.singletonMap("error.object", throwable));
|
span.log(Collections.singletonMap(ERROR_OBJECT, throwable));
|
||||||
scope.close();
|
scope.close();
|
||||||
scope.span().finish(); // Finish the span manually since finishSpanOnClose was false
|
scope.span().finish(); // Finish the span manually since finishSpanOnClose was false
|
||||||
} else if (req.isAsyncStarted()) {
|
} else if (req.isAsyncStarted()) {
|
||||||
|
@ -169,7 +170,7 @@ public final class FilterChain3Instrumentation extends Instrumenter.Configurable
|
||||||
(HttpServletResponse) event.getSuppliedResponse(),
|
(HttpServletResponse) event.getSuppliedResponse(),
|
||||||
event.getThrowable(),
|
event.getThrowable(),
|
||||||
span);
|
span);
|
||||||
span.log(Collections.singletonMap("error.object", event.getThrowable()));
|
span.log(Collections.singletonMap(ERROR_OBJECT, event.getThrowable()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package datadog.trace.instrumentation.servlet3;
|
package datadog.trace.instrumentation.servlet3;
|
||||||
|
|
||||||
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
|
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
|
||||||
|
import static io.opentracing.log.Fields.ERROR_OBJECT;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isProtected;
|
import static net.bytebuddy.matcher.ElementMatchers.isProtected;
|
||||||
|
@ -102,7 +103,7 @@ public final class HttpServlet3Instrumentation extends Instrumenter.Configurable
|
||||||
final Span span = scope.span();
|
final Span span = scope.span();
|
||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
ServletFilterSpanDecorator.STANDARD_TAGS.onError(req, resp, throwable, span);
|
ServletFilterSpanDecorator.STANDARD_TAGS.onError(req, resp, throwable, span);
|
||||||
span.log(Collections.singletonMap("error.object", throwable));
|
span.log(Collections.singletonMap(ERROR_OBJECT, throwable));
|
||||||
scope.close();
|
scope.close();
|
||||||
scope.span().finish(); // Finish the span manually since finishSpanOnClose was false
|
scope.span().finish(); // Finish the span manually since finishSpanOnClose was false
|
||||||
} else if (req.isAsyncStarted()) {
|
} else if (req.isAsyncStarted()) {
|
||||||
|
@ -160,7 +161,7 @@ public final class HttpServlet3Instrumentation extends Instrumenter.Configurable
|
||||||
(HttpServletResponse) event.getSuppliedResponse(),
|
(HttpServletResponse) event.getSuppliedResponse(),
|
||||||
event.getThrowable(),
|
event.getThrowable(),
|
||||||
span);
|
span);
|
||||||
span.log(Collections.singletonMap("error.object", event.getThrowable()));
|
span.log(Collections.singletonMap(ERROR_OBJECT, event.getThrowable()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package datadog.trace.instrumentation.trace_annotation;
|
package datadog.trace.instrumentation.trace_annotation;
|
||||||
|
|
||||||
|
import static io.opentracing.log.Fields.ERROR_OBJECT;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.declaresMethod;
|
import static net.bytebuddy.matcher.ElementMatchers.declaresMethod;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isAnnotatedWith;
|
import static net.bytebuddy.matcher.ElementMatchers.isAnnotatedWith;
|
||||||
|
@ -52,7 +53,7 @@ public final class TraceAnnotationInstrumentation extends Instrumenter.Configura
|
||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
final Span span = scope.span();
|
final Span span = scope.span();
|
||||||
Tags.ERROR.set(span, true);
|
Tags.ERROR.set(span, true);
|
||||||
span.log(Collections.singletonMap("error.object", throwable));
|
span.log(Collections.singletonMap(ERROR_OBJECT, throwable));
|
||||||
}
|
}
|
||||||
scope.close();
|
scope.close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,7 +125,7 @@ Errors are manually captured in a span by setting the error flag and logging the
|
||||||
// capture error
|
// capture error
|
||||||
ActiveSpan span = GlobalTracer.get().activeSpan();
|
ActiveSpan span = GlobalTracer.get().activeSpan();
|
||||||
Tags.ERROR.set(span, Boolean.TRUE);
|
Tags.ERROR.set(span, Boolean.TRUE);
|
||||||
span.log(Collections.singletonMap("error.object", e));
|
span.log(Collections.singletonMap(io.opentracing.log.Fields.ERROR_OBJECT, e));
|
||||||
|
|
||||||
// recovery code
|
// recovery code
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package datadog.opentracing;
|
package datadog.opentracing;
|
||||||
|
|
||||||
|
import static io.opentracing.log.Fields.ERROR_OBJECT;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonGetter;
|
import com.fasterxml.jackson.annotation.JsonGetter;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
@ -121,8 +123,8 @@ public class DDSpan implements Span {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean extractError(final Map<String, ?> map) {
|
private boolean extractError(final Map<String, ?> map) {
|
||||||
if (map.get("error.object") instanceof Throwable) {
|
if (map.get(ERROR_OBJECT) instanceof Throwable) {
|
||||||
final Throwable error = (Throwable) map.get("error.object");
|
final Throwable error = (Throwable) map.get(ERROR_OBJECT);
|
||||||
setErrorMeta(error);
|
setErrorMeta(error);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -245,7 +247,7 @@ public class DDSpan implements Span {
|
||||||
*
|
*
|
||||||
* <p>Has no effect if the span priority has been propagated (injected or extracted).
|
* <p>Has no effect if the span priority has been propagated (injected or extracted).
|
||||||
*/
|
*/
|
||||||
public final DDSpan setSamplingPriority(int newPriority) {
|
public final DDSpan setSamplingPriority(final int newPriority) {
|
||||||
this.context().setSamplingPriority(newPriority);
|
this.context().setSamplingPriority(newPriority);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue