mirror of
https://github.com/elyby/chrly.git
synced 2024-12-22 21:19:55 +05:30
Fix stats reporting for batch UUIDs provider
This commit is contained in:
parent
1b9e943c0e
commit
436d98e1a0
@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- [#24](https://github.com/elyby/chrly/issues/24): Added a new batch Mojang UUIDs provider strategy `full-bus` and
|
||||
corresponding configuration param `QUEUE_STRATEGY` with the default value `periodic`.
|
||||
|
||||
### Changed
|
||||
- `ely.skinsystem.{hostname}.app.mojang_textures.usernames.round_time` timer will not be recorded if the iteration was
|
||||
empty.
|
||||
|
||||
## [4.4.1] - 2020-04-24
|
||||
### Added
|
||||
- [#20](https://github.com/elyby/chrly/issues/20): Print hostname in the `version` command output.
|
||||
|
@ -96,12 +96,12 @@ func (s *StatsReporter) ConfigureWithDispatcher(d Subscriber) {
|
||||
d.Subscribe("mojang_textures:batch_uuids_provider:round", func(usernames []string, queueSize int) {
|
||||
s.UpdateGauge("mojang_textures.usernames.iteration_size", int64(len(usernames)))
|
||||
s.UpdateGauge("mojang_textures.usernames.queue_size", int64(queueSize))
|
||||
if len(usernames) != 0 {
|
||||
s.startTimeRecording("batch_uuids_provider_round_time_" + strings.Join(usernames, "|"))
|
||||
}
|
||||
})
|
||||
d.Subscribe("mojang_textures:batch_uuids_provider:before_round", func() {
|
||||
s.startTimeRecording("batch_uuids_provider_round_time")
|
||||
})
|
||||
d.Subscribe("mojang_textures:batch_uuids_provider:after_round", func() {
|
||||
s.finalizeTimeRecording("batch_uuids_provider_round_time", "mojang_textures.usernames.round_time")
|
||||
d.Subscribe("mojang_textures:batch_uuids_provider:result", func(usernames []string, profiles []*mojang.ProfileInfo, err error) {
|
||||
s.finalizeTimeRecording("batch_uuids_provider_round_time_"+strings.Join(usernames, "|"), "mojang_textures.usernames.round_time")
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -337,19 +337,24 @@ var statsReporterTestCases = []*StatsReporterTestCase{
|
||||
{
|
||||
Events: [][]interface{}{
|
||||
{"mojang_textures:batch_uuids_provider:round", []string{"username1", "username2"}, 5},
|
||||
{"mojang_textures:batch_uuids_provider:result", []string{"username1", "username2"}, []*mojang.ProfileInfo{}, nil},
|
||||
},
|
||||
ExpectedCalls: [][]interface{}{
|
||||
{"UpdateGauge", "mojang_textures.usernames.iteration_size", int64(2)},
|
||||
{"UpdateGauge", "mojang_textures.usernames.queue_size", int64(5)},
|
||||
{"RecordTimer", "mojang_textures.usernames.round_time", mock.AnythingOfType("time.Duration")},
|
||||
},
|
||||
},
|
||||
{
|
||||
Events: [][]interface{}{
|
||||
{"mojang_textures:batch_uuids_provider:before_round"},
|
||||
{"mojang_textures:batch_uuids_provider:after_round"},
|
||||
{"mojang_textures:batch_uuids_provider:round", []string{}, 0},
|
||||
// This event will be not emitted, but we emit it to ensure, that RecordTimer will not be called
|
||||
{"mojang_textures:batch_uuids_provider:result", []string{}, []*mojang.ProfileInfo{}, nil},
|
||||
},
|
||||
ExpectedCalls: [][]interface{}{
|
||||
{"RecordTimer", "mojang_textures.usernames.round_time", mock.AnythingOfType("time.Duration")},
|
||||
{"UpdateGauge", "mojang_textures.usernames.iteration_size", int64(0)},
|
||||
{"UpdateGauge", "mojang_textures.usernames.queue_size", int64(0)},
|
||||
// Should not call RecordTimer
|
||||
},
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user