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