Skip to content

Commit

Permalink
fix bad ods keys
Browse files Browse the repository at this point in the history
Summary:
bad ODS on msgdbtest

```
Bad ODS key: raft.transport.file.send.error.badrecord.-576448691609.19551027200

Original metric: {'raft.transport.file.send',{error,{badrecord,{-576448691609,19551027200}}}}
```

Differential Revision: D65180264

fbshipit-source-id: 1b15a2940060a26628a8aabd181f32bb412b2175
  • Loading branch information
Sarah Hassan authored and facebook-github-bot committed Oct 29, 2024
1 parent 162c552 commit 98c697e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/wa_raft_transport.erl
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ handle_call(Request, _From, #state{} = State) ->
when Request :: {complete, ID :: transport_id(), FileID :: file_id(), Status :: term(), Pid :: pid()}.
handle_cast({complete, ID, FileID, Status, Pid}, #state{counters = Counters} = State) ->
NowMillis = erlang:system_time(millisecond),
?RAFT_COUNT({'raft.transport.file.send', Status}),
?RAFT_COUNT({'raft.transport.file.send', normalize_status(Status)}),
Result0 = update_file_info(ID, FileID,
fun (Info) ->
case Info of
Expand Down Expand Up @@ -852,3 +852,15 @@ scan_transport(_ID, Info) ->
-spec schedule_scan() -> reference().
schedule_scan() ->
erlang:send_after(?RAFT_TRANSPORT_SCAN_INTERVAL_SECS * 1000, self(), scan).

-spec normalize_status(term()) -> atom().
normalize_status(Status) when is_atom(Status) ->
Status;
normalize_status({_Error, Reason}) when is_atom(Reason) ->
Reason;
normalize_status({_Error, Reason}) when is_tuple(Reason) ->
normalize_status(element(1, Reason));
normalize_status({Error, _Reason}) when is_atom(Error) ->
Error;
normalize_status(_) ->
unknown.

0 comments on commit 98c697e

Please sign in to comment.