Skip to content

Conversation

@bharath-123
Copy link
Collaborator

📝 Summary

Tag logs with relay URLs in getPayload for better readability.

we call getPayload parallely across multiple relays and it can get hard to identify which log is coming from which relay invocation. Tagging the logs by URLs can help us understand the logs better!

✅ I have run these commands

  • make lint
  • make test-race
  • go mod tidy


// If the request fails, try again a few times with 100ms between tries
resp, err := retry(requestCtx, m.requestMaxRetries, 100*time.Millisecond, func() (*http.Response, error) {
log = log.WithField("url", url)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was not right since it can cause a race condition with other getPayload invocations.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be better to create a new logger instance there, instead of adding url to every single log call?

ie. _log = log.WithField...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The log is a pointer and each go-routine would override that pointer. this can cause a race conditions amongst multiple getPayload calls where we see the wrong url for the wrong invocation.

@bharath-123 bharath-123 merged commit 7cfb628 into flashbots:develop Nov 11, 2025
2 of 3 checks passed
@bharath-123 bharath-123 deleted the add-urls-to-log branch November 11, 2025 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants