[hotfix] refine read message latency metrics
context
- we are observing suspciously high read latency measurements (read times of several minutes for messages that signalboost instrumentation tells us only take 30 sec to send)
- hypothesis: since we are counting on every iteration of the
readMessage
while loop, we are counting the number of seconds spent waiting for messages (sinceread
is blocking) in addition to the amount of time spent processing them
changes
- fix: stick the beginning of the read timer inside the callback to
messagePipe.read
, so we only start measuring once we know we have a message - trade-off: con - we will not measure the amount of time signal spends parsing an envelope from the raw byte array (but this seems uninteresting?), pro - we have a tightly bound measure of all the processing time that is attributable to signald
side effects
- extract metrics builders to a singleton class
- add counters for:
- times read callback is invoked
- times messagePipe.read times out
Edited by aguestuser