Skip to content

Commit

Permalink
add to metadata test case with k/v property
Browse files Browse the repository at this point in the history
  • Loading branch information
tsloughter committed Mar 29, 2021
1 parent b5088e7 commit 8ce95b9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions apps/opentelemetry/test/opentelemetry_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ propagation(Config) ->
otel_baggage:set(<<"key-1">>, <<"value=1">>, []),
%% TODO: should the whole baggage entry be dropped if metadata is bad?
%% drop bad metadata (the `1').
otel_baggage:set(<<"key-2">>, <<"value-2">>, [<<"metadata">>, 1]),
otel_baggage:set(<<"key-2">>, <<"value-2">>, [<<"metadata">>, 1, {<<"md-k-1">>, <<"md-v-1">>}]),
%% drop baggage with bad value
otel_baggage:set(<<"key-3">>, value3),

Expand All @@ -227,14 +227,14 @@ propagation(Config) ->
EncodedTraceId = io_lib:format("~32.16.0b", [TraceId]),
EncodedSpanId = io_lib:format("~16.16.0b", [SpanId]),

?assertListsEqual([{<<"baggage">>, <<"key-2=value-2;metadata,key-1=value%3D1">>},
?assertListsEqual([{<<"baggage">>, <<"key-2=value-2;metadata;md-k-1=md-v-1,key-1=value%3D1">>},
{<<"existing-header">>, <<"I exist">>} |
trace_context(Propagator, EncodedTraceId, EncodedSpanId)], Headers),

?end_span(SpanCtx),

?assertEqual(#{<<"key-1">> => {<<"value=1">>, []},
<<"key-2">> => {<<"value-2">>, [<<"metadata">>]}}, otel_baggage:get_all()),
<<"key-2">> => {<<"value-2">>, [<<"metadata">>, {<<"md-k-1">>, <<"md-v-1">>}]}}, otel_baggage:get_all()),

%% ?end_span doesn't remove the span from the context
?assertEqual(SpanCtx, ?current_span_ctx),
Expand All @@ -250,7 +250,7 @@ propagation(Config) ->
otel_propagator:text_map_extract(BinaryHeaders),

?assertEqual(#{<<"key-1">> => {<<"value=1">>, []},
<<"key-2">> => {<<"value-2">>, [<<"metadata">>]}}, otel_baggage:get_all()),
<<"key-2">> => {<<"value-2">>, [<<"metadata">>, {<<"md-k-1">>, <<"md-v-1">>}]}}, otel_baggage:get_all()),

%% extracted remote spans are set to the active span
%% but with `is_recording' false
Expand Down

0 comments on commit 8ce95b9

Please sign in to comment.