Merge pull request #658 from DataDog/tyler/jackson-upgrade
Upgrade jackson to 2.9.8
This commit is contained in:
commit
9a6f10f9a3
|
@ -45,6 +45,10 @@ dependencies {
|
|||
testCompile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.11.0'
|
||||
testCompile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.11.0'
|
||||
|
||||
testCompile group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-smile', version: versions.jackson
|
||||
// ^ is needed because we are using a newer version of jackson that isn't compatible without this.
|
||||
|
||||
|
||||
latestDepTestCompile group: 'org.elasticsearch', name: 'elasticsearch', version: '2.4.6'
|
||||
latestDepTestCompile group: 'org.springframework.data', name: 'spring-data-elasticsearch', version: '2.1.15.RELEASE'
|
||||
}
|
||||
|
|
|
@ -31,9 +31,7 @@ dependencies {
|
|||
|
||||
compile deps.jackson
|
||||
compile deps.slf4j
|
||||
// any higher versions seems to break ES tests with this exception:
|
||||
// java.lang.NoSuchMethodError: com.fasterxml.jackson.dataformat.smile.SmileGenerator.getOutputContext()
|
||||
compile group: 'org.msgpack', name: 'jackson-dataformat-msgpack', version: '0.8.14'
|
||||
compile group: 'org.msgpack', name: 'jackson-dataformat-msgpack', version: '0.8.16'
|
||||
|
||||
// We have autoservices defined in test subtree, looks like we need this to be able to properly rebuild this
|
||||
testAnnotationProcessor deps.autoservice
|
||||
|
|
|
@ -3,11 +3,13 @@ package datadog.trace.tracer
|
|||
import com.fasterxml.jackson.annotation.JsonCreator
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import groovy.transform.EqualsAndHashCode
|
||||
import groovy.transform.ToString
|
||||
|
||||
/**
|
||||
* Helper class to parse serialized span to verify serialization logic
|
||||
*/
|
||||
@EqualsAndHashCode
|
||||
@ToString
|
||||
class JsonSpan {
|
||||
@JsonProperty("trace_id")
|
||||
BigInteger traceId
|
||||
|
@ -31,7 +33,9 @@ class JsonSpan {
|
|||
String name
|
||||
|
||||
@JsonProperty("error")
|
||||
boolean error
|
||||
// Somehow MsgPack formatter can not convert number to boolean with newer jackson so we have to do this manually
|
||||
//@JsonFormat(shape = JsonFormat.Shape.NUMBER)
|
||||
int error
|
||||
|
||||
@JsonProperty("meta")
|
||||
Map<String, String> meta
|
||||
|
@ -52,7 +56,7 @@ class JsonSpan {
|
|||
type = span.getType()
|
||||
name = span.getName()
|
||||
|
||||
error = span.isErrored()
|
||||
error = span.isErrored() ? 1 : 0
|
||||
|
||||
meta = span.getMeta()
|
||||
}
|
||||
|
|
|
@ -72,6 +72,7 @@ class AgentClientTest extends Specification {
|
|||
response.getRate("another test") == 0.2d
|
||||
response.getRate("doesn't exist") == null
|
||||
and: "request got expected parameters"
|
||||
byte[] requestBody = null
|
||||
verify(putRequestedFor(urlEqualTo(AgentClient.TRACES_ENDPOINT))
|
||||
.withHeader(AgentClient.CONTENT_TYPE, equalTo(AgentClient.MSGPACK))
|
||||
.withHeader(AgentClient.DATADOG_META_LANG, equalTo("java"))
|
||||
|
@ -81,9 +82,12 @@ class AgentClientTest extends Specification {
|
|||
// .withHeader(AgentClient.DATADOG_META_TRACER_VERSION, equalTo("java"))
|
||||
.withHeader(AgentClient.X_DATADOG_TRACE_COUNT, equalTo(Integer.toString(TRACE_COUNT)))
|
||||
.andMatching({ Request request ->
|
||||
// Note: it is hard to see what's wrong when this fails... is there a better way?
|
||||
MatchResult.of(objectMapper.readValue(request.getBody(), new TypeReference<List<List<JsonSpan>>>() {}) == traces.collect {it.getSpans().collect {new JsonSpan(it)}})
|
||||
requestBody = request.getBody()
|
||||
MatchResult.of(true)
|
||||
}))
|
||||
objectMapper.readValue(requestBody, new TypeReference<List<List<JsonSpan>>>() {}) == traces.collect {
|
||||
it.getSpans().collect { new JsonSpan(it) }
|
||||
}
|
||||
}
|
||||
|
||||
def "test send empty list"() {
|
||||
|
|
|
@ -7,8 +7,7 @@ ext {
|
|||
|
||||
slf4j : "1.7.25",
|
||||
guava : "20.0", // Last version to support Java 7
|
||||
jackson : "2.6.3", // This is a transitive dependency for the tracer.
|
||||
// Use an old version to not force an upgrade for others using tracer as a dependency.
|
||||
jackson : "2.9.8", // https://nvd.nist.gov/vuln/detail/CVE-2018-1000873
|
||||
|
||||
spock : "1.2-groovy-$spockGroovyVer",
|
||||
groovy : groovyVer,
|
||||
|
|
Loading…
Reference in New Issue