diff --git a/cmd/api/main.go b/cmd/api/main.go index ee1914c0..e27d1ad1 100644 --- a/cmd/api/main.go +++ b/cmd/api/main.go @@ -62,7 +62,7 @@ func main() { msgSender, err := blockchain.NewMsgSender(log, cfg.App.LiteServers, map[string]chan<- blockchain.ExtInMsgCopy{ "mempool": mempoolCh, - }) + }, nil) if err != nil { log.Fatal("failed to create msg sender", zap.Error(err)) } diff --git a/pkg/blockchain/msg_sender.go b/pkg/blockchain/msg_sender.go index f8e99483..83456284 100644 --- a/pkg/blockchain/msg_sender.go +++ b/pkg/blockchain/msg_sender.go @@ -7,10 +7,7 @@ import ( "sync" "time" - "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promauto" "github.com/sourcegraph/conc/iter" - "github.com/tonkeeper/tongo" "github.com/tonkeeper/tongo/config" "github.com/tonkeeper/tongo/liteapi" @@ -50,10 +47,6 @@ type ExtInMsgCopy struct { Accounts map[tongo.AccountID]struct{} } -var liteserverMessageSendMc = promauto.NewCounterVec(prometheus.CounterOpts{ - Name: "liteserver_message_send", -}, []string{"server", "result", "iteration"}) - func (m *ExtInMsgCopy) IsEmulation() bool { return len(m.Accounts) > 0 } @@ -91,7 +84,6 @@ func NewMsgSender(logger *zap.Logger, servers []config.LiteServer, receivers map if len(clients) == 0 { return nil, fmt.Errorf("no lite clients available") } - msgSender := &MsgSender{ sendingClients: clients, logger: logger, @@ -161,10 +153,8 @@ func (ms *MsgSender) send(ctx context.Context, payload []byte) error { c := ms.sendingClients[serverNumber] _, err = c.SendMessage(ctx, payload) if err == nil { - liteserverMessageSendMc.WithLabelValues(fmt.Sprintf("%d", serverNumber), "success", fmt.Sprintf("%d", i)).Inc() return nil } - liteserverMessageSendMc.WithLabelValues(fmt.Sprintf("%d", serverNumber), "error", fmt.Sprintf("%d", i)).Inc() } return err } @@ -197,3 +187,11 @@ func (ms *MsgSender) SendMultipleMessages(ctx context.Context, copies []ExtInMsg func (ms *MsgSender) SendingClientsNumber() int { return len(ms.sendingClients) } + +func (ms *MsgSender) GetReceivers() map[string]chan<- ExtInMsgCopy { + return ms.receivers +} + +func (ms *MsgSender) GetClients() []*liteapi.Client { + return ms.sendingClients +}