feat: hibernate after send data to prometheus push_gateway

This commit is contained in:
Zhongwen Deng 2022-10-25 12:27:25 +08:00
parent 8578024637
commit 4c5e64d5a3
1 changed files with 2 additions and 1 deletions

View File

@ -147,7 +147,8 @@ handle_info({timeout, R, ?TIMER_MSG}, State = #state{timer = R, push_gateway = U
Url = lists:concat([Uri, "/metrics/job/", Name, "/instance/", Name, "~", Ip]),
Data = prometheus_text_format:format(),
httpc:request(post, {Url, [], "text/plain", Data}, [{autoredirect, true}], []),
{noreply, ensure_timer(State)};
%% Data is too big, hibernate for saving memory and stop system monitor warning.
{noreply, ensure_timer(State), hibernate};
handle_info(_Msg, State) ->
{noreply, State}.