Skip to content

Commit 60ea4cb

Browse files
author
ttt161
committed
rework health checks
1 parent 4c692f0 commit 60ea4cb

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

apps/hellgate/src/hellgate.erl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ init([]) ->
5959

6060
get_api_child_spec(MachineHandlers, Opts) ->
6161
{ok, Ip} = inet:parse_address(genlib_app:env(?MODULE, ip, "::")),
62-
HealthRoutes = construct_health_routes(genlib_app:env(?MODULE, health_check, #{})),
62+
%HealthRoutes = construct_health_routes(genlib_app:env(?MODULE, health_check, #{})),
63+
HealthRoutes =
64+
construct_health_routes(liveness, genlib_app:env(?MODULE, health_check_liveness, #{})) ++
65+
construct_health_routes(readiness, genlib_app:env(?MODULE, health_check_readiness, #{})),
6366
EventHandlerOpts = genlib_app:env(?MODULE, scoper_event_handler_options, #{}),
6467
PrometeusRoute = get_prometheus_route(),
6568
woody_server:child_spec(
@@ -81,8 +84,10 @@ get_api_child_spec(MachineHandlers, Opts) ->
8184
}
8285
).
8386

84-
construct_health_routes(Check) ->
85-
[erl_health_handle:get_route(enable_health_logging(Check))].
87+
construct_health_routes(liveness, Check) ->
88+
[erl_health_handle:get_liveness_route(enable_health_logging(Check))];
89+
construct_health_routes(readiness, Check) ->
90+
[erl_health_handle:get_readiness_route(enable_health_logging(Check))].
8691

8792
enable_health_logging(Check) ->
8893
EvHandler = {erl_health_event_handler, []},

config/sys.config

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,23 @@
6262
{proxy_opts, #{
6363
transport_opts => #{}
6464
}},
65-
{health_check, #{
66-
disk => {erl_health, disk, ["/", 99]},
65+
%{health_check, #{
66+
% disk => {erl_health, disk, ["/", 99]},
67+
% memory => {erl_health, cg_memory, [70]},
68+
% service => {erl_health, service, [<<"{{ service_name }}">>]},
69+
% dmt_client => {dmt_client, health_check, [<<"hellgate">>]}
70+
%}},
71+
{health_check_liveness, #{
6772
memory => {erl_health, cg_memory, [70]},
68-
service => {erl_health, service, [<<"{{ service_name }}">>]},
69-
dmt_client => {dmt_client, health_check, [<<"hellgate">>]}
73+
service => {erl_health, service, [<<"{{ service_name }}">>]}
74+
}},
75+
{health_check_readiness, #{
76+
dmt_client => {dmt_client, health_check, [<<"hellgate">>]},
77+
progressor =>
78+
{progressor, health_check, [
79+
%% list of progressors namespaces for tests
80+
[invoice_template]
81+
]}
7082
}},
7183
{payment_retry_policy, #{
7284
processed => {exponential, {max_total_timeout, 30}, 2, 1},

0 commit comments

Comments
 (0)