8000 Node: Add reobservation metric by bruce-riley · Pull Request #4303 · wormhole-foundation/wormhole · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Node: Add reobservation metric #4303

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions node/pkg/watchers/algorand/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
gossipv1 "github.com/certusone/wormhole/node/pkg/proto/gossip/v1"
"github.com/certusone/wormhole/node/pkg/readiness"
"github.com/certusone/wormhole/node/pkg/supervisor"
"github.com/certusone/wormhole/node/pkg/watchers"
eth_common "github.com/ethereum/go-ethereum/common"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
Expand Down Expand Up @@ -169,6 +170,9 @@ func lookAtTxn(e *Watcher, t types.SignedTxnInBlock, b types.Block, logger *zap.
}

algorandMessagesConfirmed.Inc()
if isReobservation {
watchers.ReobservationsByChain.WithLabelValues("algorand", "std").Inc()
}

logger.Info("message observed",
zap.Time("timestamp", observation.Timestamp),
Expand Down
3 changes: 3 additions & 0 deletions node/pkg/watchers/aptos/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,9 @@ func (e *Watcher) observeData(logger *zap.Logger, data gjson.Result, nativeSeq u
}

aptosMessagesConfirmed.WithLabelValues(e.networkID).Inc()
if isReobservation {
watchers.ReobservationsByChain.WithLabelValues(e.chainID.String(), "std").Inc()
}

logger.Info("message observed",
zap.String("txHash", observation.TxIDString()),
Expand Down
2 changes: 2 additions & 0 deletions node/pkg/watchers/cosmwasm/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

"github.com/certusone/wormhole/node/pkg/p2p"
gossipv1 "github.com/certusone/wormhole/node/pkg/proto/gossip/v1"
"github.com/certusone/wormhole/node/pkg/watchers"
"github.com/prometheus/client_golang/prometheus/promauto"

"github.com/prometheus/client_golang/prometheus"
Expand Down Expand Up @@ -303,6 +304,7 @@ func (e *Watcher) Run(ctx context.Context) error {
msg.IsReobservation = true
e.msgC <- msg
messagesConfirmed.WithLabelValues(networkName).Inc()
watchers.ReobservationsByChain.WithLabelValues(networkName, "std").Inc()
}
}
}
Expand Down
9 changes: 5 additions & 4 deletions node/pkg/watchers/evm/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"sync/atomic"
"time"

"github.com/certusone/wormhole/node/pkg/watchers"
"github.com/certusone/wormhole/node/pkg/watchers/evm/connectors"
"github.com/certusone/wormhole/node/pkg/watchers/evm/connectors/ethabi"
"github.com/certusone/wormhole/node/pkg/watchers/interfaces"
Expand Down Expand Up @@ -620,8 +621,6 @@ func (w *Watcher) Run(parentCtx context.Context) error {
zap.String("txHash", txHash.String()),
zap.Error(pubErr),
)
} else {
ethMessagesConfirmed.WithLabelValues(w.networkName).Inc()
}
}
}
Expand Down Expand Up @@ -812,8 +811,6 @@ func (w *Watcher) postMessage(
zap.String("txHash", msg.TxIDString()),
zap.Error(pubErr),
)
} else {
ethMessagesConfirmed.WithLabelValues(w.networkName).Inc()
}
return
}
Expand Down Expand Up @@ -888,6 +885,10 @@ func (w *Watcher) verifyAndPublish(
}

w.msgC <- msg
ethMessagesConfirmed.WithLabelValues(w.networkName).Inc()
if msg.IsReobservation {
watchers.ReobservationsByChain.WithLabelValues(w.chainID.String(), "std").Inc()
}
return nil

}
Expand Down
4 changes: 4 additions & 0 deletions node/pkg/watchers/ibc/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/certusone/wormhole/node/pkg/p2p"
"github.com/certusone/wormhole/node/pkg/readiness"
"github.com/certusone/wormhole/node/pkg/supervisor"
"github.com/certusone/wormhole/node/pkg/watchers"
"github.com/certusone/wormhole/node/pkg/watchers/cosmwasm"
"github.com/wormhole-foundation/wormhole/sdk/vaa"

Expand Down Expand Up @@ -673,6 +674,9 @@ func (w *Watcher) processIbcReceivePublishEvent(evt *ibcReceivePublishEvent, obs

ce.msgC <- evt.Msg
messagesConfirmed.WithLabelValues(ce.chainName).Inc()
if evt.Msg.IsReobservation {
watchers.ReobservationsByChain.WithLabelValues(evt.Msg.EmitterChain.String(), "std").Inc()
}
return nil
}

