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

Instrument/dynamic handlers #4247

Merged
merged 3 commits into from
Mar 21, 2024

Conversation

chrzaszcz
Copy link
Member

@chrzaszcz chrzaszcz commented Mar 20, 2024

This PR allows dynamic modification of the configured handlers, which could be useful in tests, similarly to mongoose_modules and mongoose_service.

Previously, the tests used meck to inject logging events to an ETS table. Now it is possible to do this with add_handler and remove_handler.

Calling intrument_helper:add(my_handler, Opts) results in:

  • Setting #{my_handler => Opts} in theinstrumentation section of mongoose_config.
  • Adding mongoose_instrument_my_handler module to handlers.
  • Setting up the new handler for already registered events.

Calling instrument_helper:remove(my_handler) does the opposite:

  • Unregister the handler for all events.
  • Remove the options from mongoose_config.

By modifying mongoose_config in the correct order, there is consistency between the configuration and the registered handlers.

@mongoose-im
Copy link
Collaborator

mongoose-im commented Mar 20, 2024

elasticsearch_and_cassandra_26 / elasticsearch_and_cassandra_mnesia / 429b944
Reports root/ big
OK: 435 / Failed: 0 / User-skipped: 41 / Auto-skipped: 0


small_tests_25 / small_tests / 429b944
Reports root / small


small_tests_26 / small_tests / 429b944
Reports root / small


small_tests_26_arm64 / small_tests / 429b944
Reports root / small


ldap_mnesia_26 / ldap_mnesia / 429b944
Reports root/ big
OK: 2275 / Failed: 0 / User-skipped: 895 / Auto-skipped: 0


dynamic_domains_mysql_redis_26 / mysql_redis / 429b944
Reports root/ big
OK: 4489 / Failed: 0 / User-skipped: 138 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_26 / pgsql_mnesia / 429b944
Reports root/ big
OK: 4522 / Failed: 0 / User-skipped: 105 / Auto-skipped: 0


internal_mnesia_26 / internal_mnesia / 429b944
Reports root/ big
OK: 2415 / Failed: 0 / User-skipped: 755 / Auto-skipped: 0


ldap_mnesia_25 / ldap_mnesia / 429b944
Reports root/ big
OK: 2275 / Failed: 0 / User-skipped: 895 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 429b944
Reports root/ big
OK: 4522 / Failed: 0 / User-skipped: 105 / Auto-skipped: 0


pgsql_cets_26 / pgsql_cets / 429b944
Reports root/ big
OK: 4439 / Failed: 0 / User-skipped: 174 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_26 / odbc_mssql_mnesia / 429b944
Reports root/ big
OK: 4519 / Failed: 0 / User-skipped: 108 / Auto-skipped: 0


mysql_redis_26 / mysql_redis / 429b944
Reports root/ big
OK: 4890 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0


pgsql_mnesia_25 / pgsql_mnesia / 429b944
Reports root/ big
OK: 4911 / Failed: 0 / User-skipped: 112 / Auto-skipped: 0


pgsql_mnesia_26 / pgsql_mnesia / 429b944
Reports root/ big
OK: 4911 / Failed: 0 / User-skipped: 112 / Auto-skipped: 0


mssql_mnesia_26 / odbc_mssql_mnesia / 429b944
Reports root/ big
OK: 4908 / Failed: 0 / User-skipped: 115 / Auto-skipped: 0

Copy link

codecov bot commented Mar 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.46%. Comparing base (94366fd) to head (3444fe9).

Additional details and impacted files
@@                  Coverage Diff                   @@
##           feature/instrument    #4247      +/-   ##
======================================================
+ Coverage               84.43%   84.46%   +0.02%     
======================================================
  Files                     556      556              
  Lines                   33633    33660      +27     
======================================================
+ Hits                    28398    28430      +32     
+ Misses                   5235     5230       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mongoose-im
Copy link
Collaborator

mongoose-im commented Mar 21, 2024

elasticsearch_and_cassandra_26 / elasticsearch_and_cassandra_mnesia / adfa206
Reports root/ big
OK: 435 / Failed: 0 / User-skipped: 41 / Auto-skipped: 0


small_tests_25 / small_tests / adfa206
Reports root / small


small_tests_26 / small_tests / adfa206
Reports root / small


small_tests_26_arm64 / small_tests / adfa206
Reports root / small


ldap_mnesia_25 / ldap_mnesia / adfa206
Reports root/ big
OK: 2275 / Failed: 0 / User-skipped: 895 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / adfa206
Reports root/ big
OK: 4522 / Failed: 0 / User-skipped: 105 / Auto-skipped: 0


