Enable healthcheck logging
This commit is contained in:
Andrew Mayorov 2019-08-19 12:22:30 +03:00 committed by GitHub
parent 1e9172cf27
commit b33bc9b89c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -21,7 +21,7 @@
0},
{<<"erl_health">>,
{git,"https://github.com/rbkmoney/erlang-health.git",
{ref,"2575c7b63d82a92de54d2d27e504413675e64811"}},
{ref,"c190cb8de0359b933a27cd20ddc74180c0e5f5c4"}},
0},
{<<"genlib">>,
{git,"https://github.com/rbkmoney/genlib.git",

View File

@ -24,7 +24,7 @@ stop(_State) ->
init(_) ->
{ok, IP} = inet:parse_address(genlib_app:env(?MODULE, ip, "::")),
HealthCheckers = genlib_app:env(?MODULE, health_checkers, []),
HealthCheck = enable_health_logging(genlib_app:env(?MODULE, health_check, #{})),
API = woody_server:child_spec(
?MODULE,
#{
@ -34,7 +34,7 @@ init(_) ->
event_handler => scoper_woody_event_handler,
handlers => get_repository_handlers(),
additional_routes => [
erl_health_handle:get_route(HealthCheckers)
erl_health_handle:get_route(HealthCheck)
]
}
),
@ -70,3 +70,10 @@ get_handler_spec(state_processor, Mod) ->
{mg_proto_state_processing_thrift, 'Processor'},
{dmt_api_automaton_handler, Mod}
}}.
-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).