Skip to content

Commit

Permalink
Enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
Djadih committed Oct 2, 2023
1 parent c0742f7 commit 2b94895
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 152 deletions.
8 changes: 0 additions & 8 deletions cmd/go-quai/chaincmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,6 @@ The dumpgenesis command dumps the genesis block configuration in JSON format to
utils.MetricsEnabledExpensiveFlag,
utils.MetricsHTTPFlag,
utils.MetricsPortFlag,
utils.MetricsEnableInfluxDBFlag,
utils.MetricsInfluxDBEndpointFlag,
utils.MetricsInfluxDBDatabaseFlag,
utils.MetricsInfluxDBUsernameFlag,
utils.MetricsInfluxDBPasswordFlag,
utils.MetricsInfluxDBTagsFlag,
utils.TxLookupLimitFlag,
},
Category: "BLOCKCHAIN COMMANDS",
Expand Down Expand Up @@ -227,8 +221,6 @@ func importChain(ctx *cli.Context) error {
if len(ctx.Args()) < 1 {
utils.Fatalf("This command requires an argument.")
}
// Start system runtime metrics collection
// go metrics_config.StartProcessMetrics()

stack, _ := makeConfigNode(ctx)
defer stack.Close()
Expand Down
18 changes: 0 additions & 18 deletions cmd/go-quai/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,24 +206,6 @@ func applyMetricConfig(ctx *cli.Context, cfg *quaiConfig) {
if ctx.GlobalIsSet(utils.MetricsPortFlag.Name) {
cfg.Metrics.Port = ctx.GlobalInt(utils.MetricsPortFlag.Name)
}
if ctx.GlobalIsSet(utils.MetricsEnableInfluxDBFlag.Name) {
cfg.Metrics.EnableInfluxDB = ctx.GlobalBool(utils.MetricsEnableInfluxDBFlag.Name)
}
if ctx.GlobalIsSet(utils.MetricsInfluxDBEndpointFlag.Name) {
cfg.Metrics.InfluxDBEndpoint = ctx.GlobalString(utils.MetricsInfluxDBEndpointFlag.Name)
}
if ctx.GlobalIsSet(utils.MetricsInfluxDBDatabaseFlag.Name) {
cfg.Metrics.InfluxDBDatabase = ctx.GlobalString(utils.MetricsInfluxDBDatabaseFlag.Name)
}
if ctx.GlobalIsSet(utils.MetricsInfluxDBUsernameFlag.Name) {
cfg.Metrics.InfluxDBUsername = ctx.GlobalString(utils.MetricsInfluxDBUsernameFlag.Name)
}
if ctx.GlobalIsSet(utils.MetricsInfluxDBPasswordFlag.Name) {
cfg.Metrics.InfluxDBPassword = ctx.GlobalString(utils.MetricsInfluxDBPasswordFlag.Name)
}
if ctx.GlobalIsSet(utils.MetricsInfluxDBTagsFlag.Name) {
cfg.Metrics.InfluxDBTags = ctx.GlobalString(utils.MetricsInfluxDBTagsFlag.Name)
}
}

func deprecated(field string) bool {
Expand Down
9 changes: 0 additions & 9 deletions cmd/go-quai/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,9 @@ var (
}

metricsFlags = []cli.Flag{
utils.MetricsEnableInfluxDBFlag,
utils.MetricsEnabledExpensiveFlag,
utils.MetricsEnabledFlag,
utils.MetricsHTTPFlag,
utils.MetricsInfluxDBDatabaseFlag,
utils.MetricsInfluxDBEndpointFlag,
utils.MetricsInfluxDBPasswordFlag,
utils.MetricsInfluxDBTagsFlag,
utils.MetricsInfluxDBUsernameFlag,
utils.MetricsPortFlag,
}
)
Expand Down Expand Up @@ -253,9 +247,6 @@ func prepare(ctx *cli.Context) {
ctx.GlobalSet(utils.CacheFlag.Name, strconv.Itoa(128))
}

// Start metrics export if enabled
// utils.SetupMetrics(ctx)

// Start system runtime metrics collection
if ctx.GlobalIsSet(utils.MetricsEnabledFlag.Name) {
log.Info("Starting metrics")
Expand Down
73 changes: 0 additions & 73 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,31 +582,6 @@ var (
Usage: "Metrics HTTP server listening port",
Value: metrics_config.DefaultConfig.Port,
}
MetricsEnableInfluxDBFlag = cli.BoolFlag{
Name: "metrics.influxdb",
Usage: "Enable metrics export/push to an external InfluxDB database",
}
MetricsInfluxDBEndpointFlag = cli.StringFlag{
Name: "metrics.influxdb.endpoint",
Usage: "InfluxDB API endpoint to report metrics to",
Value: metrics_config.DefaultConfig.InfluxDBEndpoint,
}
MetricsInfluxDBDatabaseFlag = cli.StringFlag{
Name: "metrics.influxdb.database",
Usage: "InfluxDB database name to push reported metrics to",
Value: metrics_config.DefaultConfig.InfluxDBDatabase,
}
MetricsInfluxDBUsernameFlag = cli.StringFlag{
Name: "metrics.influxdb.username",
Usage: "Username to authorize access to the database",
Value: metrics_config.DefaultConfig.InfluxDBUsername,
}
MetricsInfluxDBPasswordFlag = cli.StringFlag{
Name: "metrics.influxdb.password",
Usage: "Password to authorize access to the database",
Value: metrics_config.DefaultConfig.InfluxDBPassword,
}

// Output flags
ShowColorsFlag = cli.BoolFlag{
Name: "showcolors",
Expand All @@ -618,16 +593,6 @@ var (
Usage: "Write log messages to stdout",
}

// Tags are part of every measurement sent to InfluxDB. Queries on tags are faster in InfluxDB.
// For example `host` tag could be used so that we can group all nodes and average a measurement
// across all of them, but also so that we can select a specific node and inspect its measurements.
// https://docs.influxdata.com/influxdb/v1.4/concepts/key_concepts/#tag-key
MetricsInfluxDBTagsFlag = cli.StringFlag{
Name: "metrics.influxdb.tags",
Usage: "Comma-separated InfluxDB tags (key/values) attached to all measurements",
Value: metrics_config.DefaultConfig.InfluxDBTags,
}

RegionFlag = cli.IntFlag{
Name: "region",
Usage: "Quai Region flag",
Expand Down Expand Up @@ -1637,44 +1602,6 @@ func RegisterQuaiStatsService(stack *node.Node, backend quaiapi.Backend, url str
}
}

// func SetupMetrics(ctx *cli.Context) {
// if metrics_config.Enabled {
// log.Info("Enabling metrics collection")

// var (
// enableExport = ctx.GlobalBool(MetricsEnableInfluxDBFlag.Name)
// endpoint = ctx.GlobalString(MetricsInfluxDBEndpointFlag.Name)
// database = ctx.GlobalString(MetricsInfluxDBDatabaseFlag.Name)
// username = ctx.GlobalString(MetricsInfluxDBUsernameFlag.Name)
// password = ctx.GlobalString(MetricsInfluxDBPasswordFlag.Name)
// )

// if enableExport {
// tagsMap := SplitTagsFlag(ctx.GlobalString(MetricsInfluxDBTagsFlag.Name))

// log.Info("Enabling metrics export to InfluxDB")

// go influxdb.InfluxDBWithTags(metrics.DefaultRegistry, 10*time.Second, endpoint, database, username, password, "quai.", tagsMap, false)
// }

// if ctx.GlobalIsSet(MetricsHTTPFlag.Name) {
// address := fmt.Sprintf("%s:%d", ctx.GlobalString(MetricsHTTPFlag.Name), ctx.GlobalInt(MetricsPortFlag.Name))
// log.Info("Enabling stand-alone metrics HTTP endpoint", "address", address)
// // exp.Setup(address)
// m := http.NewServeMux()
// // m.Handle("/debug/metrics", exp.ExpHandler(metrics.DefaultRegistry))
// // m.Handle("/debug/metrics/prometheus", prometheus.Handler(metrics.DefaultRegistry))
// m.Handle("/debug/metrics/prometheus", prometheus.Handler())
// log.Info("Starting metrics server", "addr", fmt.Sprintf("http://%s/debug/metrics", address))
// go func() {
// if err := http.ListenAndServe(address, m); err != nil {
// log.Error("Failure in running metrics server", "err", err)
// }
// }()
// }
// }
// }

func SplitTagsFlag(tagsFlag string) map[string]string {
tags := strings.Split(tagsFlag, ",")
tagsMap := map[string]string{}
Expand Down
46 changes: 23 additions & 23 deletions core/tx_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,29 +287,29 @@ type newSender struct {
// transactions from the network.
func NewTxPool(config TxPoolConfig, chainconfig *params.ChainConfig, chain blockChain) *TxPool {

// // Pending pool metrics
// pendingDiscardMeter.Set(0)
// pendingReplaceMeter.Set(0)
// pendingRateLimitMeter.Set(0)
// pendingNofundsMeter.Set(0)

// // Metrics for the queued pool
// queuedDiscardMeter.Set(0)
// queuedReplaceMeter.Set(0)
// queuedRateLimitMeter.Set(0)
// queuedNofundsMeter.Set(0)
// queuedEvictionMeter.Set(0)

// // General tx metrics
// knownTxMeter.Set(0)
// validTxMeter.Set(0)
// invalidTxMeter.Set(0)
// underpricedTxMeter.Set(0)
// overflowedTxMeter.Set(0)

// pendingGauge.Set(0)
// queuedGauge.Set(0)
// localGauge.Set(0)
// Pending pool metrics
pendingDiscardMeter.Set(0)
pendingReplaceMeter.Set(0)
pendingRateLimitMeter.Set(0)
pendingNofundsMeter.Set(0)

// Metrics for the queued pool
queuedDiscardMeter.Set(0)
queuedReplaceMeter.Set(0)
queuedRateLimitMeter.Set(0)
queuedNofundsMeter.Set(0)
queuedEvictionMeter.Set(0)

// General tx metrics
knownTxMeter.Set(0)
validTxMeter.Set(0)
invalidTxMeter.Set(0)
underpricedTxMeter.Set(0)
overflowedTxMeter.Set(0)

pendingGauge.Set(0)
queuedGauge.Set(0)
localGauge.Set(0)

// Sanitize the input to ensure no vulnerable gas prices are set
config = (&config).sanitize()
Expand Down
21 changes: 0 additions & 21 deletions eth/downloader/metrics.go

This file was deleted.

0 comments on commit 2b94895

Please sign in to comment.