filling the SpanContext Pojo

This commit is contained in:
Guillaume Polaert 2017-04-26 09:40:18 +02:00
parent 7ee51d005e
commit 580a0d2b1c
1 changed files with 72 additions and 11 deletions

View File

@ -6,22 +6,83 @@ import java.util.Map;
public class SpanContext implements io.opentracing.SpanContext {
// Public span attributes
private String serviceName;
private String resourceName;
private long spanId;
private long traceId;
private long parentId;
private Map<String, String> baggageItems; // know as 'meta' in dd-trace-py
private boolean errorFlag;
private Map<String, Object> metrics;
private String spanType;
private long start;
private long duration;
private final String serviceName;
private final String resourceName;
private final long traceId;
private final long spanId;
private final long parentId;
private final Map<String, String> baggageItems; // know as 'meta' in dd-trace-py
private final boolean errorFlag;
private final Map<String, Object> metrics;
private final String spanType;
// Sampler attributes
private boolean sampled;
public SpanContext(
long traceId,
long spanId,
long parentId,
String serviceName,
String resourceName,
Map<String, String> baggageItems,
boolean errorFlag,
Map<String, Object> metrics,
String spanType,
boolean sampled) {
this.serviceName = serviceName;
this.resourceName = resourceName;
this.traceId = traceId;
this.spanId = spanId;
this.parentId = parentId;
this.baggageItems = baggageItems;
this.errorFlag = errorFlag;
this.metrics = metrics;
this.spanType = spanType;
this.sampled = sampled;
}
public Iterable<Map.Entry<String, String>> baggageItems() {
return null;
}
public long getTraceId() {
return this.traceId;
}
public long getParentId() {
return this.parentId;
}
public long getSpanId() {
return this.spanId;
}
public String getServiceName() {
return serviceName;
}
public String getResourceName() {
return resourceName;
}
public boolean isErrorFlag() {
return errorFlag;
}
public Map<String, Object> getMetrics() {
return metrics;
}
public String getSpanType() {
return spanType;
}
public boolean isSampled() {
return sampled;
}
}