lib/logger/throttler.go: show the original location of the error and warning message

Previously the location inside LogThrottler implementation was shown. This could complicate debugging.
This commit is contained in:
Aliaksandr Valialkin 2022-01-23 13:54:19 +02:00
parent f5f27a5fbf
commit 746ee191e8
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1
2 changed files with 3 additions and 7 deletions

View file

@ -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)

View file

@ -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:
}
}