Removing SpanSerializer interface
DELETE
src/main/java/com/datadoghq/trace/SpanSerializer.java
-package com.datadoghq.trace;
-
-import io.opentracing.Span;
-
-/**
- * Main interface to serialize/deserialize spans or collection of spans.
- */
-public interface SpanSerializer {
-
- /**
- * Serialize a single span
- *
- * @param the span to serialize
- * @return the serialized object
- * @throws Exception
- */
- String serialize(Span span) throws Exception;
-
- /**
- * A collection of Span to serialize
- *
- * @param spans List or List of list of Spans
- * @return the serialized objects
- * @throws Exception
- */
- String serialize(Object spans) throws Exception;
-
- /**
- * Deserialize a string to convert it in a Span or a Trace
- *
- * @param str the string to deserialize
- * @return A Span or a Trace (List<Span>)
- * @throws Exception
- */
- Object deserialize(String str) throws Exception;
-
-}

MODIFY
src/main/java/com/datadoghq/trace/impl/DDSpanSerializer.java
src/main/java/com/datadoghq/trace/impl/DDSpanSerializer.java
package com.datadoghq.trace.impl;
-import java.util.ArrayList;
-import java.util.List;
-
-import com.datadoghq.trace.SpanSerializer;
import com.datadoghq.trace.writer.impl.DDAgentWriter;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-
import io.opentracing.Span;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* Main DDSpanSerializer: convert spans and traces to proper JSON
*/
-public class DDSpanSerializer implements SpanSerializer {
+public class DDSpanSerializer {
protected final ObjectMapper objectMapper = new ObjectMapper();
/* (non-Javadoc)
- * @see com.datadoghq.trace.SpanSerializer#serialize(io.opentracing.Span)
+ * @see com.datadoghq.trace.DDSpanSerializer#serialize(io.opentracing.Span)
*/
public String serialize(Span span) throws JsonProcessingException {
return objectMapper.writeValueAsString(span);
}
/* (non-Javadoc)
- * @see com.datadoghq.trace.SpanSerializer#serialize(java.lang.Object)
+ * @see com.datadoghq.trace.DDSpanSerializer#serialize(java.lang.Object)
*/
public String serialize(Object spans) throws JsonProcessingException {
return objectMapper.writeValueAsString(spans);
}
/* (non-Javadoc)
- * @see com.datadoghq.trace.SpanSerializer#deserialize(java.lang.String)
+ * @see com.datadoghq.trace.DDSpanSerializer#deserialize(java.lang.String)
*/
public io.opentracing.Span deserialize(String str) throws Exception {
throw new UnsupportedOperationException("Deserialisation of spans is not implemented yet");

MODIFY
src/main/java/com/datadoghq/trace/writer/impl/DDApi.java
src/main/java/com/datadoghq/trace/writer/impl/DDApi.java
@@ -8,9 +8,7 @@ import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.datadoghq.trace.SpanSerializer;
import com.datadoghq.trace.impl.DDSpanSerializer;
-import com.datadoghq.trace.impl.DDTracer;
import io.opentracing.Span;
@@ -32,13 +30,13 @@ public class DDApi {
/**
* The spans serializer: can be replaced. By default, it serialize in JSON.
*/
- protected final SpanSerializer spanSerializer;
+ protected final DDSpanSerializer spanSerializer;
public DDApi(String host, int port) {
this(host, port, new DDSpanSerializer());
}
- public DDApi(String host, int port, SpanSerializer spanSerializer) {
+ public DDApi(String host, int port, DDSpanSerializer spanSerializer) {
super();
this.host = host;
this.port = port;

MODIFY
src/test/java/com/datadoghq/trace/impl/DDSpanTest.java
src/test/java/com/datadoghq/trace/impl/DDSpanTest.java
package com.datadoghq.trace.impl;
-import com.datadoghq.trace.SpanSerializer;
import io.opentracing.Span;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
public class DDSpanTest {

Removing SpanSerializer interface