Skip to content

Commit 3995f77

Browse files
authored
Merge pull request #193 from tsloughter/exporter-fail
handle grpcbox failure in exporter and fallback to http
2 parents 3186a3c + b6d30e5 commit 3995f77

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

apps/opentelemetry_exporter/src/opentelemetry_exporter.erl

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,19 @@ init(Opts) ->
2424
grpc ->
2525
Endpoints = maps:get(endpoints, Opts, ?DEFAULT_ENDPOINTS),
2626
ChannelOpts = maps:get(channel_opts, Opts, #{}),
27-
{ok, ChannelPid} = grpcbox_channel:start_link(?MODULE, Endpoints, ChannelOpts),
28-
29-
{ok, #state{channel_pid=ChannelPid,
30-
endpoints=Endpoints,
31-
protocol=grpc}};
27+
case grpcbox_channel:start_link(?MODULE, Endpoints, ChannelOpts) of
28+
{ok, ChannelPid} ->
29+
{ok, #state{channel_pid=ChannelPid,
30+
endpoints=Endpoints,
31+
protocol=grpc}};
32+
ErrorOrIgnore ->
33+
%% even if it is `ignore' we should just use `http_protobuf' because
34+
%% `ignore' should never happen and means something is wrong
35+
?LOG_WARNING("unable to start grpc channel for exporting and falling back "
36+
"to http_protobuf protocol. reason=~p", [ErrorOrIgnore]),
37+
{ok, #state{endpoints=Endpoints,
38+
protocol=http_protobuf}}
39+
end;
3240
http_protobuf ->
3341
{ok, #state{endpoints=Endpoints,
3442
protocol=http_protobuf}};

rebar.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
{<<"chatterbox">>,{pkg,<<"ts_chatterbox">>,<<"0.11.0">>},1},
44
{<<"ctx">>,{pkg,<<"ctx">>,<<"0.6.0">>},1},
55
{<<"gproc">>,{pkg,<<"gproc">>,<<"0.8.0">>},1},
6-
{<<"grpcbox">>,{pkg,<<"grpcbox">>,<<"0.13.0">>},0},
6+
{<<"grpcbox">>,{pkg,<<"grpcbox">>,<<"0.13.1">>},0},
77
{<<"hpack">>,{pkg,<<"hpack_erl">>,<<"0.2.3">>},2}]}.
88
[
99
{pkg_hash,[
1010
{<<"acceptor_pool">>, <<"43C20D2ACAE35F0C2BCD64F9D2BDE267E459F0F3FD23DAB26485BF518C281B21">>},
1111
{<<"chatterbox">>, <<"B8F372C706023EB0DE5BF2976764EDB27C70FE67052C88C1F6A66B3A5626847F">>},
1212
{<<"ctx">>, <<"8FF88B70E6400C4DF90142E7F130625B82086077A45364A78D208ED3ED53C7FE">>},
1313
{<<"gproc">>, <<"CEA02C578589C61E5341FCE149EA36CCEF236CC2ECAC8691FBA408E7EA77EC2F">>},
14-
{<<"grpcbox">>, <<"85DD83F45ED8B39A42813D0D01568ECC75B1C7A800B7E04E01532F168C5C29A1">>},
14+
{<<"grpcbox">>, <<"14DCB8D097ED05E43A7C2628E46F71585BA5C5C03FA1C086E7C369A698F038D2">>},
1515
{<<"hpack">>, <<"17670F83FF984AE6CD74B1C456EDDE906D27FF013740EE4D9EFAA4F1BF999633">>}]},
1616
{pkg_hash_ext,[
1717
{<<"acceptor_pool">>, <<"0CBCD83FDC8B9AD2EEE2067EF8B91A14858A5883CB7CD800E6FCD5803E158788">>},
1818
{<<"chatterbox">>, <<"722FE2BAD52913AB7E87D849FC6370375F0C961FFB2F0B5E6D647C9170C382A6">>},
1919
{<<"ctx">>, <<"A14ED2D1B67723DBEBBE423B28D7615EB0BDCBA6FF28F2D1F1B0A7E1D4AA5FC2">>},
2020
{<<"gproc">>, <<"580ADAFA56463B75263EF5A5DF4C86AF321F68694E7786CB057FD805D1E2A7DE">>},
21-
{<<"grpcbox">>, <<"D4FB34D47C1C5F908B76E65C22C74AA001DE316C098512CE9BEB4DFFF60FC68C">>},
21+
{<<"grpcbox">>, <<"F83114A4AE3A09A7AE489816A48EF2CA4AC5D95400ABAB8D3271143D58CB6A75">>},
2222
{<<"hpack">>, <<"06F580167C4B8B8A6429040DF36CC93BBA6D571FAEAEC1B28816523379CBB23A">>}]}
2323
].

0 commit comments

Comments
 (0)