From b3670cae1e7941f0d5c5bc1c92e2fe53a000a1d9 Mon Sep 17 00:00:00 2001 From: manojkgorle Date: Fri, 19 Jul 2024 06:57:41 +0000 Subject: [PATCH] metrics --- cmd/token-cli/cmd/root.go | 5 ++--- controller/controller.go | 6 ++++++ controller/metrics.go | 28 ++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/cmd/token-cli/cmd/root.go b/cmd/token-cli/cmd/root.go index ed1727f..9b08364 100644 --- a/cmd/token-cli/cmd/root.go +++ b/cmd/token-cli/cmd/root.go @@ -184,7 +184,6 @@ func init() { ) spamCmd.AddCommand( runSpamCmd, - //runSpamSequencerMsgCmd, runLocalFeeMarketCmd, ) @@ -192,13 +191,13 @@ func init() { generatePrometheusCmd.PersistentFlags().StringVar( &prometheusBaseURI, "prometheus-base-uri", - "http://localhost:9090", + "http://localhost:9096", "prometheus server location", ) generatePrometheusCmd.PersistentFlags().BoolVar( &prometheusOpenBrowser, "prometheus-open-browser", - true, + false, "open browser to prometheus dashboard", ) generatePrometheusCmd.PersistentFlags().StringVar( diff --git a/controller/controller.go b/controller/controller.go index 343e183..db08b56 100644 --- a/controller/controller.go +++ b/controller/controller.go @@ -254,6 +254,12 @@ func (c *Controller) Accepted(ctx context.Context, blk *chain.StatelessBlock) er c.metrics.transfer.Inc() case *actions.SequencerMsg: c.metrics.sequencerMsg.Inc() + case *actions.Oracle: + c.metrics.oracle.Inc() + case *actions.Deploy: + c.metrics.deploy.Inc() + case *actions.Transact: + c.metrics.transact.Inc() } } } diff --git a/controller/metrics.go b/controller/metrics.go index 3fdb0e3..a6d5a90 100644 --- a/controller/metrics.go +++ b/controller/metrics.go @@ -18,6 +18,11 @@ type metrics struct { transfer prometheus.Counter sequencerMsg prometheus.Counter + + oracle prometheus.Counter + + deploy prometheus.Counter + transact prometheus.Counter } func newMetrics(gatherer ametrics.MultiGatherer) (*metrics, error) { @@ -48,6 +53,24 @@ func newMetrics(gatherer ametrics.MultiGatherer) (*metrics, error) { Name: "sequencer_msg", Help: "number of sequencer msg actions", }), + + oracle: prometheus.NewCounter(prometheus.CounterOpts{ + Namespace: "actions", + Name: "oracle", + Help: "number of oracle actions", + }), + + deploy: prometheus.NewCounter(prometheus.CounterOpts{ + Namespace: "actions", + Name: "deploy", + Help: "number of deploy actions", + }), + + transact: prometheus.NewCounter(prometheus.CounterOpts{ + Namespace: "actions", + Name: "transact", + Help: "number of transact actions", + }), } r := prometheus.NewRegistry() errs := wrappers.Errs{} @@ -59,6 +82,11 @@ func newMetrics(gatherer ametrics.MultiGatherer) (*metrics, error) { r.Register(m.transfer), r.Register(m.sequencerMsg), + + r.Register(m.oracle), + + r.Register(m.deploy), + r.Register(m.transact), gatherer.Register(consts.Name, r), ) return m, errs.Err