Skip to content

Commit

Permalink
Merge pull request #7 from sygmaprotocol/mmuftic/remove-url-from-log
Browse files Browse the repository at this point in the history
fix: remove url from error on healthcheck calls
  • Loading branch information
MakMuftic authored Mar 21, 2024
2 parents e6fa281 + 8c3ff3d commit 57b332c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion internal/proxy/healthchecker.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package proxy

import (
"context"
"errors"
"log/slog"
"net/http"
"net/url"
"sync"
"time"

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

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

logger := config.Logger.With(
"provider", config.Name).With(
"network", networkName).With(
"process", "healthcheck",
)

healthchecker := &HealthChecker{
logger: config.Logger.With("nodeprovider", config.Name).With("network", networkName),
logger: logger,
client: client,
httpClient: &http.Client{},
config: config,
Expand All @@ -82,6 +90,11 @@ func (h *HealthChecker) checkBlockNumber(c context.Context) (uint64, error) {

err := h.client.CallContext(c, &blockNumber, "eth_blockNumber")
if err != nil {
var urlErr *url.Error
errors.As(err, &urlErr)
if urlErr.URL != "" {
urlErr.URL = ""
}
h.logger.Error("could not fetch block number", "error", err)

return 0, err
Expand Down

0 comments on commit 57b332c

Please sign in to comment.