toString, hashcode, equals
MODIFY
src/main/java/com/datadoghq/trace/impl/DDSpan.java
src/main/java/com/datadoghq/trace/impl/DDSpan.java
@@ -190,4 +190,34 @@ public class DDSpan implements io.opentracing.Span {
public List<Span> getTrace() {
return trace;
}
+
+ @Override
+ public String toString() {
+ return context.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((context == null) ? 0 : context.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ DDSpan other = (DDSpan) obj;
+ if (context == null) {
+ if (other.context != null)
+ return false;
+ } else if (!context.equals(other.context))
+ return false;
+ return true;
+ }
}

MODIFY
src/main/java/com/datadoghq/trace/impl/DDSpanContext.java
src/main/java/com/datadoghq/trace/impl/DDSpanContext.java
@@ -110,4 +110,38 @@ public class DDSpanContext implements io.opentracing.SpanContext {
public Map<String, String> getBaggageItems() {
return baggageItems;
}
+
+
+
+ @Override
+ public String toString() {
+ return "DDSpanContext [traceId=" + traceId
+ + ", spanId=" + spanId
+ + ", parentId=" + parentId +"]";
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (int) (spanId ^ (spanId >>> 32));
+ result = prime * result + (int) (traceId ^ (traceId >>> 32));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ DDSpanContext other = (DDSpanContext) obj;
+ if (spanId != other.spanId)
+ return false;
+ if (traceId != other.traceId)
+ return false;
+ return true;
+ }
}

toString, hashcode, equals