diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index d6c12dbbce..74e5884526 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -10,6 +10,7 @@ sort: 15 * BUGFIX: properly limit indexdb cache sizes. Previously they could exceed values set via `-memory.allowedPercent` and/or `-memory.allowedBytes` when `indexdb` contained many data parts. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2007). * BUGFIX: [vmui](https://docs.victoriametrics.com/#vmui): fix a bug, which could break time range picker when editing `From` or `To` input fields. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2080). * BUGFIX: [vmui](https://docs.victoriametrics.com/#vmui): fix a bug, which could break switching between `graph`, `json` and `table` views. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2084). +* BUGFIX: show the original location of the warning or error message when logging throttled messages. Previously the location inside `lib/logger/throttler.go` was shown. This could increase the complexity of debugging. ## [v1.72.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.72.0) diff --git a/lib/logger/throttler.go b/lib/logger/throttler.go index da1e9edabb..843a337a62 100644 --- a/lib/logger/throttler.go +++ b/lib/logger/throttler.go @@ -24,8 +24,6 @@ func WithThrottler(name string, throttle time.Duration) *LogThrottler { } lt = newLogThrottler(throttle) - lt.warnF = Warnf - lt.errorF = Errorf logThrottlerRegistry[name] = lt return lt } @@ -35,9 +33,6 @@ func WithThrottler(name string, throttle time.Duration) *LogThrottler { // LogThrottler must be created via WithThrottler() call. type LogThrottler struct { ch chan struct{} - - warnF func(format string, args ...interface{}) - errorF func(format string, args ...interface{}) } func newLogThrottler(throttle time.Duration) *LogThrottler { @@ -57,7 +52,7 @@ func newLogThrottler(throttle time.Duration) *LogThrottler { func (lt *LogThrottler) Errorf(format string, args ...interface{}) { select { case lt.ch <- struct{}{}: - lt.errorF(format, args...) + ErrorfSkipframes(1, format, args...) default: } } @@ -66,7 +61,7 @@ func (lt *LogThrottler) Errorf(format string, args ...interface{}) { func (lt *LogThrottler) Warnf(format string, args ...interface{}) { select { case lt.ch <- struct{}{}: - lt.warnF(format, args...) + WarnfSkipframes(1, format, args...) default: } }