mirror of
https://github.com/status-im/status-go.git
synced 2025-01-14 00:36:40 +00:00
6cdea4ef97
* Update project to use Whisper v6. Part of #638 * Revert "Add patch to downgrade usage of Whisper v6 to v5 in some geth 1.8.1 vendor files. Part of #665" - this reverts commit 6aefb4c8fd02dbcfffac6b69e8bb22b13ef86b6b. * Enable light mode on Whisper v6 for non-mail servers. Part of #638 * Fix race condition in whisperv6/peer.go. Part of #665 (PR already accepted upstream for 1.8.2) * Update bootnode addresses in staticnodes.json. Part of #638 * Add `shh.lightclient` flag and tests for bloom filter setting logic. Part of #638 * Move MakeTestNodeConfig to utils. Part of #638 * Reduce PoW in `whisper_jail_test.go` to fix flaky test. Part of #638
33 lines
837 B
Go
33 lines
837 B
Go
// +build metrics,!prometheus
|
|
|
|
// Package whisper collects Whisper envelope metrics using expvar.
|
|
package whisper
|
|
|
|
import (
|
|
"expvar"
|
|
|
|
whisper "github.com/ethereum/go-ethereum/whisper/whisperv6"
|
|
)
|
|
|
|
var (
|
|
counter = expvar.NewInt("envelope_counter")
|
|
counterNew = expvar.NewInt("envelope_new_counter")
|
|
counterTopic = expvar.NewMap("envelope_topic_counter")
|
|
counterPeer = expvar.NewMap("envelope_peer_counter")
|
|
volume = expvar.NewInt("envelope_volume")
|
|
)
|
|
|
|
// EnvelopeTracer traces incoming envelopes.
|
|
type EnvelopeTracer struct{}
|
|
|
|
// Trace is called for every incoming envelope.
|
|
func (t *EnvelopeTracer) Trace(envelope *whisper.EnvelopeMeta) {
|
|
counter.Add(1)
|
|
if envelope.IsNew {
|
|
counterNew.Add(1)
|
|
}
|
|
counterTopic.Add(envelope.Topic.String(), 1)
|
|
counterPeer.Add(envelope.Peer, 1)
|
|
volume.Add(int64(envelope.Size))
|
|
}
|