Skip to content

Commit 2a3f0ff

Browse files
authored
Fix options handling (#396)
1 parent 8da5a9f commit 2a3f0ff

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

instrumentation/opentelemetry_cowboy/src/opentelemetry_cowboy.erl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,7 @@ setup(Opts) when is_list(Opts) ->
124124
setup(maps:from_list(Opts));
125125
setup(Opts) ->
126126
InitialConfig = maps:merge(default_opts(), Opts),
127-
OptInAttrs = lists:filtermap(fun({Name, OptedIn}) ->
128-
case OptedIn of
129-
true -> {true, Name};
130-
false -> false end
131-
end, maps:get(opt_in_attrs, InitialConfig)),
127+
OptInAttrs = maps:get(opt_in_attrs, InitialConfig),
132128
ReversedClientAddressHeaders = lists:reverse(maps:get(client_address_headers, InitialConfig)),
133129
ReversedSchemeHeaders = lists:reverse(maps:get(scheme_headers, InitialConfig)),
134130
FinalOpts = maps:merge(InitialConfig, #{

instrumentation/opentelemetry_cowboy/test/opentelemetry_cowboy_SUITE.erl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,12 @@ public_endpoint_true_fn(_Req, _Opts) ->
153153
with_all_optins(_Config) ->
154154
Opts = #{
155155
opt_in_attrs => [
156-
{?CLIENT_PORT, true},
157-
{?HTTP_REQUEST_BODY_SIZE, true},
158-
{?HTTP_RESPONSE_BODY_SIZE, true},
159-
{?NETWORK_LOCAL_ADDRESS, true},
160-
{?NETWORK_LOCAL_PORT, true},
161-
{?NETWORK_TRANSPORT, true}
156+
?CLIENT_PORT,
157+
?HTTP_REQUEST_BODY_SIZE,
158+
?HTTP_RESPONSE_BODY_SIZE,
159+
?NETWORK_LOCAL_ADDRESS,
160+
?NETWORK_LOCAL_PORT,
161+
?NETWORK_TRANSPORT
162162
],
163163
request_headers => [<<"test-header">>],
164164
response_headers => [<<"content-type">>]

0 commit comments

Comments
 (0)