Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HeaderDateMilliseconds for improved request timing tracking #748

Merged
merged 1 commit into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions server/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ const (
HeaderEthConsensusVersion = "Eth-Consensus-Version"
HeaderKeySlotUID = "X-MEVBoost-SlotID"
HeaderKeyVersion = "X-MEVBoost-Version"
HeaderStartTimeUnixMS = "X-MEVBoost-StartTimeUnixMS"
HeaderUserAgent = "User-Agent"
// Deprecated: replaced by HeaderDateMilliseconds below.
HeaderStartTimeUnixMS = "X-MEVBoost-StartTimeUnixMS"
HeaderUserAgent = "User-Agent"
// Header which communicates when a request was sent. Used to measure latency.
// Replaces HeaderStartTimeUnixMS above which may be dropped in a future release.
HeaderDateMilliseconds = "Date-Milliseconds"

MediaTypeJSON = "application/json"
MediaTypeOctetStream = "application/octet-stream"
Expand Down
1 change: 1 addition & 0 deletions server/get_header.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func (m *BoostService) getHeader(log *logrus.Entry, slot phase0.Slot, pubkey, pa
req.Header.Set(HeaderKeySlotUID, slotUID.String())
req.Header.Set(HeaderStartTimeUnixMS, startTime)
req.Header.Set(HeaderUserAgent, userAgent)
req.Header.Set(HeaderDateMilliseconds, startTime)

// Send the request
log.Debug("requesting header")
Expand Down
5 changes: 3 additions & 2 deletions server/get_payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ func processPayload[P Payload](m *BoostService, log *logrus.Entry, ua UserAgent,

// Add request headers
headers := map[string]string{
HeaderKeySlotUID: currentSlotUID,
HeaderStartTimeUnixMS: fmt.Sprintf("%d", time.Now().UTC().UnixMilli()),
HeaderKeySlotUID: currentSlotUID,
HeaderStartTimeUnixMS: fmt.Sprintf("%d", time.Now().UTC().UnixMilli()),
HeaderDateMilliseconds: fmt.Sprintf("%d", time.Now().UTC().UnixMilli()),
}

// Prepare for requests
Expand Down
Loading