Skip to content
Permalink
Browse files
ensure id is converted to long when required
  • Loading branch information
rmannibucau committed May 21, 2018
1 parent 4566c59 commit 77266fe6a438ceda4784ad57ae196b3b07038b2b
Showing 1 changed file with 13 additions and 3 deletions.
@@ -63,9 +63,9 @@ public void onSpan(@Observes final FinishedSpan finishedSpan) {

private ZipkinSpan toZipkin(final SpanImpl span) {
final ZipkinSpan zipkin = new ZipkinSpan();
zipkin.setParentId(Long.class.cast(span.getParentId()));
zipkin.setTraceId(Long.class.cast(span.getTraceId()));
zipkin.setId(Long.class.cast(span.getId()));
zipkin.setParentId(asLong(span.getParentId()));
zipkin.setTraceId(asLong(span.getTraceId()));
zipkin.setId(asLong(span.getId()));
zipkin.setName(span.getName());
zipkin.setKind(ofNullable(span.getKind()).map(s -> s.toUpperCase(ROOT)).orElse(null));
zipkin.setTimestamp(span.getTimestamp());
@@ -79,6 +79,16 @@ private ZipkinSpan toZipkin(final SpanImpl span) {
return zipkin;
}

private long asLong(final Object value) {
if (value == null) {
return 0;
}
if (Long.class.isInstance(value)) {
return Long.class.cast(value);
}
return Long.valueOf(String.valueOf(value));
}

private ZipkinSpan.ZipkinEndpoint toEndpoint(final SpanImpl span) {
final Map<String, Object> tags = span.getTags();
switch (String.valueOf(tags.get(Tags.SPAN_KIND.getKey()))) {

0 comments on commit 77266fe

Please sign in to comment.