ldap_mnesia_26 / ldap_mnesia / adfa206
Reports root/ big
OK: 2275 / Failed: 0 / User-skipped: 895 / Auto-skipped: 0


dynamic_domains_mysql_redis_26 / mysql_redis / adfa206
Reports root/ big
OK: 4489 / Failed: 0 / User-skipped: 138 / Auto-skipped: 0


internal_mnesia_26 / internal_mnesia / adfa206
Reports root/ big
OK: 2415 / Failed: 0 / User-skipped: 755 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_26 / pgsql_mnesia / adfa206
Reports root/ big
OK: 4522 / Failed: 0 / User-skipped: 105 / Auto-skipped: 0


pgsql_cets_26 / pgsql_cets / adfa206
Reports root/ big
OK: 4439 / Failed: 0 / User-skipped: 174 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_26 / odbc_mssql_mnesia / adfa206
Reports root/ big
OK: 4519 / Failed: 0 / User-skipped: 108 / Auto-skipped: 0


pgsql_mnesia_25 / pgsql_mnesia / adfa206
Reports root/ big
OK: 4911 / Failed: 0 / User-skipped: 112 / Auto-skipped: 0


mysql_redis_26 / mysql_redis / adfa206
Reports root/ big
OK: 4889 / Failed: 1 / User-skipped: 133 / Auto-skipped: 0

sm_SUITE:ping_timeout
{error,{noproc,{gen_server,call,[<0.97283.0>,get_sm_h]}}}

Report log


pgsql_mnesia_26 / pgsql_mnesia / adfa206
Reports root/ big
OK: 4911 / Failed: 0 / User-skipped: 112 / Auto-skipped: 0


mssql_mnesia_26 / odbc_mssql_mnesia / adfa206
Reports root/ big
OK: 4904 / Failed: 4 / User-skipped: 115 / Auto-skipped: 0

