mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-01-20 15:16:42 +00:00
lib/logger: merge file
and line
labels into location="file:line"
This should improve the usability for `vm_log_messages_total` metric during practical queries
This commit is contained in:
parent
f055dbefda
commit
cf85c567d1
1 changed files with 2 additions and 1 deletions
|
@ -123,7 +123,8 @@ func logMessage(level, msg string, skipframes int) {
|
||||||
mu.Unlock()
|
mu.Unlock()
|
||||||
|
|
||||||
// Increment vm_log_messages_total
|
// Increment vm_log_messages_total
|
||||||
counterName := fmt.Sprintf(`vm_log_messages_total{app_version=%q, level=%q, file=%q, line="%d"}`, buildinfo.Version, levelLowercase, file, line)
|
location := fmt.Sprintf("%s:%d", file, line)
|
||||||
|
counterName := fmt.Sprintf(`vm_log_messages_total{app_version=%q, level=%q, location=%q}`, buildinfo.Version, levelLowercase, location)
|
||||||
metrics.GetOrCreateCounter(counterName).Inc()
|
metrics.GetOrCreateCounter(counterName).Inc()
|
||||||
|
|
||||||
switch level {
|
switch level {
|
||||||
|
|
Loading…
Reference in a new issue