Skip to content

Commit

Permalink
Merge branch 'main' into dvic-child-span-sampling
Browse files Browse the repository at this point in the history
  • Loading branch information
tsloughter authored Aug 10, 2021
2 parents 0c6451c + c24b67c commit bfdae7f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
9 changes: 6 additions & 3 deletions apps/opentelemetry_exporter/src/opentelemetry_exporter.erl
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ shutdown(#state{channel_pid=Pid}) ->
%%

grpcbox_endpoints(Endpoints) ->
[{scheme(Scheme), Host, Port, []} || #{scheme := Scheme, host := Host, port := Port} <- Endpoints].
[{scheme(Scheme), Host, Port, maps:get(ssl_options, Endpoint, [])} ||
#{scheme := Scheme, host := Host, port := Port} = Endpoint <- Endpoints].

headers_to_grpc_metadata(Headers) ->
lists:foldl(fun({X, Y}, Acc) ->
Expand Down Expand Up @@ -186,6 +187,8 @@ endpoint(Endpoint) ->
Parsed
end.

parse_endpoint({Scheme, Host, Port, SSLOptions}) when is_list(SSLOptions) ->
{true, #{scheme => atom_to_list(Scheme), host => Host, port => Port, path => [], ssl_options => SSLOptions}};
parse_endpoint({Scheme, Host, Port, _}) ->
{true, #{scheme => atom_to_list(Scheme), host => Host, port => Port, path => []}};
parse_endpoint(Endpoint=#{host := _Host, port := _Port, scheme := _Scheme, path := _Path}) ->
Expand Down Expand Up @@ -243,8 +246,8 @@ endpoints_append_path(E) when is_list(E) ->
endpoints_append_path(E) ->
[append_path(E)].

append_path({Scheme, Host, Port, _}) ->
#{scheme => atom_to_list(Scheme), host => Host, port => Port, path => "/v1/traces"};
append_path({Scheme, Host, Port, SSLOptions}) ->
#{scheme => atom_to_list(Scheme), host => Host, port => Port, path => "/v1/traces", ssl_options => SSLOptions};
append_path(Endpoint=#{path := Path}) ->
Endpoint#{path => filename:join(Path, ?DEFAULT_TRACES_PATH)};
append_path(EndpointString) when is_list(EndpointString) orelse is_binary(EndpointString) ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,14 @@ configuration(_Config) ->
try
?assertMatch(#{endpoints :=
[#{scheme := "http", host := "localhost",
port := 9090, path := "/v1/traces"}]},
port := 9090, path := "/v1/traces", ssl_options := []}]},
opentelemetry_exporter:merge_with_environment(#{endpoints => [{http, "localhost", 9090, []}]})),

?assertMatch(#{endpoints :=
[#{scheme := "http", host := "localhost",
port := 9090, path := "/v1/traces", ssl_options := [{verify, verify_none}]}]},
opentelemetry_exporter:merge_with_environment(#{endpoints => [{http, "localhost", 9090, [{verify, verify_none}]}]})),

?assertMatch([#{scheme := "http", host := "localhost", port := 443, path := []}],
opentelemetry_exporter:endpoints(["http://localhost:443"])),

Expand Down

0 comments on commit bfdae7f

Please sign in to comment.