mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-01-20 07:19:17 +01:00
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:
parent
f5f27a5fbf
commit
746ee191e8
@ -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: 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 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: [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)
|
## [v1.72.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.72.0)
|
||||||
|
@ -24,8 +24,6 @@ func WithThrottler(name string, throttle time.Duration) *LogThrottler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
lt = newLogThrottler(throttle)
|
lt = newLogThrottler(throttle)
|
||||||
lt.warnF = Warnf
|
|
||||||
lt.errorF = Errorf
|
|
||||||
logThrottlerRegistry[name] = lt
|
logThrottlerRegistry[name] = lt
|
||||||
return lt
|
return lt
|
||||||
}
|
}
|
||||||
@ -35,9 +33,6 @@ func WithThrottler(name string, throttle time.Duration) *LogThrottler {
|
|||||||
// LogThrottler must be created via WithThrottler() call.
|
// LogThrottler must be created via WithThrottler() call.
|
||||||
type LogThrottler struct {
|
type LogThrottler struct {
|
||||||
ch chan struct{}
|
ch chan struct{}
|
||||||
|
|
||||||
warnF func(format string, args ...interface{})
|
|
||||||
errorF func(format string, args ...interface{})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func newLogThrottler(throttle time.Duration) *LogThrottler {
|
func newLogThrottler(throttle time.Duration) *LogThrottler {
|
||||||
@ -57,7 +52,7 @@ func newLogThrottler(throttle time.Duration) *LogThrottler {
|
|||||||
func (lt *LogThrottler) Errorf(format string, args ...interface{}) {
|
func (lt *LogThrottler) Errorf(format string, args ...interface{}) {
|
||||||
select {
|
select {
|
||||||
case lt.ch <- struct{}{}:
|
case lt.ch <- struct{}{}:
|
||||||
lt.errorF(format, args...)
|
ErrorfSkipframes(1, format, args...)
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -66,7 +61,7 @@ func (lt *LogThrottler) Errorf(format string, args ...interface{}) {
|
|||||||
func (lt *LogThrottler) Warnf(format string, args ...interface{}) {
|
func (lt *LogThrottler) Warnf(format string, args ...interface{}) {
|
||||||
select {
|
select {
|
||||||
case lt.ch <- struct{}{}:
|
case lt.ch <- struct{}{}:
|
||||||
lt.warnF(format, args...)
|
WarnfSkipframes(1, format, args...)
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user