chore(queue): upgrade queue package and add metrics (#673)
* chore(queue): upgrade queue package and add metrics add new metrics BusyWorkers *prometheus.Desc SuccessTasks *prometheus.Desc FailureTasks *prometheus.Desc SubmittedTasks *prometheus.Desc fix https://github.com/appleboy/gorush/issues/672 Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> * chore: update go version Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
@@ -74,8 +74,9 @@ queue:
|
||||
queue: gorush
|
||||
redis:
|
||||
addr: 127.0.0.1:6379
|
||||
channel: gorush
|
||||
size: 1024
|
||||
group: gorush
|
||||
consumer: gorush
|
||||
stream_name: gorush
|
||||
|
||||
ios:
|
||||
enabled: false
|
||||
@@ -242,9 +243,10 @@ type SectionNATS struct {
|
||||
|
||||
// SectionRedisQueue is sub section of config.
|
||||
type SectionRedisQueue struct {
|
||||
Addr string `yaml:"addr"`
|
||||
Channel string `yaml:"channel"`
|
||||
Size int `yaml:"size"`
|
||||
Addr string `yaml:"addr"`
|
||||
StreamName string `yaml:"stream_name"`
|
||||
Group string `yaml:"group"`
|
||||
Consumer string `yaml:"consumer"`
|
||||
}
|
||||
|
||||
// SectionRedis is sub section of config.
|
||||
@@ -404,8 +406,9 @@ func LoadConf(confPath ...string) (*ConfYaml, error) {
|
||||
conf.Queue.NATS.Subj = viper.GetString("queue.nats.subj")
|
||||
conf.Queue.NATS.Queue = viper.GetString("queue.nats.queue")
|
||||
conf.Queue.Redis.Addr = viper.GetString("queue.redis.addr")
|
||||
conf.Queue.Redis.Channel = viper.GetString("queue.redis.channel")
|
||||
conf.Queue.Redis.Size = viper.GetInt("queue.redis.size")
|
||||
conf.Queue.Redis.StreamName = viper.GetString("queue.redis.stream_name")
|
||||
conf.Queue.Redis.Group = viper.GetString("queue.redis.group")
|
||||
conf.Queue.Redis.Consumer = viper.GetString("queue.redis.consumer")
|
||||
|
||||
// Stat Engine
|
||||
conf.Stat.Engine = viper.GetString("stat.engine")
|
||||
|
||||
@@ -108,8 +108,9 @@ func (suite *ConfigTestSuite) TestValidateConfDefault() {
|
||||
assert.Equal(suite.T(), "gorush", suite.ConfGorushDefault.Queue.NATS.Queue)
|
||||
|
||||
assert.Equal(suite.T(), "127.0.0.1:6379", suite.ConfGorushDefault.Queue.Redis.Addr)
|
||||
assert.Equal(suite.T(), "gorush", suite.ConfGorushDefault.Queue.Redis.Channel)
|
||||
assert.Equal(suite.T(), 1024, suite.ConfGorushDefault.Queue.Redis.Size)
|
||||
assert.Equal(suite.T(), "gorush", suite.ConfGorushDefault.Queue.Redis.StreamName)
|
||||
assert.Equal(suite.T(), "gorush", suite.ConfGorushDefault.Queue.Redis.Group)
|
||||
assert.Equal(suite.T(), "gorush", suite.ConfGorushDefault.Queue.Redis.Consumer)
|
||||
|
||||
// log
|
||||
assert.Equal(suite.T(), "string", suite.ConfGorushDefault.Log.Format)
|
||||
|
||||
5
config/testdata/config.yml
vendored
5
config/testdata/config.yml
vendored
@@ -61,8 +61,9 @@ queue:
|
||||
queue: gorush
|
||||
redis:
|
||||
addr: 127.0.0.1:6379
|
||||
channel: gorush
|
||||
size: 1024
|
||||
group: gorush
|
||||
consumer: gorush
|
||||
stream_name: gorush
|
||||
|
||||
ios:
|
||||
enabled: false
|
||||
|
||||
Reference in New Issue
Block a user