Fix one more place w/ healthcheck setup (#115)

This commit is contained in:
Andrew Mayorov 2019-08-22 17:33:39 +03:00 committed by GitHub
parent 1324833ac2
commit f849b9d4b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 10 deletions

View File

@ -71,7 +71,7 @@ init([]) ->
IpEnv = genlib_app:env(?MODULE, ip, "::0"),
Port = genlib_app:env(?MODULE, port, 8022),
HealthCheckers = genlib_app:env(?MODULE, health_checkers, []),
HealthCheck = genlib_app:env(?MODULE, health_check, #{}),
WoodyOptsEnv = genlib_app:env(?MODULE, woody_opts, #{}),
RouteOptsEnv = genlib_app:env(?MODULE, route_opts, #{}),
@ -101,7 +101,7 @@ init([]) ->
Routes ++
get_eventsink_routes() ++
get_repair_routes(WoodyOpts) ++
[erl_health_handle:get_route(HealthCheckers)]
[erl_health_handle:get_route(enable_health_logging(HealthCheck))]
}
)
),
@ -109,6 +109,13 @@ init([]) ->
% - Zero thoughts given while defining this strategy.
{ok, {#{strategy => one_for_one}, [ChildSpec]}}.
-spec enable_health_logging(erl_health:check()) ->
erl_health:check().
enable_health_logging(Check) ->
EvHandler = {erl_health_event_handler, []},
maps:map(fun (_, V = {_, _, _}) -> #{runner => V, event_handler => EvHandler} end, Check).
-spec get_routes({binary(), woody:th_handler(), map()}) ->
[woody_server_thrift_http_handler:route(_)].

View File

@ -132,9 +132,9 @@
}
}
}},
{health_checkers, [
{erl_health, service , [<<"wapi">>]}
]},
{health_check, #{
service => {erl_health, service , [<<"wapi">>]}
}},
{max_deadline, 60000}, % milliseconds
{file_storage_url_lifetime, 60} % seconds
]},
@ -183,11 +183,11 @@
% Bump keepalive timeout up to a minute
{timeout, 60000}
]},
{health_checkers, [
{erl_health, disk , ["/", 99] },
{erl_health, cg_memory, [99] },
{erl_health, service , [<<"fistful-server">>]}
]},
{health_check, #{
disk => {erl_health, disk , ["/", 99] },
memory => {erl_health, cg_memory, [99] },
service => {erl_health, service , [<<"fistful-server">>]}
}},
{eventsink, #{
identity => #{
namespace => <<"ff/identity">>,