@@ -529,10 +529,16 @@ handle_call(Request, _From, #state{} = State) ->
529
529
- spec handle_cast (Request , State :: # state {}) -> {noreply , NewState :: # state {}}
530
530
when Request :: {complete , ID :: transport_id (), FileID :: file_id (), Status :: term (), Pid :: pid ()}.
531
531
handle_cast ({complete , ID , FileID , Status , Pid }, # state {counters = Counters } = State ) ->
532
- ? RAFT_COUNT ('raft.transport.file.complete' ),
533
532
NowMillis = erlang :system_time (millisecond ),
533
+ ? RAFT_COUNT ({'raft.transport.file.send' , Status }),
534
534
Result0 = update_file_info (ID , FileID ,
535
535
fun (Info ) ->
536
+ case Info of
537
+ #{start_ts := StartMillis } ->
538
+ ? RAFT_GATHER_LATENCY ({'raft.transport.file.send' , Status , latency_ms }, NowMillis - StartMillis );
539
+ _ ->
540
+ ok
541
+ end ,
536
542
case Status of
537
543
ok -> Info #{status => completed , end_ts => NowMillis };
538
544
_ -> Info #{status => failed , end_ts => NowMillis , error => Status }
@@ -824,8 +830,9 @@ maybe_notify_complete(ID, _Info, #state{}) ->
824
830
[ID ], #{domain => [whatsapp , wa_raft ]}).
825
831
826
832
- spec maybe_notify (transport_id (), transport_info ()) -> transport_info ().
827
- maybe_notify (ID , #{status := Status , notify := Notify } = Info ) when Status =/= requested andalso Status =/= running ->
828
- ? RAFT_COUNT ('raft.transport.complete' ),
833
+ maybe_notify (ID , #{status := Status , notify := Notify , start_ts := Start , end_ts := End } = Info ) when Status =/= requested andalso Status =/= running ->
834
+ ? RAFT_COUNT ({'raft.transport' , Status }),
835
+ ? RAFT_GATHER_LATENCY ({'raft.transport' , Status , latency_ms }, End - Start ),
829
836
gen_server :reply (Notify , {ok , ID }),
830
837
maps :remove (notify , Info );
831
838
maybe_notify (_ID , Info ) ->
0 commit comments