TD-788: Adds setup for woody prometheus collectors (#23)

* TD-788: Adds setup for woody prometheus collectors

* Bumps deps and fixes machinery contract

* Temporarily disables codecov report upload
This commit is contained in:
Aleksey Kashapov 2024-04-19 13:26:38 +03:00 committed by GitHub
parent a3b227f398
commit 1c082e671d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 27 additions and 7 deletions

View File

@ -37,3 +37,4 @@ jobs:
use-thrift: true use-thrift: true
thrift-version: ${{ needs.setup.outputs.thrift-version }} thrift-version: ${{ needs.setup.outputs.thrift-version }}
run-ct-with-compose: true run-ct-with-compose: true
upload-coverage: false

View File

@ -34,6 +34,7 @@ stop() ->
-spec start(normal, any()) -> {ok, pid()} | {error, any()}. -spec start(normal, any()) -> {ok, pid()} | {error, any()}.
start(_StartType, _StartArgs) -> start(_StartType, _StartArgs) ->
ok = setup_metrics(),
supervisor:start_link({local, ?MODULE}, ?MODULE, []). supervisor:start_link({local, ?MODULE}, ?MODULE, []).
-spec stop(any()) -> ok. -spec stop(any()) -> ok.
@ -134,3 +135,7 @@ enable_health_logging(Check) ->
-spec get_prometheus_route() -> {iodata(), module(), _Opts :: any()}. -spec get_prometheus_route() -> {iodata(), module(), _Opts :: any()}.
get_prometheus_route() -> get_prometheus_route() ->
{"/metrics/[:registry]", prometheus_cowboy2_handler, []}. {"/metrics/[:registry]", prometheus_cowboy2_handler, []}.
setup_metrics() ->
ok = woody_ranch_prometheus_collector:setup(),
ok = woody_hackney_prometheus_collector:setup().

View File

@ -14,6 +14,7 @@
-export([process_call/4]). -export([process_call/4]).
-export([process_timeout/3]). -export([process_timeout/3]).
-export([process_repair/4]). -export([process_repair/4]).
-export([process_notification/4]).
-type external_id() :: binary(). -type external_id() :: binary().
-type internal_id() :: binary() | {binary(), pos_integer()}. -type internal_id() :: binary() | {binary(), pos_integer()}.
@ -86,6 +87,10 @@ process_timeout(_Machine, _HandlerArgs, _HandlerOpts) ->
process_repair(_Args, _Machine, _HandlerArgs, _HandlerOpts) -> process_repair(_Args, _Machine, _HandlerArgs, _HandlerOpts) ->
not_implemented(repair). not_implemented(repair).
-spec process_notification(args(_), machine(), handler_args(), handler_opts()) -> no_return().
process_notification(_Args, _Machine, _HandlerArgs, _HandlerOpts) ->
not_implemented(notification).
%%% Internal functions %%% Internal functions
-spec start(external_id(), internal_id(), user_context(), woody_context()) -> ok | {error, exists}. -spec start(external_id(), internal_id(), user_context(), woody_context()) -> ok | {error, exists}.

View File

@ -14,6 +14,7 @@
-export([process_call/4]). -export([process_call/4]).
-export([process_timeout/3]). -export([process_timeout/3]).
-export([process_repair/4]). -export([process_repair/4]).
-export([process_notification/4]).
-type id() :: binary(). -type id() :: binary().
-type minimum() :: integer() | undefined. -type minimum() :: integer() | undefined.
@ -99,6 +100,10 @@ process_timeout(_Machine, _HandlerArgs, _HandlerOpts) ->
process_repair(_Args, _Machine, _HandlerArgs, _HandlerOpts) -> process_repair(_Args, _Machine, _HandlerArgs, _HandlerOpts) ->
not_implemented(repair). not_implemented(repair).
-spec process_notification(args(_), machine(), handler_args(), handler_opts()) -> no_return().
process_notification(_Args, _Machine, _HandlerArgs, _HandlerOpts) ->
not_implemented(notification).
%%% Internal functions %%% Internal functions
-spec start(id(), init_args(), woody_context()) -> ok | {error, exists}. -spec start(id(), init_args(), woody_context()) -> ok | {error, exists}.

View File

@ -106,5 +106,9 @@
{prometheus, [ {prometheus, [
{collectors, [default]} {collectors, [default]}
]},
{hackney, [
{mod_metrics, woody_hackney_prometheus}
]} ]}
]. ].

View File