muc_SUITE:register:user_submits_registration_form
{error,
  {{assertion_failed,assert,is_iq_result,
     [{xmlel,<<"iq">>,
        [{<<"type">>,<<"set">>},
         {<<"id">>,<<"c9f0f14a3e003e1700aee0b2d43fda80">>},
         {<<"to">>,<<"muc.localhost">>}],
        [{xmlel,<<"query">>,
           [{<<"xmlns">>,<<"jabber:iq:register">>}],
           [{xmlel,<<"x">>,
            [{<<"xmlns">>,<<"jabber:x:data">>},
             {<<"type">>,<<"submit">>}],
            [{xmlel,<<"field">>,
               [{<<"type">>,<<"hidden">>},
                {<<"var">>,<<"FORM_TYPE">>}],
               [{xmlel,<<"value">>,[],
                  [{xmlcdata,<<"jabber:iq:register">>}]}]},
             {xmlel,<<"field">>,
               [{<<"type">>,<<"text-single">>},
                {<<"var">>,<<"nick">>}],
               [{xmlel,<<"value">>,[],
                  [{xmlcdata,
                     <<"thirdwitchroom-4a47d0bae2">>}]}]}]}]}]}],
     {xmlel,<<"iq">>,
       [{<<"from">>,<<"muc.localhost">>},
        {<<"to">>,
         <<"alice_user_submits_registration_form_3019@localhost/res1">>},
        {<<"type">>,<<"error">>},
        {<<"id">>,<<"c9f0f14a3e003e1700aee0b2d43fda80">>}],
       [{xmlel,<<"query">>,
          [{<<"xmlns">>,<<"jabber:iq:register">>}],
          [{xmlel,<<"x">>,
             [{<<"xmlns">>,<<"jabber:x:data">>},
            {<<"type">>,<<"submit">>}],
             [{xmlel,<<"field">>,
              [{<<"type">>,<<"hidden">>},
               {<<"var">>,<<"FORM_TYPE">>}],
              [{xmlel,<<"value">>,[],
         ...

Report log

muc_SUITE:register:user_changes_nick
{error,
  {thrown,
    {timeout,
      [{escalus_connection,receive_stanza,2,
         [{file,
            "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_connection.erl"},
          {line,303}]},
       {muc_SUITE,'-user_changes_nick/1-fun-0-',1,
         [{file,
            "/home/circleci/project/big_tests/tests/muc_SUITE.erl"},
          {line,2804}]},
       {escalus_story,story,4,
         [{file,
            "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
          {line,72}]},
       {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1793}]},
       {test_server,run_test_case_eval1,6,
         [{file,"test_server.erl"},{line,1302}]},
       {test_server,run_test_case_eval,9,
         [{file,"test_server.erl"},{line,1234}]}]}}}

Report log

muc_SUITE:register:user_unregisters_nick
{error,
  {thrown,
    {timeout,
      [{escalus_connection,receive_stanza,2,
         [{file,
            "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_connection.erl"},
          {line,303}]},
       {muc_SUITE,'-user_unregisters_nick/1-fun-0-',1,
         [{file,
            "/home/circleci/project/big_tests/tests/muc_SUITE.erl"},
          {line,2817}]},
       {escalus_story,story,4,
         [{file,
            "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
          {line,72}]},
       {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1793}]},
       {test_server,run_test_case_eval1,6,
         [{file,"test_server.erl"},{line,1302}]},
       {test_server,run_test_case_eval,9,
         [{file,"test_server.erl"},{line,1234}]}]}}}

Report log

muc_SUITE:register:user_unregisters_nick_twice
{error,
  {thrown,
    {timeout,
      [{escalus_connection,receive_stanza,2,
         [{file,
            "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_connection.erl"},
          {line,303}]},
       {muc_SUITE,'-user_unregisters_nick_twice/1-fun-0-',1,
         [{file,
            "/home/circleci/project/big_tests/tests/muc_SUITE.erl"},
          {line,2824}]},
       {escalus_story,story,4,
         [{file,
            "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
          {line,72}]},
       {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1793}]},
       {test_server,run_test_case_eval1,6,
         [{file,"test_server.erl"},{line,1302}]},
       {test_server,run_test_case_eval,9,
         [{file,"test_server.erl"},{line,1234}]}]}}}

Report log

Calling intrument_helper:add(my_handler, Opts) results in:
  - Setting #{my_handler => Opts} in the 'instrumentation' section
    of mongoose_config.
  - Adding mongoose_instrument_my_handler module to handlers.
  - Setting up the new handler for already registered events.

Calling instrument_helper:remove(my_handler) does the opposite.

This functionality is intended for use in tests.
Benefits:
  - There is no meck involved, so no dynamic code modification
  - Testing results instead of execution of a specific function
    (which might change)
@mongoose-im
Copy link
Collaborator

mongoose-im commented Mar 21, 2024

elasticsearch_and_cassandra_26 / elasticsearch_and_cassandra_mnesia / 3444fe9
Reports root/ big
OK: 435 / Failed: 0 / User-skipped: 41 / Auto-skipped: 0


small_tests_25 / small_tests / 3444fe9
Reports root / small


small_tests_26 / small_tests / 3444fe9
Reports root / small


small_tests_26_arm64 / small_tests / 3444fe9
Reports root / small


ldap_mnesia_25 / ldap_mnesia / 3444fe9
Reports root/ big
OK: 2275 / Failed: 0 / User-skipped: 895 / Auto-skipped: 0


ldap_mnesia_26 / ldap_mnesia / 3444fe9
Reports root/ big
OK: 2275 / Failed: 0 / User-skipped: 895 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 3444fe9
Reports root/ big
OK: 4522 / Failed: 0 / User-skipped: 105 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_26 / pgsql_mnesia / 3444fe9
Reports root/ big
OK: 4522 / Failed: 0 / User-skipped: 105 / Auto-skipped: 0


internal_mnesia_26 / internal_mnesia / 3444fe9
Reports root/ big
OK: 2415 / Failed: 0 / User-skipped: 755 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_26 / odbc_mssql_mnesia / 3444fe9
Reports root/ big
OK: 4519 / Failed: 0 / User-skipped: 108 / Auto-skipped: 0


dynamic_domains_mysql_redis_26 / mysql_redis / 3444fe9
Reports root/ big
OK: 4489 / Failed: 0 / User-skipped: 138 / Auto-skipped: 0


pgsql_mnesia_25 / pgsql_mnesia / 3444fe9
Reports root/ big
OK: 4911 / Failed: 0 / User-skipped: 112 / Auto-skipped: 0


mysql_redis_26 / mysql_redis / 3444fe9
Reports root/ big
OK: 4890 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0


pgsql_cets_26 / pgsql_cets / 3444fe9
Reports root/ big
OK: 4439 / Failed: 0 / User-skipped: 174 / Auto-skipped: 0


pgsql_mnesia_26 / pgsql_mnesia / 3444fe9
Reports root/ big
OK: 4911 / Failed: 0 / User-skipped: 112 / Auto-skipped: 0


mssql_mnesia_26 / odbc_mssql_mnesia / 3444fe9
Reports root/ big
OK: 4905 / Failed: 3 / User-skipped: 115 / Auto-skipped: 0

graphql_muc_light_SUITE:domain_admin:domain_admin_muc_light:end_per_group
{error,
 {{unregistering_failed,
   {amount,1},
   {unregistered_items,
  [{{<<"_admin_create_room_with_unprepped_domain_1099">>,
     [{escalus_event_mgr,<0.25944.0>},
    {tc_name,admin_create_room_with_unprepped_domain},
    {escalus_cleaner,<0.25943.0>},
    {watchdog,<0.25942.0>},
    {muc_light_host,<<"muclight.localhost">>},
    {secondary_muc_light_host,<<"muclight.localhost.bis">>},
    {protocol,http},
    {domain_admin,{<<"admin@localhost">>,<<"afc751f6e60949cd">>}},
    {schema_endpoint,domain_admin},
    {{ejabberd_cwd,mongooseim@localhost},
     "/home/circleci/project/_build/mim1/rel/mongooseim"},
    {preset,"odbc_mssql_mnesia"},
    {mim_data_dir,
     "/home/circleci/project/big_tests/tests/graphql_muc_light_SUITE_data"},
    {tc_logfile,
     "https://circleci-mim-results.s3.eu-central-1.amazonaws.com/PR/4247/213128/odbc_mssql_mnesia.26.1.2-amd64/big/ct_run.test%40441699047eb5.2024-03-21_07.46.05/big_tests.tests.graphql_muc_light_SUITE.logs/run.2024-03-21_07.50.21/graphql_muc_light_suite.admin_create_room_with_unprepped_domain.11781.html"},
    {tc_group_properties,[{name,domain_admin_muc_light}]},
    {tc_group_path,[[{name,domain_admin}]]},
    {data_dir,
     "/home/circleci/project/big_tests/_build/default/lib/mongoose_tests/ebin/graphql_muc_light_SUITE_data/"},
    {priv_dir,
     "https://circleci-mim-results.s3.eu-central-1.amazonaws.com/PR/4247/213128/odbc_mssql_mnesia.26.1.2-amd64/big/ct_run.test%40441699047eb5.2024-03-21_07.46.05/big_tests.tests.graphql_muc_light_SUITE.logs/run.2024-03-21_07.50.21/log_private/"},
    {{saved_modules,mongooseim@localhost,<<"localhost">>},
     #{mo...

Report log

pep_SUITE:pep_tests:pep_caps_test
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,<<"bob_pep_caps_test_2927@localhost/res1">>,
          escalus_tcp,<0.77627.0>,
          [{event_manager,<0.77591.0>},
           {server,<<"localhost">>},
           {username,<<"bOb_pep_caps_test_2927">>},
           {resource,<<"res1">>}],
          [{event_client,
             [{event_manager,<0.77591.0>},
            {server,<<"localhost">>},
            {username,<<"bOb_pep_caps_test_2927">>},
            {resource,<<"res1">>}]},
           {resource,<<"res1">>},
           {username,<<"bob_pep_caps_test_2927">>},
           {server,<<"localhost">>},
           {host,<<"localhost">>},
           {port,5222},
           {auth,{escalus_auth,auth_plain}},
           {wspath,undefined},
           {username,<<"bOb_pep_caps_test_2927">>},
           {server,<<"localhost">>},
           {password,<<"makrolika">>},
           {stream_id,<<"4473394a2e1ab3b2">>}]},
        5000],
       [{file,
          "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,136}]},
     {pep_SUITE,receive_presence_with_caps,3,
       [{file,"/home/circleci/project/big_tests/tests/pep_SUITE.erl"},
        {line,553}]},
     {pep_SUITE,'-pep_caps_test/1-fun-0-',1,
       [{file,"/home/circleci/project/big_tests/tests/pep_SUITE.erl"},
        {line,201}]},
     {escalus_story,story,4,
       [{file,
          "/home/circleci/project/big_tests/_build/defau...

Report log

pep_SUITE:pep_tests:unsubscribe_after_presence_unsubscription
{error,{{assertion_failed,assert_many,false,[is_roster_set],[],[]},
    [{escalus_new_assert,assert_true,2,
               [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_new_assert.erl"},
                {line,84}]},
     {escalus_story,'-make_all_clients_friends/1-fun-0-',2,
            [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
             {line,108}]},
     {escalus_utils,'-each_with_index/3-fun-0-',3,
            [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_utils.erl"},
             {line,87}]},
     {lists,foldl_1,3,[{file,"lists.erl"},{line,1599}]},
     {escalus_utils,'-each_with_index/3-fun-0-',3,
            [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_utils.erl"},
             {line,87}]},
     {lists,foldl,3,[{file,"lists.erl"},{line,1594}]},
     {escalus_utils,distinct_pairs,2,
            [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_utils.erl"},
             {line,60}]},
     {escalus_story,make_all_clients_friends,1,
            [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
             {line,106}]}]}}

Report log

pep_SUITE:pep_tests:publish_and_notify_test
{error,{{assertion_failed,assert_many,false,[is_roster_set],[],[]},
    [{escalus_new_assert,assert_true,2,
               [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_new_assert.erl"},
                {line,84}]},
     {escalus_story,'-make_all_clients_friends/1-fun-0-',2,
            [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
             {line,108}]},
     {escalus_utils,'-each_with_index/3-fun-0-',3,
            [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_utils.erl"},
             {line,87}]},
     {lists,foldl_1,3,[{file,"lists.erl"},{line,1599}]},
     {escalus_utils,'-each_with_index/3-fun-0-',3,
            [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_utils.erl"},
             {line,87}]},
     {lists,foldl,3,[{file,"lists.erl"},{line,1594}]},
     {escalus_utils,distinct_pairs,2,
            [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_utils.erl"},
             {line,60}]},
     {escalus_story,make_all_clients_friends,1,
            [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
             {line,106}]}]}}

Report log


mssql_mnesia_26 / odbc_mssql_mnesia / 3444fe9
Reports root/ big
OK: 4908 / Failed: 0 / User-skipped: 115 / Auto-skipped: 0

graphql_muc_light_SUITE:user:user_muc_light:end_per_group
{error,
 {{unregistering_failed,
   {amount,3},
   {unregistered_items,
  [{{<<"_user_send_message_to_room_errors_1039">>,
     [{escalus_event_mgr,<0.24336.0>},
    {tc_name,user_send_message_to_room_errors},
    {escalus_cleaner,<0.24335.0>},
    {watchdog,<0.24334.0>},
    {muc_light_host,<<"muclight.localhost">>},
    {secondary_muc_light_host,<<"muclight.localhost.bis">>},
    {schema_endpoint,user},
    {{ejabberd_cwd,mongooseim@localhost},
     "/home/circleci/project/_build/mim1/rel/mongooseim"},
    {preset,"odbc_mssql_mnesia"},
    {mim_data_dir,
     "/home/circleci/project/big_tests/tests/graphql_muc_light_SUITE_data"},
    {tc_logfile,
     "https://circleci-mim-results.s3.eu-central-1.amazonaws.com/PR/4247/213140/odbc_mssql_mnesia.26.1.2-amd64/big/ct_run.test%40ea415e3524b9.2024-03-21_08.23.57/big_tests.tests.graphql_muc_light_SUITE.logs/run.2024-03-21_08.28.11/graphql_muc_light_suite.user_send_message_to_room_errors.35843.html"},
    {tc_group_properties,[{name,user_muc_light},parallel]},
    {tc_group_path,[[{name,user}]]},
    {data_dir,
     "/home/circleci/project/big_tests/_build/default/lib/mongoose_tests/ebin/graphql_muc_light_SUITE_data/"},
    {priv_dir,
     "https://circleci-mim-results.s3.eu-central-1.amazonaws.com/PR/4247/213140/odbc_mssql_mnesia.26.1.2-amd64/big/ct_run.test%40ea415e3524b9.2024-03-21_08.23.57/big_tests.tests.graphql_muc_light_SUITE.logs/run.2024-03-21_08.28.11/log_private/"},
    {{saved_modules,mongooseim@localhost,<<"localhost">>},
     #{mod_vcard =>
      #{matches => 30,
        host => {prefix,<<"vjud.">>},
        search => true,iqdisc => parallel,backend =>...

Report log

@chrzaszcz chrzaszcz marked this pull request as ready for review March 21, 2024 08:53
Copy link
Contributor

@JanuszJakubiec JanuszJakubiec left a comment

Choose a reason for hiding this comment

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

Looks good!

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.

Love it! 🔥

Comment on lines +321 to +324
-spec modules_to_funs([module()]) -> [handler_fun()].
modules_to_funs(Modules) ->
[fun Module:handle_event/4 || Module <- Modules].

Copy link
Collaborator

Choose a reason for hiding this comment

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

Somewhat unrelated to the dynamic handlers but this little thing is a gem to me. Performance!

Copy link
Member Author

Choose a reason for hiding this comment

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

I updated it after your feedback some time ago, and after checking that gen_* in OTP do the same.

@NelsonVides NelsonVides merged commit 0912480 into feature/instrument Mar 21, 2024
4 checks passed
@NelsonVides NelsonVides deleted the instrument/dynamic-handlers branch March 21, 2024 22:16
@jacekwegr jacekwegr added this to the 6.3.0 milestone Oct 4, 2024
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.

5 participants