From 21b6734e2eaaecf03993805d9a68878170e76345 Mon Sep 17 00:00:00 2001 From: oleglite Date: Wed, 28 Nov 2018 15:07:44 +0300 Subject: [PATCH] Add support of 128 bit trace ids --- src/otter_lib_zipkin_thrift.erl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/otter_lib_zipkin_thrift.erl b/src/otter_lib_zipkin_thrift.erl index c5a526e..057d09f 100644 --- a/src/otter_lib_zipkin_thrift.erl +++ b/src/otter_lib_zipkin_thrift.erl @@ -67,8 +67,10 @@ span_to_struct(#span{ timestamp = Timestamp, duration = Duration }, ExtraTags, ServiceDefaults) -> + TraceIdHigh = TraceId bsr 64, + TraceIdLow = TraceId rem (1 bsl 64), [ - {1, i64, TraceId}, + {1, i64, TraceIdLow}, {3, string, otter_lib:to_bin(Name)}, {4, i64, Id} ] ++ @@ -89,7 +91,13 @@ span_to_struct(#span{ }}, {10, i64, Timestamp}, {11, i64, Duration} - ]. + ] ++ + case TraceIdHigh of + 0 -> + []; + TraceIdHigh -> + [{12, i64, TraceIdHigh}] + end. log_to_annotation({Timestamp, Text}, _ServiceDefaults) -> [