Expand Down
5 changes: 5 additions & 0 deletions node/pkg/watchers/near/tx_processing.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"time"

"github.com/certusone/wormhole/node/pkg/common"
"github.com/certusone/wormhole/node/pkg/watchers"
"github.com/certusone/wormhole/node/pkg/watchers/near/nearapi"
eth_common "github.com/ethereum/go-ethereum/common"
"github.com/mr-tron/base58"
Expand Down Expand Up @@ -246,6 +247,10 @@ func (e *Watcher) processWormholeLog(logger *zap.Logger, _ context.Context, job
IsReobservation: job.isReobservation,
}

if job.isReobservation {
watchers.ReobservationsByChain.WithLabelValues("near", "std").Inc()
}

// tell everyone about it
job.hasWormholeMsg = true

Expand Down
4 changes: 4 additions & 0 deletions node/pkg/watchers/solana/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/certusone/wormhole/node/pkg/query"
"github.com/certusone/wormhole/node/pkg/readiness"
"github.com/certusone/wormhole/node/pkg/supervisor"
"github.com/certusone/wormhole/node/pkg/watchers"
eth_common "github.com/ethereum/go-ethereum/common"
"github.com/gagliardetto/solana-go"
lookup "github.com/gagliardetto/solana-go/programs/address-lookup-table"
Expand Down Expand Up @@ -1062,6 +1063,9 @@ func (s *SolanaWatcher) processMessageAccount(logger *zap.Logger, data []byte, a
}

solanaMessagesConfirmed.WithLabelValues(s.networkName).Inc()
if isReobservation {
watchers.ReobservationsByChain.WithLabelValues(s.chainID.String(), "std").Inc()
}

if logger.Level().Enabled(s.msgObservedLogLevel) {
logger.Log(s.msgObservedLogLevel, "message observed",
Expand Down
4 changes: 4 additions & 0 deletions node/pkg/watchers/solana/shim.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"time"

"github.com/certusone/wormhole/node/pkg/common"
"github.com/certusone/wormhole/node/pkg/watchers"
"github.com/gagliardetto/solana-go"
"github.com/gagliardetto/solana-go/rpc"
"github.com/near/borsh-go"
Expand Down Expand Up @@ -365,6 +366,9 @@ func (s *SolanaWatcher) shimProcessRest(
}

solanaMessagesConfirmed.WithLabelValues(s.networkName).Inc()
if isReobservation {
watchers.ReobservationsByChain.WithLabelValues(s.chainID.String(), "shim").Inc()
}

if logger.Level().Enabled(s.msgObservedLogLevel) {
logger.Log(s.msgObservedLogLevel, "message observed from shim",
Expand Down
4 changes: 4 additions & 0 deletions node/pkg/watchers/sui/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
gossipv1 "github.com/certusone/wormhole/node/pkg/proto/gossip/v1"
"github.com/certusone/wormhole/node/pkg/readiness"
"github.com/certusone/wormhole/node/pkg/supervisor"
"github.com/certusone/wormhole/node/pkg/watchers"

eth_common "github.com/ethereum/go-ethereum/common"
"github.com/prometheus/client_golang/prometheus"
Expand Down Expand Up @@ -274,6 +275,9 @@ func (e *Watcher) inspectBody(logger *zap.Logger, body SuiResult, isReobservatio
}

suiMessagesConfirmed.Inc()
if isReobservation {
watchers.ReobservationsByChain.WithLabelValues("sui", "std").Inc()
}

logger.Info("message observed",
zap.String("txHash", observation.TxIDString()),
Expand Down
10 changes: 10 additions & 0 deletions node/pkg/watchers/watchers.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"github.com/certusone/wormhole/node/pkg/query"
"github.com/certusone/wormhole/node/pkg/supervisor"
"github.com/certusone/wormhole/node/pkg/watchers/interfaces"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/wormhole-foundation/wormhole/sdk/vaa"
)

Expand All @@ -27,3 +29,11 @@ type WatcherConfig interface {
env common.Environment,
) (interfaces.L1Finalizer, supervisor.Runnable, interfaces.Reobserver, error)
}

var (
ReobservationsByChain = promauto.NewCounterVec(
prometheus.CounterOpts{
Name: "wormhole_reobservations_by_chain",
Help: "Total number of reobservations completed by chain and observation type",
}, []string{"chain", "type"})
)
Loading
0