diff --git a/Jenkinsfile b/Jenkinsfile index 55de7cf..ea97399 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -36,7 +36,7 @@ build('dmt_client', 'docker-host', finalHook) { sh 'make wc_xref' } runStage('dialyze') { - withWsCache("_build/default/rebar3_19.1_plt") { + withWsCache("_build/default/rebar3_21.1.1_plt") { sh 'make wc_dialyze' } } diff --git a/Makefile b/Makefile index 16bdf03..8162f4b 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ TEMPLATES_PATH := . SERVICE_NAME := dmt_client # Build image tag to be used -BUILD_IMAGE_TAG := 3750c129119b83ea399dc4aa0ed923fb0e3bf0f0 +BUILD_IMAGE_TAG := fcf116dd775cc2e91bffb6a36835754e3f2d5321 CALL_ANYWHERE := all submodules rebar-update compile xref lint dialyze check clean distclean CALL_W_CONTAINER := $(CALL_ANYWHERE) test diff --git a/builtils b/builtils index 8dd1d30..ea4aa04 160000 --- a/builtils +++ b/builtils @@ -1 +1 @@ -Subproject commit 8dd1d30e97e4db20c9da98a5ddb261b199402bc0 +Subproject commit ea4aa042f482551d624fd49a570d28488f479e93 diff --git a/config/sys.config b/config/sys.config index 819d4e9..7b66be1 100644 --- a/config/sys.config +++ b/config/sys.config @@ -1,9 +1,9 @@ [ {dmt_client, [ - {transport_opts, [ - {recv_timeout, 60000}, - {connect_timeout, 1000} - ]}, + {transport_opts, #{ + recv_timeout => 60000, + connect_timeout => 1000 + }}, {cache_update_interval, 5000}, % milliseconds {cache_update_pull_limit, 10}, % event batch size {max_cache_size, #{ @@ -17,6 +17,6 @@ }} ]}, {scoper, [ - {storage, scoper_storage_lager} + {storage, scoper_storage_logger} ]} ]. diff --git a/docker-compose.sh b/docker-compose.sh index 8f83788..b0c486c 100755 --- a/docker-compose.sh +++ b/docker-compose.sh @@ -13,7 +13,7 @@ services: dominant: condition: service_healthy dominant: - image: dr.rbkmoney.com/rbkmoney/dominant:845e7a6ff7f1cf37568e6ffab5f1ea86c7a43f49 + image: dr.rbkmoney.com/rbkmoney/dominant:410e9d8cd821b3b738eec2881e7737e021d9141b command: /opt/dominant/bin/dominant foreground depends_on: machinegun: @@ -24,7 +24,7 @@ services: timeout: 1s retries: 12 machinegun: - image: dr.rbkmoney.com/rbkmoney/machinegun:c3980e3de6fb85f20a6d53d26e3866866d00c5d7 + image: dr2.rbkmoney.com/rbkmoney/machinegun:7e6c4251a801cc00dbf8340c723010d68e2d86f1 command: /opt/machinegun/bin/machinegun foreground volumes: - ./test/machinegun/config.yaml:/opt/machinegun/etc/config.yaml diff --git a/rebar.config b/rebar.config index 391073f..2c0b832 100644 --- a/rebar.config +++ b/rebar.config @@ -1,8 +1,6 @@ %% Common project erlang options. {erl_opts, [ - {parse_transform, lager_transform}, - % mandatory debug_info, warnings_as_errors, @@ -29,12 +27,11 @@ %% Common project dependencies. {deps, [ - {genlib, {git, "https://github.com/rbkmoney/genlib.git", {branch, "master"}}}, - {woody , {git, "git@github.com:rbkmoney/woody_erlang.git", {branch, "master"}}}, - {scoper, {git, "git@github.com:rbkmoney/scoper.git", {branch, "master"}}}, - {dmt_core, {git, "git@github.com:rbkmoney/dmt_core.git", {branch, "master"}}}, - {dmsl, {git, "git@github.com:rbkmoney/damsel.git", {branch, "release/erlang/master"}}}, - {lager, "3.2.1"} + {genlib, {git, "https://github.com/rbkmoney/genlib.git", {branch, "master"}}}, + {woody , {git, "git@github.com:rbkmoney/woody_erlang.git", {branch, "master"}}}, + {scoper, {git, "git@github.com:rbkmoney/scoper.git", {branch, "master"}}}, + {dmt_core, {git, "git@github.com:rbkmoney/dmt_core.git", {branch, "master"}}}, + {dmsl, {git, "git@github.com:rbkmoney/damsel.git", {branch, "release/erlang/master"}}} ]}. %% XRef checks diff --git a/rebar.lock b/rebar.lock index 9c5f652..234c4f2 100644 --- a/rebar.lock +++ b/rebar.lock @@ -1,10 +1,11 @@ {"1.1.0", -[{<<"certifi">>,{pkg,<<"certifi">>,<<"0.7.0">>},2}, - {<<"cowboy">>,{pkg,<<"cowboy">>,<<"1.0.4">>},1}, - {<<"cowlib">>,{pkg,<<"cowlib">>,<<"1.0.2">>},2}, +[{<<"cache">>,{pkg,<<"cache">>,<<"2.2.0">>},1}, + {<<"certifi">>,{pkg,<<"certifi">>,<<"2.5.1">>},2}, + {<<"cowboy">>,{pkg,<<"cowboy">>,<<"2.5.0">>},1}, + {<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.6.0">>},2}, {<<"dmsl">>, {git,"git@github.com:rbkmoney/damsel.git", - {ref,"50a0d4f6df546fce4d16617b796f031703dd4707"}}, + {ref,"f2ea7590641093fd3d46a048aca7224fbf5918ef"}}, 0}, {<<"dmt_core">>, {git,"git@github.com:rbkmoney/dmt_core.git", @@ -12,45 +13,48 @@ 0}, {<<"genlib">>, {git,"https://github.com/rbkmoney/genlib.git", - {ref,"82ff16f4314fc406dd90752467a08fe401b009ef"}}, + {ref,"f805a11f6e73faffb05656c5192fbe199df36f27"}}, 0}, - {<<"goldrush">>,{pkg,<<"goldrush">>,<<"0.1.8">>},1}, - {<<"hackney">>,{pkg,<<"hackney">>,<<"1.6.2">>},1}, - {<<"idna">>,{pkg,<<"idna">>,<<"1.2.0">>},2}, - {<<"lager">>,{pkg,<<"lager">>,<<"3.2.1">>},0}, + {<<"gproc">>,{pkg,<<"gproc">>,<<"0.8.0">>},1}, + {<<"hackney">>,{pkg,<<"hackney">>,<<"1.15.1">>},1}, + {<<"idna">>,{pkg,<<"idna">>,<<"6.0.0">>},2}, {<<"metrics">>,{pkg,<<"metrics">>,<<"1.0.1">>},2}, - {<<"mimerl">>,{pkg,<<"mimerl">>,<<"1.0.2">>},2}, - {<<"ranch">>,{pkg,<<"ranch">>,<<"1.5.0">>},2}, + {<<"mimerl">>,{pkg,<<"mimerl">>,<<"1.2.0">>},2}, + {<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.3.0">>},3}, + {<<"ranch">>,{pkg,<<"ranch">>,<<"1.6.2">>},2}, {<<"rfc3339">>,{pkg,<<"rfc3339">>,<<"0.2.2">>},1}, {<<"scoper">>, {git,"git@github.com:rbkmoney/scoper.git", - {ref,"802057089bac258f45e35263eb2223961618468d"}}, + {ref,"e03318fd1feea0e2bb0ba5c634bb38b18aa81efa"}}, 0}, {<<"snowflake">>, {git,"https://github.com/rbkmoney/snowflake.git", {ref,"0a598108f6582affe3b4ae550fc5b9f2062e318a"}}, 1}, - {<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.1">>},2}, + {<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.4">>},2}, {<<"thrift">>, {git,"https://github.com/rbkmoney/thrift_erlang.git", - {ref,"240bbc842f6e9b90d01bd07838778cf48752b510"}}, + {ref,"7843146f22a9d9d63be4ae1276b5fa03938f2e9c"}}, 1}, + {<<"unicode_util_compat">>,{pkg,<<"unicode_util_compat">>,<<"0.4.1">>},3}, {<<"woody">>, {git,"git@github.com:rbkmoney/woody_erlang.git", - {ref,"354ac7664529ddecc07376bdaf4408cd8022fb61"}}, + {ref,"f9f15cb36e33f8608fc1ba7c0e798a3700eeb5e3"}}, 0}]}. [ {pkg_hash,[ - {<<"certifi">>, <<"861A57F3808F7EB0C2D1802AFEAAE0FA5DE813B0DF0979153CBAFCD853ABABAF">>}, - {<<"cowboy">>, <<"A324A8DF9F2316C833A470D918AAF73AE894278B8AA6226CE7A9BF699388F878">>}, - {<<"cowlib">>, <<"9D769A1D062C9C3AC753096F868CA121E2730B9A377DE23DEC0F7E08B1DF84EE">>}, - {<<"goldrush">>, <<"2024BA375CEEA47E27EA70E14D2C483B2D8610101B4E852EF7F89163CDB6E649">>}, - {<<"hackney">>, <<"96A0A5E7E65B7ACAD8031D231965718CC70A9B4131A8B033B7543BBD673B8210">>}, - {<<"idna">>, <<"AC62EE99DA068F43C50DC69ACF700E03A62A348360126260E87F2B54ECED86B2">>}, - {<<"lager">>, <<"EEF4E18B39E4195D37606D9088EA05BF1B745986CF8EC84F01D332456FE88D17">>}, + {<<"cache">>, <<"3C11DBF4CD8FCD5787C95A5FB2A04038E3729CFCA0386016EEA8C953AB48A5AB">>}, + {<<"certifi">>, <<"867CE347F7C7D78563450A18A6A28A8090331E77FA02380B4A21962A65D36EE5">>}, + {<<"cowboy">>, <<"4EF3AE066EE10FE01EA3272EDC8F024347A0D3EB95F6FBB9AED556DACBFC1337">>}, + {<<"cowlib">>, <<"8AA629F81A0FC189F261DC98A42243FA842625FEEA3C7EC56C48F4CCDB55490F">>}, + {<<"gproc">>, <<"CEA02C578589C61E5341FCE149EA36CCEF236CC2ECAC8691FBA408E7EA77EC2F">>}, + {<<"hackney">>, <<"9F8F471C844B8CE395F7B6D8398139E26DDCA9EBC171A8B91342EE15A19963F4">>}, + {<<"idna">>, <<"689C46CBCDF3524C44D5F3DDE8001F364CD7608A99556D8FBD8239A5798D4C10">>}, {<<"metrics">>, <<"25F094DEA2CDA98213CECC3AEFF09E940299D950904393B2A29D191C346A8486">>}, - {<<"mimerl">>, <<"993F9B0E084083405ED8252B99460C4F0563E41729AB42D9074FD5E52439BE88">>}, - {<<"ranch">>, <<"F04166F456790FEE2AC1AA05A02745CC75783C2BFB26D39FAF6AEFC9A3D3A58A">>}, + {<<"mimerl">>, <<"67E2D3F571088D5CFD3E550C383094B47159F3EEE8FFA08E64106CDF5E981BE3">>}, + {<<"parse_trans">>, <<"09765507A3C7590A784615CFD421D101AEC25098D50B89D7AA1D66646BC571C1">>}, + {<<"ranch">>, <<"6DB93C78F411EE033DBB18BA8234C5574883ACB9A75AF0FB90A9B82EA46AFA00">>}, {<<"rfc3339">>, <<"1552DF616ACA368D982E9F085A0E933B6688A3F4938A671798978EC2C0C58730">>}, - {<<"ssl_verify_fun">>, <<"28A4D65B7F59893BC2C7DE786DEC1E1555BD742D336043FE644AE956C3497FBE">>}]} + {<<"ssl_verify_fun">>, <<"F0EAFFF810D2041E93F915EF59899C923F4568F4585904D010387ED74988E77B">>}, + {<<"unicode_util_compat">>, <<"D869E4C68901DD9531385BB0C8C40444EBF624E60B6962D95952775CAC5E90CD">>}]} ]. diff --git a/src/dmt_client.app.src b/src/dmt_client.app.src index a3ddeea..5db9700 100644 --- a/src/dmt_client.app.src +++ b/src/dmt_client.app.src @@ -5,7 +5,6 @@ {applications, [ kernel, stdlib, - lager, woody, scoper, dmt_core diff --git a/src/dmt_client.erl b/src/dmt_client.erl index 6f35607..6e290d0 100644 --- a/src/dmt_client.erl +++ b/src/dmt_client.erl @@ -45,7 +45,7 @@ -type domain_object() :: dmsl_domain_thrift:'DomainObject'(). -type domain() :: dmsl_domain_thrift:'Domain'(). -type history() :: dmsl_domain_config_thrift:'History'(). --type transport_opts() :: woody_client_thrift_http_transport:options() | undefined. +-type transport_opts() :: woody_client_thrift_http_transport:transport_options() | undefined. %%% API diff --git a/src/dmt_client_api.erl b/src/dmt_client_api.erl index 38115ec..c4c7115 100644 --- a/src/dmt_client_api.erl +++ b/src/dmt_client_api.erl @@ -38,7 +38,7 @@ call(ServiceName, Function, Args, TransportOpts) -> Call = {Service, Function, Args}, Opts = #{ url => Url, - event_handler => scoper_woody_event_handler, + event_handler => get_event_handlers(), transport_opts => ensure_transport_opts(TransportOpts) }, Context = woody_context:new(), @@ -60,11 +60,17 @@ get_service_module('Repository') -> get_service_module('RepositoryClient') -> dmsl_domain_config_thrift. --spec ensure_transport_opts(dmt_client:transport_opts()) -> - woody_client_thrift_http_transport:options(). +get_event_handlers() -> + lists:umerge( + [scoper_woody_event_handler], + genlib_app:env(dmt_client, woody_event_handlers, []) + ). -ensure_transport_opts(Opts) when is_list(Opts) -> +-spec ensure_transport_opts(dmt_client:transport_opts()) -> + woody_client_thrift_http_transport:transport_options(). + +ensure_transport_opts(Opts) when is_map(Opts) -> Opts; ensure_transport_opts(undefined) -> - Default = [{recv_timeout, 60000}, {connect_timeout, 1000}], + Default = #{recv_timeout => 60000, connect_timeout => 1000}, genlib_app:env(dmt_client, transport_opts, Default). diff --git a/test/dmt_client_tests_SUITE.erl b/test/dmt_client_tests_SUITE.erl index 3afd165..6f5fae7 100644 --- a/test/dmt_client_tests_SUITE.erl +++ b/test/dmt_client_tests_SUITE.erl @@ -37,8 +37,8 @@ init_per_suite(C) -> memory => 2048 % 2Kb }}, {service_urls, #{ - 'Repository' => <<"dominant:8022/v1/domain/repository">>, - 'RepositoryClient' => <<"dominant:8022/v1/domain/repository_client">> + 'Repository' => <<"http://dominant:8022/v1/domain/repository">>, + 'RepositoryClient' => <<"http://dominant:8022/v1/domain/repository_client">> }} ]), [{apps, Apps}|C].