From 098a378854e090aedb55e955bffd079d40a081d6 Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Wed, 27 Nov 2024 11:06:33 +0100 Subject: [PATCH] Upgrade amoc-arsenal with new api and metrics --- .github/workflows/ci.yml | 9 +-- ci/build_docker_image.sh | 2 +- ci/start_amoc_cluster.sh | 1 - rebar.config | 9 ++- rebar.lock | 65 ++++++++-------------- src/amoc_arsenal_xmpp.app.src | 9 ++- src/amoc_config_validation.erl | 2 +- src/helpers/amoc_xmpp.erl | 5 ++ src/helpers/dynamic_domains.erl | 3 +- src/scenarios/dynamic_domains_pm.erl | 1 + src/scenarios/gdpr_removal.erl | 1 + src/scenarios/mongoose_mam.erl | 1 + src/scenarios/mongoose_muc.erl | 1 + src/scenarios/mongoose_muc_light.erl | 1 + src/scenarios/mongoose_one_to_one.erl | 1 + src/scenarios/mongoose_pubsub_docker.erl | 1 + src/scenarios/mongoose_ssl_tcp_ws_bosh.erl | 1 + src/scenarios/pubsub_pep.erl | 1 + src/scenarios/pubsub_simple.erl | 1 + src/scenarios/simple_rest_api.erl | 10 ++-- 20 files changed, 64 insertions(+), 61 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8b8712a..8157728 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,8 +13,8 @@ jobs: name: OTP ${{matrix.otp_vsn}} strategy: matrix: - otp_vsn: ['27', '26', '25'] - rebar_vsn: ['3.23.0'] + otp_vsn: ['27'] + rebar_vsn: ['3.24.0'] runs-on: 'ubuntu-24.04' steps: - uses: actions/checkout@v4 @@ -33,7 +33,8 @@ jobs: name: docker container test with OTP ${{matrix.otp_vsn}} strategy: matrix: - otp_vsn: ['27', '26', '25'] + otp_vsn: ['27'] + rebar_vsn: ['3.24.0'] runs-on: 'ubuntu-24.04' env: OTP_RELEASE: ${{ matrix.otp_vsn }} @@ -56,7 +57,7 @@ jobs: - integration_test if: github.ref == 'refs/heads/master' env: - OTP_RELEASE: 27.0 + OTP_RELEASE: 27.1 steps: - uses: actions/checkout@v4 - name: Set up QEMU diff --git a/ci/build_docker_image.sh b/ci/build_docker_image.sh index a732396..c6a4acb 100755 --- a/ci/build_docker_image.sh +++ b/ci/build_docker_image.sh @@ -7,7 +7,7 @@ IFS=$'\n\t' # Get current repo version version="$(git rev-parse --short HEAD)" -otp_vsn="${OTP_RELEASE:-25.3}" +otp_vsn="${OTP_RELEASE:-27.1}" echo "ERLANG/OTP ${otp_vsn}" echo "AMOC-ARSENAL-XMPP ${version}" diff --git a/ci/start_amoc_cluster.sh b/ci/start_amoc_cluster.sh index 179a389..5b9f812 100755 --- a/ci/start_amoc_cluster.sh +++ b/ci/start_amoc_cluster.sh @@ -7,4 +7,3 @@ IFS=$'\n\t' cd "$(git rev-parse --show-toplevel)/ci" docker compose --profile with_graphite up --wait --wait-timeout 100 --scale amoc-worker=2 - diff --git a/rebar.config b/rebar.config index 89da0c1..d78d0a3 100644 --- a/rebar.config +++ b/rebar.config @@ -1,14 +1,19 @@ +{minimum_otp_vsn, "27"}. + { erl_opts, [ debug_info ]}. { deps, [ - {amoc_arsenal, {git, "https://github.com/esl/amoc-arsenal.git", {branch, "main"}}}, + {amoc_arsenal, {git, "https://github.com/esl/amoc-arsenal.git", {branch, "prometheus"}}}, {escalus, "4.2.16"}, - {jiffy, "1.1.2"}, {fusco, "0.1.1"} ]}. +{ shell, [ + {apps, [amoc_arsenal_xmpp]} +]}. + { xref_checks, [ %% enable most checks, but avoid 'unused calls' which makes amoc-arsenal fail... undefined_function_calls, undefined_functions, locals_not_used, diff --git a/rebar.lock b/rebar.lock index 9802738..a0d8064 100644 --- a/rebar.lock +++ b/rebar.lock @@ -1,105 +1,88 @@ {"1.2.0", -[{<<"amoc">>,{pkg,<<"amoc">>,<<"3.3.0">>},1}, +[{<<"accept">>,{pkg,<<"accept">>,<<"0.3.5">>},3}, + {<<"amoc">>,{pkg,<<"amoc">>,<<"3.3.0">>},1}, {<<"amoc_arsenal">>, {git,"https://github.com/esl/amoc-arsenal.git", - {ref,"b6dc37c3c7b8ad439c87483939c91f784fd51d50"}}, + {ref,"01da3cdc958ed4286fd9ed2383338454307f7923"}}, 0}, {<<"amoc_rest">>, {git,"https://github.com/esl/amoc_rest.git", - {ref,"1e41be5b6b332a827d125380fa4f7ea23a00748e"}}, + {ref,"d9f642255f48d14a1ff9601500796f5edb4e11e6"}}, 1}, {<<"base16">>,{pkg,<<"base16">>,<<"2.0.1">>},1}, {<<"bbmustache">>,{pkg,<<"bbmustache">>,<<"1.12.2">>},1}, - {<<"bear">>,{pkg,<<"bear">>,<<"1.0.0">>},2}, {<<"cowboy">>,{pkg,<<"cowboy">>,<<"2.12.0">>},2}, {<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.12.1">>},2}, - {<<"docsh">>,{pkg,<<"docsh">>,<<"0.7.2">>},1}, {<<"escalus">>,{pkg,<<"escalus">>,<<"4.2.16">>},0}, {<<"exml">>,{pkg,<<"hexml">>,<<"3.4.1">>},1}, - {<<"exometer_core">>, - {git,"https://github.com/esl/exometer_core.git", - {ref,"123daa053a4abb3ff4bdbf52f08344da535294e9"}}, - 1}, - {<<"exometer_report_graphite">>, - {git,"https://github.com/esl/exometer_report_graphite.git", - {ref,"59e475a094818294443de9dc68e08ee0116a5626"}}, - 1}, {<<"fast_pbkdf2">>,{pkg,<<"fast_pbkdf2">>,<<"1.0.5">>},2}, {<<"fast_scram">>,{pkg,<<"fast_scram">>,<<"0.6.0">>},1}, {<<"fast_tls">>,{pkg,<<"fast_tls">>,<<"1.1.21">>},1}, {<<"fusco">>,{pkg,<<"fusco">>,<<"0.1.1">>},0}, - {<<"getopt">>,{pkg,<<"getopt">>,<<"1.0.1">>},3}, {<<"gun">>,{pkg,<<"gun">>,<<"2.0.1">>},1}, - {<<"jesse">>,{pkg,<<"jesse">>,<<"1.8.0">>},2}, - {<<"jiffy">>,{pkg,<<"jiffy">>,<<"1.1.2">>},0}, - {<<"jsx">>,{pkg,<<"jsx">>,<<"3.1.0">>},2}, + {<<"jesse">>,{pkg,<<"jesse">>,<<"1.8.1">>},2}, {<<"meck">>,{pkg,<<"meck">>,<<"0.9.2">>},1}, {<<"p1_utils">>,{pkg,<<"p1_utils">>,<<"1.0.26">>},2}, - {<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.4.0">>},2}, - {<<"providers">>,{pkg,<<"providers">>,<<"1.8.1">>},2}, + {<<"prometheus">>,{pkg,<<"prometheus">>,<<"4.11.0">>},1}, + {<<"prometheus_cowboy">>,{pkg,<<"prometheus_cowboy">>,<<"0.1.8">>},1}, + {<<"prometheus_httpd">>,{pkg,<<"prometheus_httpd">>,<<"2.1.11">>},2}, + {<<"quantile_estimator">>,{pkg,<<"quantile_estimator">>,<<"0.2.1">>},2}, {<<"quickrand">>,{pkg,<<"quickrand">>,<<"2.0.7">>},2}, {<<"ranch">>,{pkg,<<"ranch">>,<<"2.1.0">>},2}, - {<<"rfc3339">>,{pkg,<<"rfc3339">>,<<"0.9.0">>},3}, - {<<"telemetry">>,{pkg,<<"telemetry">>,<<"1.2.1">>},1}, + {<<"telemetry">>,{pkg,<<"telemetry">>,<<"1.3.0">>},1}, {<<"uuid">>,{pkg,<<"uuid_erl">>,<<"2.0.7">>},1}, {<<"worker_pool">>,{pkg,<<"worker_pool">>,<<"6.2.1">>},1}]}. [ {pkg_hash,[ + {<<"accept">>, <<"B33B127ABCA7CC948BBE6CAA4C263369ABF1347CFA9D8E699C6D214660F10CD1">>}, {<<"amoc">>, <<"531B7E8CE39D40B4BF5A819868091C4451DC3D3FDAE753E3E3B1D0E5E8E81CDD">>}, {<<"base16">>, <<"F0549F732E03BE8124ED0D19FD5EE52146CC8BE24C48CBC3F23AB44B157F11A2">>}, {<<"bbmustache">>, <<"0CABDCE0DB9FE6D3318131174B9F2B351328A4C0AFBEB3E6E99BB0E02E9B621D">>}, - {<<"bear">>, <<"430419C1126B477686CDE843E88BA0F2C7DC5CDF0881C677500074F704339A99">>}, {<<"cowboy">>, <<"F276D521A1FF88B2B9B4C54D0E753DA6C66DD7BE6C9FCA3D9418B561828A3731">>}, {<<"cowlib">>, <<"A9FA9A625F1D2025FE6B462CB865881329B5CAFF8F1854D1CBC9F9533F00E1E1">>}, - {<<"docsh">>, <<"F893D5317A0E14269DD7FE79CF95FB6B9BA23513DA0480EC6E77C73221CAE4F2">>}, {<<"escalus">>, <<"EC83C277DECD721C3B219823C159D66CF94981A0796473617E4C0835E7395FE5">>}, {<<"exml">>, <<"9581FE6512D9772C61BBE611CD4A8E5BB90B4D4481275325EC520F7A931A9393">>}, {<<"fast_pbkdf2">>, <<"6045138C4C209FC8222A0B18B2CB1D7BD7407EF4ADAD0F14C5E0F7F4726E3E41">>}, {<<"fast_scram">>, <<"70724F584A118DA147A51EE38DEE56203F217D58AD61E0BB2C2EF834C16B35B8">>}, {<<"fast_tls">>, <<"65D7D547A09EEFB37A1C0D04D8601FAC4F3E6E2C1EDE859A7787081670F9648D">>}, {<<"fusco">>, <<"3DD6A90151DFEF30EA1937CC44E9A59177C0094918388D9BCAA2F2DC5E2AE4AA">>}, - {<<"getopt">>, <<"C73A9FA687B217F2FF79F68A3B637711BB1936E712B521D8CE466B29CBF7808A">>}, {<<"gun">>, <<"160A9A5394800FCBA41BC7E6D421295CF9A7894C2252C0678244948E3336AD73">>}, - {<<"jesse">>, <<"CF7615C3F2BE892F77BCCF736F23B4BD54A0FC686C7040431AEBA5EF7932CC4D">>}, - {<<"jiffy">>, <<"A9B6C9A7EC268E7CF493D028F0A4C9144F59CCB878B1AFE42841597800840A1B">>}, - {<<"jsx">>, <<"D12516BAA0BB23A59BB35DCCAF02A1BD08243FCBB9EFE24F2D9D056CCFF71268">>}, + {<<"jesse">>, <<"C9E3670C7EE40F719734E3BC716578143AABA93FC7525A02A7D5CB300B3AD71E">>}, {<<"meck">>, <<"85CCBAB053F1DB86C7CA240E9FC718170EE5BDA03810A6292B5306BF31BAE5F5">>}, {<<"p1_utils">>, <<"67B0C4AC9FA3BA3EF563B31AA111B0A004439A37FAC85E027F1C3617E1C7EC6C">>}, - {<<"parse_trans">>, <<"BB87AC362A03CA674EBB7D9D498F45C03256ADED7214C9101F7035EF44B798C7">>}, - {<<"providers">>, <<"70B4197869514344A8A60E2B2A4EF41CA03DEF43CFB1712ECF076A0F3C62F083">>}, + {<<"prometheus">>, <<"B95F8DE8530F541BD95951E18E355A840003672E5EDA4788C5FA6183406BA29A">>}, + {<<"prometheus_cowboy">>, <<"CFCE0BC7B668C5096639084FCD873826E6220EA714BF60A716F5BD080EF2A99C">>}, + {<<"prometheus_httpd">>, <<"F616ED9B85B536B195D94104063025A91F904A4CFC20255363F49A197D96C896">>}, + {<<"quantile_estimator">>, <<"EF50A361F11B5F26B5F16D0696E46A9E4661756492C981F7B2229EF42FF1CD15">>}, {<<"quickrand">>, <<"D2BD76676A446E6A058D678444B7FDA1387B813710D1AF6D6E29BB92186C8820">>}, {<<"ranch">>, <<"2261F9ED9574DCFCC444106B9F6DA155E6E540B2F82BA3D42B339B93673B72A3">>}, - {<<"rfc3339">>, <<"2075653DC9407541C84B1E15F8BDA2ABE95FB17C9694025E079583F2D19C1060">>}, - {<<"telemetry">>, <<"68FDFE8D8F05A8428483A97D7AAB2F268AAFF24B49E0F599FAA091F1D4E7F61C">>}, + {<<"telemetry">>, <<"FEDEBBAE410D715CF8E7062C96A1EF32EC22E764197F70CDA73D82778D61E7A2">>}, {<<"uuid">>, <<"B2078D2CC814F53AFA52D36C91E08962C7E7373585C623F4C0EA6DFB04B2AF94">>}, {<<"worker_pool">>, <<"BD98A0BE1D20057AE9967CBE73D263AEA5BE14BBE4C73CAFEB1378572FF14561">>}]}, {pkg_hash_ext,[ + {<<"accept">>, <<"11B18C220BCC2EAB63B5470C038EF10EB6783BCB1FCDB11AA4137DEFA5AC1BB8">>}, {<<"amoc">>, <<"B8DD4F77BB94716ABC64E863158EEF8E1375CECB2F69E57DC4A293B0949D4985">>}, {<<"base16">>, <<"06EA2D48343282E712160BA89F692B471DB8B36ABE8394F3445FF9032251D772">>}, {<<"bbmustache">>, <<"688B33A4D5CC2D51F575ADF0B3683FC40A38314A2F150906EDCFC77F5B577B3B">>}, - {<<"bear">>, <<"157B67901ADF84FF0DA6EAE035CA1292A0AC18AA55148154D8C582B2C68959DB">>}, {<<"cowboy">>, <<"8A7ABE6D183372CEB21CAA2709BEC928AB2B72E18A3911AA1771639BEF82651E">>}, {<<"cowlib">>, <<"163B73F6367A7341B33C794C4E88E7DBFE6498AC42DCD69EF44C5BC5507C8DB0">>}, - {<<"docsh">>, <<"4E7DB461BB07540D2BC3D366B8513F0197712D0495BB85744F367D3815076134">>}, {<<"escalus">>, <<"3CA9D58F39A3FBD618A1E7B5D57AE97B76016330BB2374C430AA9278669243CC">>}, {<<"exml">>, <<"D8E7894E2544402B4986EEB2443C15B51B14F686266F091DBF2777D1D99A2FA2">>}, {<<"fast_pbkdf2">>, <<"BC3B5A3CAB47AD114FF8BB815FEDE62A6187ACD14D8B37412F2AF8236A089CEF">>}, {<<"fast_scram">>, <<"771D034341599CFC6A6C5E56CF924B68D2C7478088CAF17419E3147B66914667">>}, {<<"fast_tls">>, <<"131542913937025E48CD80AA81F00359686D5501B75621E72026A87B5229505B">>}, {<<"fusco">>, <<"6343551BD1E824F2A6CA85E1158C5B37C320FD449FBFEC7450A73F192AAF9022">>}, - {<<"getopt">>, <<"53E1AB83B9CEB65C9672D3E7A35B8092E9BDC9B3EE80721471A161C10C59959C">>}, {<<"gun">>, <<"A10BC8D6096B9502205022334F719CC9A08D9ADCFBFC0DBEE9EF31B56274A20B">>}, - {<<"jesse">>, <<"860EF4621DDBFB72792668929BE127E45E8B07CF19EEA264B0A9D48D36CCA41B">>}, - {<<"jiffy">>, <<"BB61BC42A720BBD33CB09A410E48BB79A61012C74CB8B3E75F26D988485CF381">>}, - {<<"jsx">>, <<"0C5CC8FDC11B53CC25CF65AC6705AD39E54ECC56D1C22E4ADB8F5A53FB9427F3">>}, + {<<"jesse">>, <<"0EDED3F18623FDA2F25989804A06CF518B4ACF2E9365B18C8E8C013D7E3C906F">>}, {<<"meck">>, <<"81344F561357DC40A8344AFA53767C32669153355B626EA9FCBC8DA6B3045826">>}, {<<"p1_utils">>, <<"D0379E8C1156B98BD64F8129C1DE022FCCA4F2FDB7486CE73BF0ED2C3376B04C">>}, - {<<"parse_trans">>, <<"F99E368830BEA44552224E37E04943A54874F08B8590485DE8D13832B63A2DC3">>}, - {<<"providers">>, <<"E45745ADE9C476A9A469EA0840E418AB19360DC44F01A233304E118A44486BA0">>}, + {<<"prometheus">>, <<"719862351AABF4DF7079B05DC085D2BBCBE3AC0AC3009E956671B1D5AB88247D">>}, + {<<"prometheus_cowboy">>, <<"BA286BECA9302618418892D37BCD5DC669A6CC001F4EB6D6AF85FF81F3F4F34C">>}, + {<<"prometheus_httpd">>, <<"0BBE831452CFDF9588538EB2F570B26F30C348ADAE5E95A7D87F35A5910BCF92">>}, + {<<"quantile_estimator">>, <<"282A8A323CA2A845C9E6F787D166348F776C1D4A41EDE63046D72D422E3DA946">>}, {<<"quickrand">>, <<"B8ACBF89A224BC217C3070CA8BEBC6EB236DBE7F9767993B274084EA044D35F0">>}, {<<"ranch">>, <<"244EE3FA2A6175270D8E1FC59024FD9DBC76294A321057DE8F803B1479E76916">>}, - {<<"rfc3339">>, <<"182314DE35C9F4180B22EB5F22916D8D7A799C1109A060C752970273A9332AD6">>}, - {<<"telemetry">>, <<"DAD9CE9D8EFFC621708F99EAC538EF1CBE05D6A874DD741DE2E689C47FEAFED5">>}, + {<<"telemetry">>, <<"7015FC8919DBE63764F4B4B87A95B7C0996BD539E0D499BE6EC9D7F3875B79E6">>}, {<<"uuid">>, <<"4E4C5CA3461DC47C5E157ED42AA3981A053B7A186792AF972A27B14A9489324E">>}, {<<"worker_pool">>, <<"64E560DE08CA5E7DB8BD4CDCC7B744B0659696194E3BC9E56239BA4A0F7E24F9">>}]} ]. diff --git a/src/amoc_arsenal_xmpp.app.src b/src/amoc_arsenal_xmpp.app.src index c561632..61a0bde 100644 --- a/src/amoc_arsenal_xmpp.app.src +++ b/src/amoc_arsenal_xmpp.app.src @@ -1,15 +1,14 @@ {application, amoc_arsenal_xmpp, [{description, "A library for esl/amoc sceanrios"}, - {vsn, "git"}, + {vsn, git}, {registered, []}, {applications, [kernel, stdlib, - amoc_arsenal, - escalus, - mnesia, ssl, - jiffy + mnesia, + escalus, + amoc_arsenal ]}, {env, [ {predefined_metrics, [{times, connection}, diff --git a/src/amoc_config_validation.erl b/src/amoc_config_validation.erl index 0e3fc92..8b0167f 100644 --- a/src/amoc_config_validation.erl +++ b/src/amoc_config_validation.erl @@ -1,6 +1,6 @@ -module(amoc_config_validation). --compile(export_all). +-compile([export_all, nowarn_export_all]). %% API diff --git a/src/helpers/amoc_xmpp.erl b/src/helpers/amoc_xmpp.erl index a74b6ab..46dcdec 100644 --- a/src/helpers/amoc_xmpp.erl +++ b/src/helpers/amoc_xmpp.erl @@ -1,5 +1,6 @@ -module(amoc_xmpp). +-export([init/0]). -export([connect_or_exit/1]). -export([connect_or_exit/2]). -export([pick_server/1]). @@ -17,6 +18,10 @@ #{name => connection_attempts, default_value => 1, verification => ?V(positive_integer), description => "number of attempts to establish xmpp connection before exiting"}]). +-spec init() -> any(). +init() -> + amoc_metrics:start_predefined_metrics(amoc_arsenal_xmpp). + %% @doc Connects and authenticates a user with the given id and additional properties. %% If the passed proplist is empty, a default user spec created by %% make_user function is passed. diff --git a/src/helpers/dynamic_domains.erl b/src/helpers/dynamic_domains.erl index d17d168..bebb236 100644 --- a/src/helpers/dynamic_domains.erl +++ b/src/helpers/dynamic_domains.erl @@ -31,6 +31,7 @@ -spec init() -> any(). init() -> + amoc_xmpp:init(), amoc_metrics:init(counters, domain_creation_requests), amoc_metrics:init(times, domain_creation_time). @@ -75,7 +76,7 @@ is_first_user_in_domain(UserId) -> create_domain(Host, Domain) -> {ok, Conn} = gun:open(binary_to_list(Host), cfg(graphql_port)), Path = <<"/api/graphql">>, - Body = jiffy:encode(#{query => create_domain_mutation(Domain)}), + Body = json:encode(#{query => create_domain_mutation(Domain)}), Stream = gun:post(Conn, Path, [{<<"content-type">>, <<"application/json">>}], Body), {response, nofin, 200, _Headers} = gun:await(Conn, Stream), {ok, _Body} = gun:await_body(Conn, Stream), diff --git a/src/scenarios/dynamic_domains_pm.erl b/src/scenarios/dynamic_domains_pm.erl index 913826d..3a3e39f 100644 --- a/src/scenarios/dynamic_domains_pm.erl +++ b/src/scenarios/dynamic_domains_pm.erl @@ -33,6 +33,7 @@ init() -> ?LOG_INFO("init metrics"), dynamic_domains:init(), amoc_xmpp_presence:init(), + amoc_xmpp:init(), amoc_metrics:init(counters, messages_sent), amoc_metrics:init(counters, messages_received), amoc_metrics:init(counters, service_unavailable), diff --git a/src/scenarios/gdpr_removal.erl b/src/scenarios/gdpr_removal.erl index 53006c8..f836dae 100644 --- a/src/scenarios/gdpr_removal.erl +++ b/src/scenarios/gdpr_removal.erl @@ -204,6 +204,7 @@ -spec init() -> ok. init() -> + amoc_xmpp:init(), init_metrics(), http_req:start(), diff --git a/src/scenarios/mongoose_mam.erl b/src/scenarios/mongoose_mam.erl index cd08d42..d05541f 100644 --- a/src/scenarios/mongoose_mam.erl +++ b/src/scenarios/mongoose_mam.erl @@ -105,6 +105,7 @@ -spec init() -> ok. init() -> + amoc_xmpp:init(), amoc_metrics:init(counters, messages_sent), amoc_metrics:init(counters, ?MAM_LOOKUPS_CT), amoc_metrics:init(counters, ?MAM_FAILED_LOOKUPS_CT), diff --git a/src/scenarios/mongoose_muc.erl b/src/scenarios/mongoose_muc.erl index 0d01875..87fa2d4 100644 --- a/src/scenarios/mongoose_muc.erl +++ b/src/scenarios/mongoose_muc.erl @@ -78,6 +78,7 @@ -spec init() -> ok. init() -> ?LOG_INFO("init the scenario"), + amoc_xmpp:init(), amoc_metrics:init(counters, muc_rooms_created), amoc_metrics:init(counters, muc_occupants), amoc_metrics:init(counters, muc_messages_sent), diff --git a/src/scenarios/mongoose_muc_light.erl b/src/scenarios/mongoose_muc_light.erl index 52c987e..5387e27 100644 --- a/src/scenarios/mongoose_muc_light.erl +++ b/src/scenarios/mongoose_muc_light.erl @@ -78,6 +78,7 @@ -spec init() -> ok. init() -> ?LOG_INFO("init the scenario"), + amoc_xmpp:init(), amoc_metrics:init(counters, muc_rooms_created), amoc_metrics:init(counters, muc_occupants), amoc_metrics:init(counters, muc_messages_sent), diff --git a/src/scenarios/mongoose_one_to_one.erl b/src/scenarios/mongoose_one_to_one.erl index 2575857..b95619c 100644 --- a/src/scenarios/mongoose_one_to_one.erl +++ b/src/scenarios/mongoose_one_to_one.erl @@ -67,6 +67,7 @@ -spec init() -> ok. init() -> ?LOG_INFO("init metrics"), + amoc_xmpp:init(), amoc_metrics:init(counters, messages_sent), amoc_metrics:init(times, message_ttd), ok. diff --git a/src/scenarios/mongoose_pubsub_docker.erl b/src/scenarios/mongoose_pubsub_docker.erl index 8c5e443..11e6b3b 100644 --- a/src/scenarios/mongoose_pubsub_docker.erl +++ b/src/scenarios/mongoose_pubsub_docker.erl @@ -30,6 +30,7 @@ -spec init() -> ok. init() -> set_env_interarrival(), + amoc_xmpp:init(), amoc_metrics:init(counters, ?PUBSUB_NODES_CT), amoc_metrics:init(counters, ?SUBSCRIPTIONS_CT), amoc_metrics:init(counters, ?ITEMS_SENT_CT), diff --git a/src/scenarios/mongoose_ssl_tcp_ws_bosh.erl b/src/scenarios/mongoose_ssl_tcp_ws_bosh.erl index b4eabe7..fa6663d 100644 --- a/src/scenarios/mongoose_ssl_tcp_ws_bosh.erl +++ b/src/scenarios/mongoose_ssl_tcp_ws_bosh.erl @@ -18,6 +18,7 @@ -spec init() -> ok. init() -> + amoc_xmpp:init(), ?LOG_INFO("init the scenario"). -spec start(amoc_scenario:user_id()) -> any(). diff --git a/src/scenarios/pubsub_pep.erl b/src/scenarios/pubsub_pep.erl index 61b42a5..3b67d03 100644 --- a/src/scenarios/pubsub_pep.erl +++ b/src/scenarios/pubsub_pep.erl @@ -111,6 +111,7 @@ -spec init() -> ok. init() -> + amoc_xmpp:init(), init_metrics(), {ok, PublicationRate} = amoc_config:get(publication_rate), {ok, NodeCreationRate} = amoc_config:get(node_creation_rate), diff --git a/src/scenarios/pubsub_simple.erl b/src/scenarios/pubsub_simple.erl index 053353f..0adefac 100644 --- a/src/scenarios/pubsub_simple.erl +++ b/src/scenarios/pubsub_simple.erl @@ -134,6 +134,7 @@ -spec init() -> ok. init() -> + amoc_xmpp:init(), init_metrics(), {ok, PublicationRate} = amoc_config:get(publication_rate), {ok, NodeCreationRate} = amoc_config:get(node_creation_rate), diff --git a/src/scenarios/simple_rest_api.erl b/src/scenarios/simple_rest_api.erl index 4320eaa..85332f6 100644 --- a/src/scenarios/simple_rest_api.erl +++ b/src/scenarios/simple_rest_api.erl @@ -35,6 +35,7 @@ -spec init() -> ok. init() -> http_req:start(), + amoc_xmpp:init(), ok. -spec start(amoc_scenario:user_id()) -> any(). @@ -62,11 +63,10 @@ log_message(_Client, Stanza) -> send_message(AuthHeader, Id) -> Msg = #{to => amoc_xmpp_users:make_jid(Id), - body => <<"Hello, It's me">> - }, - Headers = [AuthHeader, - {<<"content-type">>, <<"application/json">>}], - R = http_req:post_request("https://localhost:8089", <<"/api/messages">>, Headers, jiffy:encode(Msg)), + body => <<"Hello, It's me">>}, + Headers = [AuthHeader, {<<"content-type">>, <<"application/json">>}], + Host = "https://localhost:8089", + R = http_req:post_request(Host, <<"/api/messages">>, Headers, json:encode(Msg)), ?LOG_WARNING("~p", [R]). auth_header(Id) ->