Skip to content
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

cmd/geth: actually enable metrics when passed via toml #30781

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lightclient
Copy link
Member

closes #28303, replaces #28101

--

When we added metrics to the config toml back in #22083, they didn't actually seem to get enabled when you start the client with the toml. That is fixed here by only starting the metrics after we have parsed the config for it.

You can verify it's working by running this snippet:

$ go run ./cmd/geth --metrics --metrics.addr 0.0.0.0 dumpconfig > conf && go run ./cmd/geth --config conf -dev 2>&1 | grep metrics
INFO [11-21|21:02:06.148] Enabling metrics collection
INFO [11-21|21:02:06.148] Enabling stand-alone metrics HTTP endpoint address=0.0.0.0:6060
INFO [11-21|21:02:06.148] Starting metrics server                  addr=http://0.0.0.0:6060/debug/metrics

@holiman
Copy link
Contributor

holiman commented Nov 21, 2024

Some additional tests

^C[user@work go-ethereum]$ go run ./cmd/geth --metrics --metrics.addr 0.0.0.0 dumpconfig > conf && go run ./cmd/geth --config conf -dev --metrics.addr 1.1.1.1 2>&1 | grep metrics
INFO [11-21|14:46:47.851] Maximum peer count                       ETH=50 total=50
INFO [11-21|14:46:47.873] Set global gas cap                       cap=50,000,000
INFO [11-21|14:46:47.873] Initializing the KZG library             backend=gokzg
INFO [11-21|14:46:51.231] Enabling metrics collection
INFO [11-21|14:46:51.231] Enabling stand-alone metrics HTTP endpoint address=1.1.1.1:6060
INFO [11-21|14:46:51.231] Starting metrics server                  addr=http://1.1.1.1:6060/debug/metrics
ERROR[11-21|14:46:51.232] Failure in running metrics server        err="listen tcp 1.1.1.1:6060: bind: cannot assign requested address"
^C
[user@work go-ethereum]$ go run ./cmd/geth --metrics --metrics.addr 0.0.0.0 dumpconfig > conf && go run ./cmd/geth --config conf -dev --metrics=false --metrics.addr 1.1.1.1 2>&1 | grep metrics
INFO [11-21|14:47:09.190] Maximum peer count                       ETH=50 total=50
INFO [11-21|14:47:09.211] Set global gas cap                       cap=50,000,000
INFO [11-21|14:47:09.211] Initializing the KZG library             backend=gokzg

👍

Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@holiman holiman added this to the 1.14.13 milestone Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Metrics options are ignored in config.toml
2 participants