Skip to content

Commit

Permalink
remove url from error on healthcheck calls
Browse files Browse the repository at this point in the history
  • Loading branch information
MakMuftic committed Mar 21, 2024
1 parent e6fa281 commit 4214529
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions 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,8 +90,12 @@ 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

Check failure on line 99 in internal/proxy/healthchecker.go

View workflow job for this annotation

GitHub Actions / lint

return with no blank line before (nlreturn)
}
h.logger.Debug("fetch block number completed", "blockNumber", uint64(blockNumber))
Expand Down

0 comments on commit 4214529

Please sign in to comment.