mirror of
https://github.com/seriyps/mtproto_proxy.git
synced 2026-08-04 07:08:10 +00:00
Add session_lifetime metric
This commit is contained in:
parent
56d8bac4ea
commit
ea6c692ae5
1 changed files with 5 additions and 1 deletions
|
|
@ -168,8 +168,12 @@ handle_info(Other, S) ->
|
|||
lager:warning("Unexpected handle_info ~p", [Other]),
|
||||
{noreply, S}.
|
||||
|
||||
terminate(_Reason, #state{}) ->
|
||||
terminate(_Reason, #state{started_at = Started}) ->
|
||||
mtp_metric:count_inc([?APP, in_connection_closed, total], 1, #{}),
|
||||
Lifetime = erlang:system_time(millisecond) - Started,
|
||||
metric:histogram_observe(
|
||||
[?APP, session_lifetime, seconds],
|
||||
erlang:convert_time_unit(Lifetime, millisecond, native), #{}),
|
||||
lager:debug("terminate ~p", [_Reason]),
|
||||
ok.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue