调试hackney请求

时间:2019-05-07 16:03:05

标签: erlang elixir

因此,在Elixir / Phoenix应用程序的iex远程控制台外壳程序中(我的操作仅在远程控制台外壳程序中),我正在执行Logger.info "debug message"之类的操作,它具有第三方记录服务。调用Logger#info / 1后,控制台中始终出现如下错误:

    iex server-xxx 3> :gen_event handler Timber.LoggerBackends.HTTP installed in Logger terminating
** (exit) an exception was raised:
    ** (ArgumentError) argument error
        (stdlib) :ets.lookup_element(:hackney_config, :mod_metrics, 2)
        (hackney) /root/project/deps/hackney/src/hackney_metrics.erl:27: :hackney_metrics.get_engine/0
        (hackney) /root/project/deps/hackney/src/hackney_connect.erl:78: :hackney_connect.create_connection/5
        (hackney) /root/project/deps/hackney/src/hackney_connect.erl:47: :hackney_connect.connect/5
        (hackney) /root/project/deps/hackney/src/hackney.erl:330: :hackney.request/5
        (timber) lib/timber/logger_backends/http.ex:396: Timber.LoggerBackends.HTTP.transmit_buffer/2
        (timber) lib/timber/logger_backends/http.ex:211: Timber.LoggerBackends.HTTP.handle_info/2
        (stdlib) gen_event.erl:577: :gen_event.server_update/4

我将其追溯到对hackney(这是Erlang,我不太了解)的请求:

 :hackney.request(method, url, req_headers, body, req_opts)

结束

以下是我处理过的带有经过身份验证的auth令牌(从远程调试会话中剔除)的参数:

    < _req_headers@1 = [{<<"Authorization">>,
                     <<"Basic MXXXXAUTH">>},
                    {<<"Content-Type">>,<<"application/msgpack">>},
                    {<<"User-Agent">>,<<"timber-elixir/">>}]
< _req_opts@1 = [{connect_timeout,5000},{recv_timeout,10000},{async,true}]
< _method@1 = post
< _headers@1 = #{<<"Authorization">> =>
                     <<"Basic MXXXXAUTH">>,
                 <<"Content-Type">> => <<"application/msgpack">>,
                 <<"User-Agent">> => <<"timber-elixir/">>}
< _url@1 = <<"https://logs.timber.io/frames">>
< _method@1 = post
< _headers@1 = #{<<"Authorization">> =>
                     <<"Basic MXXXXAUTH">>,
                 <<"Content-Type">> => <<"application/msgpack">>,
                 <<"User-Agent">> => <<"timber-elixir/">>}
< _body@1 = [145,
             [133,
              [[167|<<"context">>],
               130,
               [[167|<<"runtime">>],
                134,
                [[171|<<"application">>],192],
                [[164|<<"file">>],163|<<"iex">>],
                [[168|<<"function">>],192],
                [[164|<<"line">>],23],
                [[171|<<"module_name">>],192],
                [[166|<<"vm_pid">>],169|<<"<0.346.0>">>]],
               [[166|<<"system">>],
                130,
                [[168|<<"hostname">>],192],
                [[163|<<"pid">>]|<<"꼐">>]]],
              [[162|<<"dt">>],187|<<"2019-05-07T15:52:04.393107Z">>],
              [[165|<<"event">>],192],
              [[165|<<"level">>],164|<<"info">>],
              [[167|<<"message">>],166|<<"help 7">>]]]
< _req_headers@1 = [{<<"Authorization">>,
                     <<"Basic MXXXXAUTH">>},
                    {<<"Content-Type">>,<<"application/msgpack">>},
                    {<<"User-Agent">>,<<"timber-elixir/">>}]
< _body@1 = [145,
             [133,
              [[167|<<"context">>],
               130,
               [[167|<<"runtime">>],
                134,
                [[171|<<"application">>],192],
                [[164|<<"file">>],163|<<"iex">>],
                [[168|<<"function">>],192],
                [[164|<<"line">>],23],
                [[171|<<"module_name">>],192],
                [[166|<<"vm_pid">>],169|<<"<0.346.0>">>]],
               [[166|<<"system">>],
                130,
                [[168|<<"hostname">>],192],
                [[163|<<"pid">>]|<<"꼐">>]]],
              [[162|<<"dt">>],187|<<"2019-05-06T12:52:04.393107Z">>],
              [[165|<<"event">>],192],
              [[165|<<"level">>],164|<<"info">>],
              [[167|<<"message">>],166|<<"debug message">>]]]
< _req_headers@1 = [{<<"Authorization">>,
                     <<"Basic MXXXXAUTH">>},
                    {<<"Content-Type">>,<<"application/msgpack">>},
                    {<<"User-Agent">>,<<"timber-elixir/">>}]
< _req_opts@1 = [{connect_timeout,5000},{recv_timeout,10000},{async,true}]
< _req_opts@1 = [{connect_timeout,5000},{recv_timeout,10000},{async,true}]

如何识别导致问题的“错误论点”?我是Erlang的新手。

0 个答案:

没有答案