Skip to content

Commit da07c68

Browse files
authored
update latency metric from millisec to micro (#877)
1 parent 6f06257 commit da07c68

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

server/get_header.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ func (m *BoostService) getHeader(log *logrus.Entry, slot phase0.Slot, pubkey, pa
6969
"msIntoSlot": msIntoSlot,
7070
}).Infof("getHeader request start - %d milliseconds into slot %d", msIntoSlot, slot)
7171

72+
RecordMsIntoSlot(params.PathGetHeader, float64(msIntoSlot))
7273
var (
7374
mu sync.Mutex
7475
wg sync.WaitGroup
@@ -321,7 +322,7 @@ func (m *BoostService) sendGetHeaderRequest(
321322
start := time.Now()
322323

323324
resp, err := m.httpClientGetHeader.Do(req)
324-
RecordRelayLatency(params.PathGetHeader, relay.URL.Hostname(), float64(time.Since(start).Microseconds()))
325+
RecordRelayLatency(params.PathGetHeader, relay.URL.Hostname(), float64(time.Since(start).Milliseconds()))
325326
if err != nil {
326327
log.WithError(err).Warn("error calling getHeader on relay")
327328
return nil, ""

server/get_payload.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ func (m *BoostService) innerGetPayload(log *logrus.Entry, signedBlindedBeaconBlo
132132
"msIntoSlot": msIntoSlot,
133133
}).Infof("submitBlindedBlock request start - %d milliseconds into slot %d", msIntoSlot, slot)
134134

135+
// storing via function to not run into too many decision paths
136+
recordGetPayloadMsIntoSlot(version, msIntoSlot)
135137
// Get the bid!
136138
m.bidsLock.Lock()
137139
originalBid := m.bids[bidKey(slot, blockHash)]
@@ -231,7 +233,7 @@ func (m *BoostService) innerGetPayload(log *logrus.Entry, signedBlindedBeaconBlo
231233
innerLog.Debug("submitting signed blinded block")
232234
start := time.Now()
233235
resp, err := m.httpClientGetPayload.Do(req)
234-
RecordRelayLatency(endpoint, relay.URL.Hostname(), float64(time.Since(start).Microseconds()))
236+
RecordRelayLatency(endpoint, relay.URL.Hostname(), float64(time.Since(start).Milliseconds()))
235237
if err != nil {
236238
innerLog.WithError(err).Warnf("error calling getPayload%s on relay", versionToUse)
237239
return nil, err
@@ -696,6 +698,14 @@ func (m *BoostService) respondGetPayloadSSZ(w http.ResponseWriter, result *build
696698
// Other Functions
697699
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
698700

701+
func recordGetPayloadMsIntoSlot(version GetPayloadVersion, msIntoSlot uint64) {
702+
endpoint := params.PathGetPayload
703+
if version == GetPayloadV2 {
704+
endpoint = params.PathGetPayloadV2
705+
}
706+
RecordMsIntoSlot(endpoint, float64(msIntoSlot))
707+
}
708+
699709
// bidKey makes a map key for a specific bid
700710
func bidKey(slot phase0.Slot, blockHash phase0.Hash32) string {
701711
return fmt.Sprintf("%v%v", slot, blockHash)

server/register_validator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func (m *BoostService) registerValidator(log *logrus.Entry, regBytes []byte, hea
5353
// Send the request
5454
start := time.Now()
5555
resp, err := m.httpClientRegVal.Do(req)
56-
RecordRelayLatency(params.PathRegisterValidator, relay.URL.Hostname(), float64(time.Since(start).Microseconds()))
56+
RecordRelayLatency(params.PathRegisterValidator, relay.URL.Hostname(), float64(time.Since(start).Milliseconds()))
5757
if err != nil {
5858
log.WithError(err).Warn("error calling registerValidator on relay")
5959
respErrCh <- err

server/service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ func (m *BoostService) CheckRelays() int {
523523

524524
start := time.Now()
525525
code, err := SendHTTPRequest(context.Background(), m.httpClientGetHeader, http.MethodGet, url, "", nil, nil, nil)
526-
RecordRelayLatency(params.PathStatus, relay.URL.Hostname(), float64(time.Since(start).Microseconds()))
526+
RecordRelayLatency(params.PathStatus, relay.URL.Hostname(), float64(time.Since(start).Milliseconds()))
527527
if err != nil {
528528
log.WithError(err).Error("relay status error - request failed")
529529
return

0 commit comments

Comments
 (0)