Add session_lifetime metric

parent 56d8bac4
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment