Skip to content

Commit 57b332c

Browse files
authored
Merge pull request #7 from sygmaprotocol/mmuftic/remove-url-from-log
fix: remove url from error on healthcheck calls
2 parents e6fa281 + 8c3ff3d commit 57b332c

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

internal/proxy/healthchecker.go

+14-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ package proxy
22

33
import (
44
"context"
5+
"errors"
56
"log/slog"
67
"net/http"
8+
"net/url"
79
"sync"
810
"time"
911

@@ -60,8 +62,14 @@ func NewHealthChecker(config HealthCheckerConfig, networkName string) (*HealthCh
6062

6163
client.SetHeader("User-Agent", userAgent)
6264

65+
logger := config.Logger.With(
66+
"provider", config.Name).With(
67+
"network", networkName).With(
68+
"process", "healthcheck",
69+
)
70+
6371
healthchecker := &HealthChecker{
64-
logger: config.Logger.With("nodeprovider", config.Name).With("network", networkName),
72+
logger: logger,
6573
client: client,
6674
httpClient: &http.Client{},
6775
config: config,
@@ -82,6 +90,11 @@ func (h *HealthChecker) checkBlockNumber(c context.Context) (uint64, error) {
8290

8391
err := h.client.CallContext(c, &blockNumber, "eth_blockNumber")
8492
if err != nil {
93+
var urlErr *url.Error
94+
errors.As(err, &urlErr)
95+
if urlErr.URL != "" {
96+
urlErr.URL = ""
97+
}
8598
h.logger.Error("could not fetch block number", "error", err)
8699

87100
return 0, err

0 commit comments

Comments
 (0)