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

metrics: handle equal to separated config flag #596

Merged
merged 3 commits into from
Nov 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion builder/files/bor.service
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[Service]
Restart=on-failure
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
User=bor
KillSignal=SIGINT
Expand Down
8 changes: 7 additions & 1 deletion internal/cli/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,13 @@ func (s *Server) Stop() {
func (s *Server) setupMetrics(config *TelemetryConfig, serviceName string) error {
// Check the global metrics if they're matching with the provided config
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)
Expand Down
3 changes: 3 additions & 0 deletions metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ func init() {
// check for existence of `config` flag
if flag == configFlag && i < len(os.Args)-1 {
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 {
Expand Down
2 changes: 1 addition & 1 deletion packaging/templates/systemd/bor.service
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[Service]
Restart=on-failure
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
KillSignal=SIGINT
User=bor
Expand Down