From 8b33817684b67b6b9e787e7905dd29f176725057 Mon Sep 17 00:00:00 2001 From: Clara van Staden Date: Thu, 17 Oct 2024 11:20:22 +0200 Subject: [PATCH] Adds Beacon State download time log (#1312) * adds log * imports * space --- relayer/relays/beacon/header/syncer/api/api.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/relayer/relays/beacon/header/syncer/api/api.go b/relayer/relays/beacon/header/syncer/api/api.go index 6b68b95cee..9aaf558cb4 100644 --- a/relayer/relays/beacon/header/syncer/api/api.go +++ b/relayer/relays/beacon/header/syncer/api/api.go @@ -9,8 +9,10 @@ import ( "net/http" "strconv" "strings" + "time" "github.com/ethereum/go-ethereum/common" + log "github.com/sirupsen/logrus" "github.com/snowfork/snowbridge/relayer/relays/util" ) @@ -410,7 +412,13 @@ func (b *BeaconClient) GetBeaconState(stateIdOrSlot string) ([]byte, error) { } req.Header.Add("Accept", "application/octet-stream") + + startTime := time.Now() res, err := b.httpClient.Do(req) + endTime := time.Now() + duration := endTime.Sub(startTime) + log.WithFields(log.Fields{"startTime": startTime.Format(time.UnixDate), "endTime": endTime.Format(time.UnixDate), "duration": duration.Seconds()}).Warn("beacon state download time") + if err != nil { return data, err }