Capture error message even if no exception object provided.
This is currently only used by the GoogleHttpClient instrumentation, but may be used by customers too.
This commit is contained in:
parent
b3f15ca133
commit
31b77cbd7b
|
@ -4,6 +4,7 @@ import com.google.api.client.http.HttpResponse
|
|||
import com.google.api.client.http.javanet.NetHttpTransport
|
||||
import datadog.trace.agent.test.base.HttpClientTest
|
||||
import datadog.trace.api.DDSpanTypes
|
||||
import datadog.trace.api.DDTags
|
||||
import datadog.trace.instrumentation.api.Tags
|
||||
import datadog.trace.instrumentation.googlehttpclient.GoogleHttpClientDecorator
|
||||
import spock.lang.Shared
|
||||
|
@ -69,6 +70,7 @@ abstract class AbstractGoogleHttpClientTest extends HttpClientTest<GoogleHttpCli
|
|||
"$Tags.HTTP_METHOD" String
|
||||
"$Tags.HTTP_STATUS" Integer
|
||||
"$Tags.ERROR" true
|
||||
"$DDTags.ERROR_MSG" "Server Error"
|
||||
defaultTags()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package datadog.opentracing;
|
||||
|
||||
import static io.opentracing.log.Fields.ERROR_OBJECT;
|
||||
import static io.opentracing.log.Fields.MESSAGE;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonGetter;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
@ -153,6 +154,9 @@ public class DDSpan implements Span, MutableSpan {
|
|||
final Throwable error = (Throwable) map.get(ERROR_OBJECT);
|
||||
setErrorMeta(error);
|
||||
return true;
|
||||
} else if (map.get(MESSAGE) instanceof String) {
|
||||
setTag(DDTags.ERROR_MSG, (String) map.get(MESSAGE));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue