node: use promauto to auto-register metrics

Fixes certusone/wormhole#188

Change-Id: I26c0e3f05993e44185b6ee2531b7673f7fbc0eb6
This commit is contained in:
Leo 2021-07-23 16:06:35 +02:00 committed by Hendrik Hofstadt
parent fe48f05366
commit 514560f52c
10 changed files with 45 additions and 100 deletions

View File

@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"github.com/certusone/wormhole/bridge/pkg/p2p" "github.com/certusone/wormhole/bridge/pkg/p2p"
gossipv1 "github.com/certusone/wormhole/bridge/pkg/proto/gossip/v1" gossipv1 "github.com/certusone/wormhole/bridge/pkg/proto/gossip/v1"
"github.com/prometheus/client_golang/prometheus/promauto"
"math/big" "math/big"
"sync" "sync"
"time" "time"
@ -25,48 +26,39 @@ import (
) )
var ( var (
ethConnectionErrors = prometheus.NewCounterVec( ethConnectionErrors = promauto.NewCounterVec(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "wormhole_eth_connection_errors_total", Name: "wormhole_eth_connection_errors_total",
Help: "Total number of Ethereum connection errors (either during initial connection or while watching)", Help: "Total number of Ethereum connection errors (either during initial connection or while watching)",
}, []string{"reason"}) }, []string{"reason"})
ethMessagesObserved = prometheus.NewCounter( ethMessagesObserved = promauto.NewCounter(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "wormhole_eth_messages_observed_total", Name: "wormhole_eth_messages_observed_total",
Help: "Total number of Eth messages observed (pre-confirmation)", Help: "Total number of Eth messages observed (pre-confirmation)",
}) })
ethMessagesConfirmed = prometheus.NewCounter( ethMessagesConfirmed = promauto.NewCounter(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "wormhole_eth_messages_confirmed_total", Name: "wormhole_eth_messages_confirmed_total",
Help: "Total number of Eth messages verified (post-confirmation)", Help: "Total number of Eth messages verified (post-confirmation)",
}) })
guardianSetChangesConfirmed = prometheus.NewCounter( guardianSetChangesConfirmed = promauto.NewCounter(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "wormhole_eth_guardian_set_changes_confirmed_total", Name: "wormhole_eth_guardian_set_changes_confirmed_total",
Help: "Total number of guardian set changes verified (we only see confirmed ones to begin with)", Help: "Total number of guardian set changes verified (we only see confirmed ones to begin with)",
}) })
currentEthHeight = prometheus.NewGauge( currentEthHeight = promauto.NewGauge(
prometheus.GaugeOpts{ prometheus.GaugeOpts{
Name: "wormhole_eth_current_height", Name: "wormhole_eth_current_height",
Help: "Current Ethereum block height", Help: "Current Ethereum block height",
}) })
queryLatency = prometheus.NewHistogramVec( queryLatency = promauto.NewHistogramVec(
prometheus.HistogramOpts{ prometheus.HistogramOpts{
Name: "wormhole_eth_query_latency", Name: "wormhole_eth_query_latency",
Help: "Latency histogram for Ethereum calls (note that most interactions are streaming queries, NOT calls, and we cannot measure latency for those", Help: "Latency histogram for Ethereum calls (note that most interactions are streaming queries, NOT calls, and we cannot measure latency for those",
}, []string{"operation"}) }, []string{"operation"})
) )
func init() {
prometheus.MustRegister(ethConnectionErrors)
prometheus.MustRegister(ethMessagesObserved)
prometheus.MustRegister(ethMessagesConfirmed)
prometheus.MustRegister(guardianSetChangesConfirmed)
prometheus.MustRegister(currentEthHeight)
prometheus.MustRegister(queryLatency)
}
type ( type (
EthBridgeWatcher struct { EthBridgeWatcher struct {
url string url string

View File

@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"github.com/certusone/wormhole/bridge/pkg/version" "github.com/certusone/wormhole/bridge/pkg/version"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"strings" "strings"
"time" "time"
@ -30,29 +31,23 @@ import (
) )
var ( var (
p2pHeartbeatsSent = prometheus.NewCounter( p2pHeartbeatsSent = promauto.NewCounter(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "wormhole_p2p_heartbeats_sent_total", Name: "wormhole_p2p_heartbeats_sent_total",
Help: "Total number of p2p heartbeats sent", Help: "Total number of p2p heartbeats sent",
}) })
p2pMessagesSent = prometheus.NewCounter( p2pMessagesSent = promauto.NewCounter(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "wormhole_p2p_broadcast_messages_sent_total", Name: "wormhole_p2p_broadcast_messages_sent_total",
Help: "Total number of p2p pubsub broadcast messages sent", Help: "Total number of p2p pubsub broadcast messages sent",
}) })
p2pMessagesReceived = prometheus.NewCounterVec( p2pMessagesReceived = promauto.NewCounterVec(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "wormhole_p2p_broadcast_messages_received_total", Name: "wormhole_p2p_broadcast_messages_received_total",
Help: "Total number of p2p pubsub broadcast messages received", Help: "Total number of p2p pubsub broadcast messages received",
}, []string{"type"}) }, []string{"type"})
) )
func init() {
prometheus.MustRegister(p2pHeartbeatsSent)
prometheus.MustRegister(p2pMessagesSent)
prometheus.MustRegister(p2pMessagesReceived)
}
func Run(obsvC chan *gossipv1.SignedObservation, func Run(obsvC chan *gossipv1.SignedObservation,
sendC chan []byte, sendC chan []byte,
rawHeartbeatListeners *publicrpc.RawHeartbeatConns, rawHeartbeatListeners *publicrpc.RawHeartbeatConns,

View File

@ -3,6 +3,7 @@ package processor
import ( import (
"encoding/hex" "encoding/hex"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"time" "time"
ethcommon "github.com/ethereum/go-ethereum/common" ethcommon "github.com/ethereum/go-ethereum/common"
@ -14,17 +15,13 @@ import (
) )
var ( var (
observationsBroadcastTotal = prometheus.NewCounter( observationsBroadcastTotal = promauto.NewCounter(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "wormhole_observations_broadcast_total", Name: "wormhole_observations_broadcast_total",
Help: "Total number of signed observations queued for broadcast", Help: "Total number of signed observations queued for broadcast",
}) })
) )
func init() {
prometheus.MustRegister(observationsBroadcastTotal)
}
func (p *Processor) broadcastSignature(v *vaa.VAA, signature []byte) { func (p *Processor) broadcastSignature(v *vaa.VAA, signature []byte) {
digest, err := v.SigningMsg() digest, err := v.SigningMsg()
if err != nil { if err != nil {

View File

@ -4,53 +4,45 @@ import (
"context" "context"
"github.com/certusone/wormhole/bridge/pkg/common" "github.com/certusone/wormhole/bridge/pkg/common"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"time" "time"
"go.uber.org/zap" "go.uber.org/zap"
) )
var ( var (
aggregationStateEntries = prometheus.NewGauge( aggregationStateEntries = promauto.NewGauge(
prometheus.GaugeOpts{ prometheus.GaugeOpts{
Name: "wormhole_aggregation_state_entries", Name: "wormhole_aggregation_state_entries",
Help: "Current number of aggregation state entries (including unexpired succeed ones)", Help: "Current number of aggregation state entries (including unexpired succeed ones)",
}) })
aggregationStateExpiration = prometheus.NewCounter( aggregationStateExpiration = promauto.NewCounter(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "wormhole_aggregation_state_expirations_total", Name: "wormhole_aggregation_state_expirations_total",
Help: "Total number of expired submitted aggregation states", Help: "Total number of expired submitted aggregation states",
}) })
aggregationStateTimeout = prometheus.NewCounter( aggregationStateTimeout = promauto.NewCounter(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "wormhole_aggregation_state_timeout_total", Name: "wormhole_aggregation_state_timeout_total",
Help: "Total number of aggregation states expired due to timeout after exhausting retries", Help: "Total number of aggregation states expired due to timeout after exhausting retries",
}) })
aggregationStateRetries = prometheus.NewCounter( aggregationStateRetries = promauto.NewCounter(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "wormhole_aggregation_state_retries_total", Name: "wormhole_aggregation_state_retries_total",
Help: "Total number of aggregation states queued for resubmission", Help: "Total number of aggregation states queued for resubmission",
}) })
aggregationStateUnobserved = prometheus.NewCounter( aggregationStateUnobserved = promauto.NewCounter(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "wormhole_aggregation_state_unobserved_total", Name: "wormhole_aggregation_state_unobserved_total",
Help: "Total number of aggregation states expired due to no matching local message observations", Help: "Total number of aggregation states expired due to no matching local message observations",
}) })
aggregationStateFulfillment = prometheus.NewCounterVec( aggregationStateFulfillment = promauto.NewCounterVec(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "wormhole_aggregation_state_settled_signatures_total", Name: "wormhole_aggregation_state_settled_signatures_total",
Help: "Total number of signatures produced by a validator, counted after waiting a fixed amount of time", Help: "Total number of signatures produced by a validator, counted after waiting a fixed amount of time",
}, []string{"addr", "origin", "status"}) }, []string{"addr", "origin", "status"})
) )
func init() {
prometheus.MustRegister(aggregationStateEntries)
prometheus.MustRegister(aggregationStateExpiration)
prometheus.MustRegister(aggregationStateTimeout)
prometheus.MustRegister(aggregationStateRetries)
prometheus.MustRegister(aggregationStateUnobserved)
prometheus.MustRegister(aggregationStateFulfillment)
}
// handleCleanup handles periodic retransmissions and cleanup of VAAs // handleCleanup handles periodic retransmissions and cleanup of VAAs
func (p *Processor) handleCleanup(ctx context.Context) { func (p *Processor) handleCleanup(ctx context.Context) {
p.logger.Info("aggregation state summary", zap.Int("cached", len(p.state.vaaSignatures))) p.logger.Info("aggregation state summary", zap.Int("cached", len(p.state.vaaSignatures)))

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"encoding/hex" "encoding/hex"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"go.uber.org/zap" "go.uber.org/zap"
@ -13,17 +14,13 @@ import (
) )
var ( var (
vaaInjectionsTotal = prometheus.NewCounter( vaaInjectionsTotal = promauto.NewCounter(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "wormhole_vaa_injections_total", Name: "wormhole_vaa_injections_total",
Help: "Total number of injected VAA queued for broadcast", Help: "Total number of injected VAA queued for broadcast",
}) })
) )
func init() {
prometheus.MustRegister(vaaInjectionsTotal)
}
// handleInjection processes a pre-populated VAA injected locally. // handleInjection processes a pre-populated VAA injected locally.
func (p *Processor) handleInjection(ctx context.Context, v *vaa.VAA) { func (p *Processor) handleInjection(ctx context.Context, v *vaa.VAA) {
// Generate digest of the unsigned VAA. // Generate digest of the unsigned VAA.

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"encoding/hex" "encoding/hex"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"go.uber.org/zap" "go.uber.org/zap"
@ -17,14 +18,14 @@ var (
// SECURITY: source_chain/target_chain are untrusted uint8 values. An attacker could cause a maximum of 255**2 label // SECURITY: source_chain/target_chain are untrusted uint8 values. An attacker could cause a maximum of 255**2 label
// pairs to be created, which is acceptable. // pairs to be created, which is acceptable.
messagesObservedTotal = prometheus.NewCounterVec( messagesObservedTotal = promauto.NewCounterVec(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "wormhole_message_observations_total", Name: "wormhole_message_observations_total",
Help: "Total number of messages observed", Help: "Total number of messages observed",
}, },
[]string{"emitter_chain"}) []string{"emitter_chain"})
messagesSignedTotal = prometheus.NewCounterVec( messagesSignedTotal = promauto.NewCounterVec(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "wormhole_message_observations_signed_total", Name: "wormhole_message_observations_signed_total",
Help: "Total number of message observations that were successfully signed", Help: "Total number of message observations that were successfully signed",
@ -32,11 +33,6 @@ var (
[]string{"emitter_chain"}) []string{"emitter_chain"})
) )
func init() {
prometheus.MustRegister(messagesObservedTotal)
prometheus.MustRegister(messagesSignedTotal)
}
// handleMessage processes a message received from a chain and instantiates our deterministic copy of the VAA. An // handleMessage processes a message received from a chain and instantiates our deterministic copy of the VAA. An
// event may be received multiple times and must be handled in an idempotent fashion. // event may be received multiple times and must be handled in an idempotent fashion.
func (p *Processor) handleMessage(ctx context.Context, k *common.MessagePublication) { func (p *Processor) handleMessage(ctx context.Context, k *common.MessagePublication) {

View File

@ -6,6 +6,7 @@ import (
"fmt" "fmt"
bridge_common "github.com/certusone/wormhole/bridge/pkg/common" bridge_common "github.com/certusone/wormhole/bridge/pkg/common"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"time" "time"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
@ -17,47 +18,38 @@ import (
) )
var ( var (
observationsReceivedTotal = prometheus.NewCounter( observationsReceivedTotal = promauto.NewCounter(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "wormhole_observations_received_total", Name: "wormhole_observations_received_total",
Help: "Total number of raw VAA observations received from gossip", Help: "Total number of raw VAA observations received from gossip",
}) })
observationsReceivedByGuardianAddressTotal = prometheus.NewCounterVec( observationsReceivedByGuardianAddressTotal = promauto.NewCounterVec(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "wormhole_observations_signed_by_guardian_total", Name: "wormhole_observations_signed_by_guardian_total",
Help: "Total number of signed and verified VAA observations grouped by guardian address", Help: "Total number of signed and verified VAA observations grouped by guardian address",
}, []string{"addr"}) }, []string{"addr"})
observationsFailedTotal = prometheus.NewCounterVec( observationsFailedTotal = promauto.NewCounterVec(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "wormhole_observations_verification_failures_total", Name: "wormhole_observations_verification_failures_total",
Help: "Total number of observations verification failure, grouped by failure reason", Help: "Total number of observations verification failure, grouped by failure reason",
}, []string{"cause"}) }, []string{"cause"})
observationsUnknownTotal = prometheus.NewCounter( observationsUnknownTotal = promauto.NewCounter(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "wormhole_observations_unknown_total", Name: "wormhole_observations_unknown_total",
Help: "Total number of verified observations we haven't seen ourselves", Help: "Total number of verified observations we haven't seen ourselves",
}) })
observationsDirectSubmissionsTotal = prometheus.NewCounterVec( observationsDirectSubmissionsTotal = promauto.NewCounterVec(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "wormhole_observations_direct_submissions_queued_total", Name: "wormhole_observations_direct_submissions_queued_total",
Help: "Total number of observations for a specific target chain that were queued for direct submission", Help: "Total number of observations for a specific target chain that were queued for direct submission",
}, []string{"target_chain"}) }, []string{"target_chain"})
observationsDirectSubmissionSuccessTotal = prometheus.NewCounterVec( observationsDirectSubmissionSuccessTotal = promauto.NewCounterVec(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "wormhole_observations_direct_submission_success_total", Name: "wormhole_observations_direct_submission_success_total",
Help: "Total number of observations for a specific target chain that succeeded", Help: "Total number of observations for a specific target chain that succeeded",
}, []string{"target_chain"}) }, []string{"target_chain"})
) )
func init() {
prometheus.MustRegister(observationsReceivedTotal)
prometheus.MustRegister(observationsReceivedByGuardianAddressTotal)
prometheus.MustRegister(observationsFailedTotal)
prometheus.MustRegister(observationsUnknownTotal)
prometheus.MustRegister(observationsDirectSubmissionsTotal)
prometheus.MustRegister(observationsDirectSubmissionSuccessTotal)
}
// handleObservation processes a remote VAA observation, verifies it, checks whether the VAA has met quorum, // handleObservation processes a remote VAA observation, verifies it, checks whether the VAA has met quorum,
// and assembles and submits a valid VAA if possible. // and assembles and submits a valid VAA if possible.
func (p *Processor) handleObservation(ctx context.Context, m *gossipv1.SignedObservation) { func (p *Processor) handleObservation(ctx context.Context, m *gossipv1.SignedObservation) {

View File

@ -1,6 +1,7 @@
package publicrpc package publicrpc
import ( import (
"github.com/prometheus/client_golang/prometheus/promauto"
"math/rand" "math/rand"
"sync" "sync"
@ -12,17 +13,13 @@ import (
// track the number of active connections // track the number of active connections
var ( var (
currentPublicHeartbeatStreamsOpen = prometheus.NewGauge( currentPublicHeartbeatStreamsOpen = promauto.NewGauge(
prometheus.GaugeOpts{ prometheus.GaugeOpts{
Name: "wormhole_publicrpc_rawheartbeat_connections", Name: "wormhole_publicrpc_rawheartbeat_connections",
Help: "Current number of clients consuming gRPC raw heartbeat streams", Help: "Current number of clients consuming gRPC raw heartbeat streams",
}) })
) )
func init() {
prometheus.MustRegister(currentPublicHeartbeatStreamsOpen)
}
// RawHeartbeatConns holds the multiplexing state required for distribution of // RawHeartbeatConns holds the multiplexing state required for distribution of
// heartbeat messages to all the open connections. // heartbeat messages to all the open connections.
type RawHeartbeatConns struct { type RawHeartbeatConns struct {

View File

@ -14,6 +14,7 @@ import (
"github.com/mr-tron/base58" "github.com/mr-tron/base58"
"github.com/near/borsh-go" "github.com/near/borsh-go"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"go.uber.org/zap" "go.uber.org/zap"
"time" "time"
) )
@ -26,41 +27,33 @@ type SolanaWatcher struct {
} }
var ( var (
solanaConnectionErrors = prometheus.NewCounterVec( solanaConnectionErrors = promauto.NewCounterVec(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "wormhole_solana_connection_errors_total", Name: "wormhole_solana_connection_errors_total",
Help: "Total number of Solana connection errors", Help: "Total number of Solana connection errors",
}, []string{"reason"}) }, []string{"reason"})
solanaAccountSkips = prometheus.NewCounterVec( solanaAccountSkips = promauto.NewCounterVec(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "wormhole_solana_account_updates_skipped_total", Name: "wormhole_solana_account_updates_skipped_total",
Help: "Total number of account updates skipped due to invalid data", Help: "Total number of account updates skipped due to invalid data",
}, []string{"reason"}) }, []string{"reason"})
solanaMessagesConfirmed = prometheus.NewCounter( solanaMessagesConfirmed = promauto.NewCounter(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "wormhole_solana_observations_confirmed_total", Name: "wormhole_solana_observations_confirmed_total",
Help: "Total number of verified Solana observations found", Help: "Total number of verified Solana observations found",
}) })
currentSolanaHeight = prometheus.NewGauge( currentSolanaHeight = promauto.NewGauge(
prometheus.GaugeOpts{ prometheus.GaugeOpts{
Name: "wormhole_solana_current_height", Name: "wormhole_solana_current_height",
Help: "Current Solana slot height (at default commitment level, not the level used for observations)", Help: "Current Solana slot height (at default commitment level, not the level used for observations)",
}) })
queryLatency = prometheus.NewHistogramVec( queryLatency = promauto.NewHistogramVec(
prometheus.HistogramOpts{ prometheus.HistogramOpts{
Name: "wormhole_solana_query_latency", Name: "wormhole_solana_query_latency",
Help: "Latency histogram for Solana RPC calls", Help: "Latency histogram for Solana RPC calls",
}, []string{"operation", "commitment"}) }, []string{"operation", "commitment"})
) )
func init() {
prometheus.MustRegister(solanaConnectionErrors)
prometheus.MustRegister(solanaAccountSkips)
prometheus.MustRegister(solanaMessagesConfirmed)
prometheus.MustRegister(currentSolanaHeight)
prometheus.MustRegister(queryLatency)
}
func NewSolanaWatcher(wsUrl, rpcUrl string, bridgeAddress solana.PublicKey, messageEvents chan *common.MessagePublication) *SolanaWatcher { func NewSolanaWatcher(wsUrl, rpcUrl string, bridgeAddress solana.PublicKey, messageEvents chan *common.MessagePublication) *SolanaWatcher {
return &SolanaWatcher{bridge: bridgeAddress, wsUrl: wsUrl, rpcUrl: rpcUrl, messageEvent: messageEvents} return &SolanaWatcher{bridge: bridgeAddress, wsUrl: wsUrl, rpcUrl: rpcUrl, messageEvent: messageEvents}
} }

View File

@ -6,6 +6,7 @@ import (
"fmt" "fmt"
"github.com/certusone/wormhole/bridge/pkg/p2p" "github.com/certusone/wormhole/bridge/pkg/p2p"
gossipv1 "github.com/certusone/wormhole/bridge/pkg/proto/gossip/v1" gossipv1 "github.com/certusone/wormhole/bridge/pkg/proto/gossip/v1"
"github.com/prometheus/client_golang/prometheus/promauto"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"time" "time"
@ -36,35 +37,28 @@ type (
) )
var ( var (
terraConnectionErrors = prometheus.NewCounterVec( terraConnectionErrors = promauto.NewCounterVec(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "wormhole_terra_connection_errors_total", Name: "wormhole_terra_connection_errors_total",
Help: "Total number of Terra connection errors", Help: "Total number of Terra connection errors",
}, []string{"reason"}) }, []string{"reason"})
terraMessagesConfirmed = prometheus.NewCounter( terraMessagesConfirmed = promauto.NewCounter(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "wormhole_terra_messages_confirmed_total", Name: "wormhole_terra_messages_confirmed_total",
Help: "Total number of verified terra messages found", Help: "Total number of verified terra messages found",
}) })
currentTerraHeight = prometheus.NewGauge( currentTerraHeight = promauto.NewGauge(
prometheus.GaugeOpts{ prometheus.GaugeOpts{
Name: "wormhole_terra_current_height", Name: "wormhole_terra_current_height",
Help: "Current terra slot height (at default commitment level, not the level used for observations)", Help: "Current terra slot height (at default commitment level, not the level used for observations)",
}) })
queryLatency = prometheus.NewHistogramVec( queryLatency = promauto.NewHistogramVec(
prometheus.HistogramOpts{ prometheus.HistogramOpts{
Name: "wormhole_terra_query_latency", Name: "wormhole_terra_query_latency",
Help: "Latency histogram for terra RPC calls", Help: "Latency histogram for terra RPC calls",
}, []string{"operation"}) }, []string{"operation"})
) )
func init() {
prometheus.MustRegister(terraConnectionErrors)
prometheus.MustRegister(terraMessagesConfirmed)
prometheus.MustRegister(currentTerraHeight)
prometheus.MustRegister(queryLatency)
}
type clientRequest struct { type clientRequest struct {
JSONRPC string `json:"jsonrpc"` JSONRPC string `json:"jsonrpc"`
// A String containing the name of the method to be invoked. // A String containing the name of the method to be invoked.