summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul J. Davis <paul.joseph.davis@gmail.com>2019-11-08 11:12:07 -0600
committerPaul J. Davis <paul.joseph.davis@gmail.com>2019-11-08 11:12:07 -0600
commit891b555974e34405c8505ccee7067111e954599b (patch)
tree126cfcadb77963de01191d20651ae11494988ea4
parenteea36ae715d0b6e654ecfba8655038d964394df5 (diff)
downloadcouchdb-opentracing-davisp.tar.gz
Load commit errors into jaegeropentracing-davisp
-rwxr-xr-xsupport/load-fdb-traces.escript19
1 files changed, 16 insertions, 3 deletions
diff --git a/support/load-fdb-traces.escript b/support/load-fdb-traces.escript
index ab0def1dc..a81f5b6ad 100755
--- a/support/load-fdb-traces.escript
+++ b/support/load-fdb-traces.escript
@@ -8,6 +8,7 @@
-define(ANCESTORS_KEY, passage_span_ancestors).
-define(SPAN_TYPES, [
<<"TransactionTrace_Commit">>,
+ <<"TransactionTrace_CommitError">>,
<<"TransactionTrace_Get">>,
<<"TransactionTrace_GetRange">>,
<<"TransactionTrace_GetVersion">>
@@ -19,7 +20,8 @@
{<<"ValueSizeBytes">>, 'value-size-bytes'},
{<<"RangeSizeBytes">>, 'range-size-bytes'},
{<<"NumMutations">>, 'num-mutations'},
- {<<"CommitSizeBytes">>, 'commit-size-bytes'}
+ {<<"CommitSizeBytes">>, 'commit-size-bytes'},
+ {<<"ErrCode">>, 'error-code'}
]).
@@ -75,7 +77,10 @@ create_span(Type, Props) ->
get_time(Props) ->
{_, EndTimeBin} = lists:keyfind(<<"Time">>, 1, Props),
- {_, LatencyBin} = lists:keyfind(<<"Latency">>, 1, Props),
+ LatencyBin = case lists:keyfind(<<"Latency">>, 1, Props) of
+ {_, LB} -> LB;
+ false -> <<"0.0">>
+ end,
EndTimeFloat = binary_to_float(EndTimeBin),
Latency = binary_to_float(LatencyBin),
{float_to_time(EndTimeFloat - Latency), float_to_time(EndTimeFloat)}.
@@ -99,7 +104,15 @@ get_tags(Props) ->
lists:foldl(fun({BinKey, AtomKey}, Tags) ->
case lists:keyfind(BinKey, 1, Props) of
{_, Value} ->
- Tags#{AtomKey => Value};
+ Tags1 = Tags#{AtomKey => Value},
+ if BinKey /= <<"ErrCode">> -> Tags1; true ->
+ IntCode = binary_to_integer(Value),
+ Reason = erlfdb_nif:get_error(IntCode),
+ Tags1#{
+ error => true,
+ reason => Reason
+ }
+ end;
false ->
Tags
end