@ -3,7 +3,7 @@
{<<"acceptor_pool">>,{pkg,<<"acceptor_pool">>,<<"1.0.0">>},2}, {<<"acceptor_pool">>,{pkg,<<"acceptor_pool">>,<<"1.0.0">>},2},
{<<"bender_proto">>, {<<"bender_proto">>,
{git,"https://github.com/valitydev/bender-proto.git", {git,"https://github.com/valitydev/bender-proto.git",
{ref,"71c56878c1cf154cdfab9bbc563ddba25abe7259"}}, {ref,"753b935b52a52e41b571d6e580f7dfe1377364f1"}},
0}, 0},
{<<"cache">>,{pkg,<<"cache">>,<<"2.3.3">>},1}, {<<"cache">>,{pkg,<<"cache">>,<<"2.3.3">>},1},
{<<"certifi">>,{pkg,<<"certifi">>,<<"2.8.0">>},2}, {<<"certifi">>,{pkg,<<"certifi">>,<<"2.8.0">>},2},
@ -17,7 +17,7 @@
{<<"ctx">>,{pkg,<<"ctx">>,<<"0.6.0">>},2}, {<<"ctx">>,{pkg,<<"ctx">>,<<"0.6.0">>},2},
{<<"erl_health">>, {<<"erl_health">>,
{git,"https://github.com/valitydev/erlang-health.git", {git,"https://github.com/valitydev/erlang-health.git",
{ref,"7ffbc855bdbe79e23efad1803b0b185c9ea8d2f1"}}, {ref,"49716470d0e8dab5e37db55d52dea78001735a3d"}},
0}, 0},
{<<"genlib">>, {<<"genlib">>,
{git,"https://github.com/valitydev/genlib.git", {git,"https://github.com/valitydev/genlib.git",
@ -31,12 +31,12 @@
{<<"jsx">>,{pkg,<<"jsx">>,<<"3.1.0">>},1}, {<<"jsx">>,{pkg,<<"jsx">>,<<"3.1.0">>},1},
{<<"machinery">>, {<<"machinery">>,
{git,"https://github.com/valitydev/machinery-erlang.git", {git,"https://github.com/valitydev/machinery-erlang.git",
{ref,"62c32434c80a462956ad9d50f9bce47836580d77"}}, {ref,"19cdc6c846f0ebf65ae193ca0988e353e53fe1d5"}},
0}, 0},
{<<"metrics">>,{pkg,<<"metrics">>,<<"1.0.1">>},2}, {<<"metrics">>,{pkg,<<"metrics">>,<<"1.0.1">>},2},
{<<"mg_proto">>, {<<"mg_proto">>,
{git,"https://github.com/valitydev/machinegun-proto.git", {git,"https://github.com/valitydev/machinegun-proto",
{ref,"a411c7d5d779389c70d2594eb4a28a916dce1721"}}, {ref,"96f7f11b184c29d8b7e83cd7646f3f2c13662bda"}},
1}, 1},
{<<"mimerl">>,{pkg,<<"mimerl">>,<<"1.2.0">>},2}, {<<"mimerl">>,{pkg,<<"mimerl">>,<<"1.2.0">>},2},
{<<"msgpack_proto">>, {<<"msgpack_proto">>,
@ -59,7 +59,7 @@
{<<"ranch">>,{pkg,<<"ranch">>,<<"1.8.0">>},2}, {<<"ranch">>,{pkg,<<"ranch">>,<<"1.8.0">>},2},
{<<"scoper">>, {<<"scoper">>,
{git,"https://github.com/valitydev/scoper.git", {git,"https://github.com/valitydev/scoper.git",
{ref,"41a14a558667316998af9f49149ee087ffa8bef2"}}, {ref,"55a2a32ee25e22fa35f583a18eaf38b2b743429b"}},
0}, 0},
{<<"snowflake">>, {<<"snowflake">>,
{git,"https://github.com/valitydev/snowflake.git", {git,"https://github.com/valitydev/snowflake.git",
@ -76,7 +76,7 @@
{<<"unicode_util_compat">>,{pkg,<<"unicode_util_compat">>,<<"0.7.0">>},2}, {<<"unicode_util_compat">>,{pkg,<<"unicode_util_compat">>,<<"0.7.0">>},2},
{<<"woody">>, {<<"woody">>,
{git,"https://github.com/valitydev/woody_erlang.git", {git,"https://github.com/valitydev/woody_erlang.git",
{ref,"5d46291a6bfcee0bae2a9346a7d927603a909249"}}, {ref,"81219ba5408e1c67f5eaed3c7e566ede42da88d4"}},
0}]}. 0}]}.
[ [
{pkg_hash,[ {pkg_hash,[