Skip to content

Commit

Permalink
ref: simplify runtime metric label setting
Browse files Browse the repository at this point in the history
Use the already parsed/normalized value for the log level directly from
the flag as the value to set for `log_level` label in runtime info
metric. simpler than asking for the logger to regurgitate and stringify
it for us, especially since the stringer for slog.Level returns it in
all caps, forcing the need to re-normalize it to lower-case
:upside-face: :eye-twitch:
  • Loading branch information
tjhop committed Aug 4, 2024
1 parent 1ae59d5 commit d6278b6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/mango/mango.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ func main() {
}

// update runtime info metric
metricMangoRuntimeInfoLabels["log_level"] = strings.ToLower(logLevel.Level().String())
metricMangoRuntimeInfoLabels["log_level"] = logLevelFlagVal
metricMangoRuntimeInfo.With(metricMangoRuntimeInfoLabels).Set(1)

// parse log output format from flag
Expand Down

0 comments on commit d6278b6

Please sign in to comment.