Skip to content

Commit

Permalink
Merge pull request #193 from tsloughter/exporter-fail
Browse files Browse the repository at this point in the history
handle grpcbox failure in exporter and fallback to http
  • Loading branch information
tsloughter authored Feb 11, 2021
2 parents 3186a3c + b6d30e5 commit 3995f77
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
18 changes: 13 additions & 5 deletions apps/opentelemetry_exporter/src/opentelemetry_exporter.erl
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,19 @@ init(Opts) ->
grpc ->
Endpoints = maps:get(endpoints, Opts, ?DEFAULT_ENDPOINTS),
ChannelOpts = maps:get(channel_opts, Opts, #{}),
{ok, ChannelPid} = grpcbox_channel:start_link(?MODULE, Endpoints, ChannelOpts),

{ok, #state{channel_pid=ChannelPid,
endpoints=Endpoints,
protocol=grpc}};
case grpcbox_channel:start_link(?MODULE, Endpoints, ChannelOpts) of
{ok, ChannelPid} ->
{ok, #state{channel_pid=ChannelPid,
endpoints=Endpoints,
protocol=grpc}};
ErrorOrIgnore ->
%% even if it is `ignore' we should just use `http_protobuf' because
%% `ignore' should never happen and means something is wrong
?LOG_WARNING("unable to start grpc channel for exporting and falling back "
"to http_protobuf protocol. reason=~p", [ErrorOrIgnore]),
{ok, #state{endpoints=Endpoints,
protocol=http_protobuf}}
end;
http_protobuf ->
{ok, #state{endpoints=Endpoints,
protocol=http_protobuf}};
Expand Down
6 changes: 3 additions & 3 deletions rebar.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
{<<"chatterbox">>,{pkg,<<"ts_chatterbox">>,<<"0.11.0">>},1},
{<<"ctx">>,{pkg,<<"ctx">>,<<"0.6.0">>},1},
{<<"gproc">>,{pkg,<<"gproc">>,<<"0.8.0">>},1},
{<<"grpcbox">>,{pkg,<<"grpcbox">>,<<"0.13.0">>},0},
{<<"grpcbox">>,{pkg,<<"grpcbox">>,<<"0.13.1">>},0},
{<<"hpack">>,{pkg,<<"hpack_erl">>,<<"0.2.3">>},2}]}.
[
{pkg_hash,[
{<<"acceptor_pool">>, <<"43C20D2ACAE35F0C2BCD64F9D2BDE267E459F0F3FD23DAB26485BF518C281B21">>},
{<<"chatterbox">>, <<"B8F372C706023EB0DE5BF2976764EDB27C70FE67052C88C1F6A66B3A5626847F">>},
{<<"ctx">>, <<"8FF88B70E6400C4DF90142E7F130625B82086077A45364A78D208ED3ED53C7FE">>},
{<<"gproc">>, <<"CEA02C578589C61E5341FCE149EA36CCEF236CC2ECAC8691FBA408E7EA77EC2F">>},
{<<"grpcbox">>, <<"85DD83F45ED8B39A42813D0D01568ECC75B1C7A800B7E04E01532F168C5C29A1">>},
{<<"grpcbox">>, <<"14DCB8D097ED05E43A7C2628E46F71585BA5C5C03FA1C086E7C369A698F038D2">>},
{<<"hpack">>, <<"17670F83FF984AE6CD74B1C456EDDE906D27FF013740EE4D9EFAA4F1BF999633">>}]},
{pkg_hash_ext,[
{<<"acceptor_pool">>, <<"0CBCD83FDC8B9AD2EEE2067EF8B91A14858A5883CB7CD800E6FCD5803E158788">>},
{<<"chatterbox">>, <<"722FE2BAD52913AB7E87D849FC6370375F0C961FFB2F0B5E6D647C9170C382A6">>},
{<<"ctx">>, <<"A14ED2D1B67723DBEBBE423B28D7615EB0BDCBA6FF28F2D1F1B0A7E1D4AA5FC2">>},
{<<"gproc">>, <<"580ADAFA56463B75263EF5A5DF4C86AF321F68694E7786CB057FD805D1E2A7DE">>},
{<<"grpcbox">>, <<"D4FB34D47C1C5F908B76E65C22C74AA001DE316C098512CE9BEB4DFFF60FC68C">>},
{<<"grpcbox">>, <<"F83114A4AE3A09A7AE489816A48EF2CA4AC5D95400ABAB8D3271143D58CB6A75">>},
{<<"hpack">>, <<"06F580167C4B8B8A6429040DF36CC93BBA6D571FAEAEC1B28816523379CBB23A">>}]}
].

0 comments on commit 3995f77

Please sign in to comment.