Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format stacktrace args properly #3124

Merged
merged 2 commits into from
May 19, 2021
Merged

Conversation

arcusfelis
Copy link
Contributor

This PR addresses ugly stacktraces.
Before:

"stacktrace":"ets:lookup/[prepared_statements,auth_list_users]:0 mongoose_rdbms:query_name_to_string/1:225 mongoose_rdbms:execute_successfully/3:217 ejabberd_auth_rdbms:get_vh_registered_users/2:206 lists:flatmap/2:1250 lists:flatmap/2:1250 rpc:'-handle_call_call/6-fun-0-'/5:197"

After:

"stacktrace_args":"[prepared_statements,auth_list_users]",
"stacktrace":"ets:lookup/2:0 mongoose_rdbms:query_name_to_string/1:225 mongoose_rdbms:execute_successfully/3:217 ejabberd_auth_rdbms:get_vh_registered_users/2:206 lists:flatmap/2:1250 lists:flatmap/2:1250 rpc:'-handle_call_call/6-fun-0-'/5:197"

@codecov
Copy link

codecov bot commented May 18, 2021

Codecov Report

Merging #3124 (e58ce81) into master (8c597bc) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3124      +/-   ##
==========================================
- Coverage   79.22%   79.21%   -0.02%     
==========================================
  Files         389      389              
  Lines       31959    31970      +11     
==========================================
+ Hits        25321    25326       +5     
- Misses       6638     6644       +6     
Impacted Files Coverage Δ
src/logger/mongoose_log_filter.erl 75.71% <100.00%> (+4.52%) ⬆️
src/elasticsearch/mongoose_elasticsearch.erl 76.92% <0.00%> (-7.70%) ⬇️
src/cassandra/mongoose_cassandra_worker.erl 70.75% <0.00%> (-4.25%) ⬇️
src/mam/mod_mam_elasticsearch_arch.erl 86.60% <0.00%> (-1.79%) ⬇️
src/mod_muc_log.erl 77.72% <0.00%> (ø)
src/mod_muc_room.erl 77.45% <0.00%> (+0.11%) ⬆️
src/ejabberd_c2s.erl 89.43% <0.00%> (+0.29%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ca4fb80...e58ce81. Read the comment docs.

Copy link
Collaborator

@NelsonVides NelsonVides left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@NelsonVides NelsonVides merged commit 0dc6e59 into master May 19, 2021
@NelsonVides NelsonVides deleted the mu-pretty-stacktrace-formatting branch May 19, 2021 11:09
@arcusfelis
Copy link
Contributor Author

arcusfelis commented May 20, 2021

Long example:

when=2021-05-20T07:21:45.394760+00:00 level=warning what=routing_failed reason=badarg pid=<0.6216.0> at=ejabberd_router:route/5:536 from_jid=alicE_unnamed_0.750680@localhost/res1 to_jid=alicE_unnamed_0.75
0680@localhost stacktrace="erlang:'!'/2:0 gen_fsm_compat:send_event/2:217 mod_muc:route_to_online_room/2:619 mongoose_router_localdomain:route_to_host/5:31 ejabberd_router:route/5:530 ejabberd_router:rout
e/3:127 lists:foldl/3:1263 ejabberd_c2s:terminate/4:1564" stacktrace_args="[fakepid,\
 {'$gen_event',\
     {route,\
         {jid,<<\"alicE_unnamed_0.750680\">>,<<\"localhost\">>,<<\"res1\">>,\
             <<\"alice_unnamed_0.750680\">>,<<\"localhost\">>,<<\"res1\">>},\
         <<>>,\
         #{host_type => <<\"localhost\">>,lserver => <<\"muc.localhost\">>,\
           mongoose_acc => true,\
           non_strippable => [{c2s,origin_jid},{c2s,origin_sid}],\
           origin_location =>\
               #{file =>\
                     \"/Users/mikhailuvarov/erlang/esl/MongooseIM/src/ejabberd_c2s.erl\",\
                 line => 3314,\
                 mfa => {ejabberd_c2s,element_to_origin_accum,2}},\
           origin_pid => <0.6216.0>,\
           origin_stanza => <<\"<presence type='unavailable'/>\">>,\
           ref => #Ref<0.1724927581.3145203720.128623>,\
           stanza =>\
               #{element =>\
                     {xmlel,<<\"presence\">>,\
                         [{<<\"type\">>,<<\"unavailable\">>}],\
                         []},\
                 from_jid =>\
                     {jid,<<\"alicE_unnamed_0.750680\">>,<<\"localhost\">>,\
                         <<\"res1\">>,<<\"alice_unnamed_0.750680\">>,\
                         <<\"localhost\">>,<<\"res1\">>},\
                 name => <<\"presence\">>,\
                 ref => #Ref<0.1724927581.3145203717.130498>,\
                 to_jid =>\
                     {jid,<<\"testroom3\">>,<<\"muc.localhost\">>,<<>>,\
                         <<\"testroom3\">>,<<\"muc.localhost\">>,<<>>},\
                 type => <<\"unavailable\">>},\
           timestamp => 1621495305354055,\
           {c2s,origin_jid} =>\
               {jid,<<\"alicE_unnamed_0.750680\">>,<<\"localhost\">>,<<\"res1\">>,\
                   <<\"alice_unnamed_0.750680\">>,<<\"localhost\">>,<<\"res1\">>},\
           {c2s,origin_sid} => {1621495305330999,<0.6216.0>}},\
         {xmlel,<<\"presence\">>,[{<<\"type\">>,<<\"unavailable\">>}],[]}}}]" router_module=mongoose_router_localdomain packet="<presence type='unavailable'/>" origin_pid=<0.6216.0> acc_timestamp=2021-05-20T07:21:45.354055+00:00

@Premwoik Premwoik added this to the 5.0.0 milestone Oct 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants