mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
metrics: handle equal to separated config flag (#596)
* metrics: handle based config path * internal/cli/server: add more context to logs * use space separated flag and value in bor.service
This commit is contained in:
parent
58a63147f2
commit
137fb19d2a
4 changed files with 12 additions and 3 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
[Service]
|
[Service]
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
RestartSec=5s
|
RestartSec=5s
|
||||||
ExecStart=/usr/local/bin/bor server -config="/var/lib/bor/config.toml"
|
ExecStart=/usr/local/bin/bor server -config "/var/lib/bor/config.toml"
|
||||||
Type=simple
|
Type=simple
|
||||||
User=bor
|
User=bor
|
||||||
KillSignal=SIGINT
|
KillSignal=SIGINT
|
||||||
|
|
|
||||||
|
|
@ -235,7 +235,13 @@ func (s *Server) Stop() {
|
||||||
func (s *Server) setupMetrics(config *TelemetryConfig, serviceName string) error {
|
func (s *Server) setupMetrics(config *TelemetryConfig, serviceName string) error {
|
||||||
// Check the global metrics if they're matching with the provided config
|
// Check the global metrics if they're matching with the provided config
|
||||||
if metrics.Enabled != config.Enabled || metrics.EnabledExpensive != config.Expensive {
|
if metrics.Enabled != config.Enabled || metrics.EnabledExpensive != config.Expensive {
|
||||||
log.Warn("Metric misconfiguration, some of them might not be visible")
|
log.Warn(
|
||||||
|
"Metric misconfiguration, some of them might not be visible",
|
||||||
|
"metrics", metrics.Enabled,
|
||||||
|
"config.metrics", config.Enabled,
|
||||||
|
"expensive", metrics.EnabledExpensive,
|
||||||
|
"config.expensive", config.Expensive,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the values anyways (for services which don't need immediate attention)
|
// Update the values anyways (for services which don't need immediate attention)
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,9 @@ func init() {
|
||||||
// check for existence of `config` flag
|
// check for existence of `config` flag
|
||||||
if flag == configFlag && i < len(os.Args)-1 {
|
if flag == configFlag && i < len(os.Args)-1 {
|
||||||
configFile = strings.TrimLeft(os.Args[i+1], "-") // find the value of flag
|
configFile = strings.TrimLeft(os.Args[i+1], "-") // find the value of flag
|
||||||
|
} else if len(flag) > 6 && flag[:6] == configFlag {
|
||||||
|
// Checks for `=` separated flag (e.g. config=path)
|
||||||
|
configFile = strings.TrimLeft(flag[6:], "=")
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, enabler := range enablerFlags {
|
for _, enabler := range enablerFlags {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
[Service]
|
[Service]
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
RestartSec=5s
|
RestartSec=5s
|
||||||
ExecStart=/usr/bin/bor server -config="/var/lib/bor/config.toml"
|
ExecStart=/usr/bin/bor server -config "/var/lib/bor/config.toml"
|
||||||
Type=simple
|
Type=simple
|
||||||
KillSignal=SIGINT
|
KillSignal=SIGINT
|
||||||
User=bor
|
User=bor
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue