Skip to content

Commit

Permalink
chore(queue): upgrade queue package and add metrics (#673)
Browse files Browse the repository at this point in the history
* chore(queue): upgrade queue package and add metrics

add new metrics

	BusyWorkers    *prometheus.Desc
	SuccessTasks   *prometheus.Desc
	FailureTasks   *prometheus.Desc
	SubmittedTasks *prometheus.Desc

fix #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>
  • Loading branch information
appleboy authored May 5, 2022
1 parent 2bba4b4 commit a45769c
Show file tree
Hide file tree
Showing 14 changed files with 167 additions and 146 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,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
Expand Down
17 changes: 10 additions & 7 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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")
Expand Down
5 changes: 3 additions & 2 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions config/testdata/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
40 changes: 21 additions & 19 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/appleboy/gorush

go 1.17
go 1.18

require (
github.com/apex/gateway v1.1.2
Expand All @@ -12,12 +12,12 @@ require (
github.com/buger/jsonparser v1.1.1
github.com/dgraph-io/badger/v3 v3.2103.1
github.com/gin-contrib/logger v0.2.0
github.com/gin-gonic/gin v1.7.4
github.com/go-redis/redis/v8 v8.11.3
github.com/golang-queue/nats v0.0.5
github.com/golang-queue/nsq v0.0.7
github.com/golang-queue/queue v0.0.11
github.com/golang-queue/redisdb v0.0.6
github.com/gin-gonic/gin v1.7.7
github.com/go-redis/redis/v8 v8.11.5
github.com/golang-queue/nats v0.0.7
github.com/golang-queue/nsq v0.1.0
github.com/golang-queue/queue v0.1.1
github.com/golang-queue/redisdb-stream v0.0.1
github.com/golang/protobuf v1.5.2
github.com/json-iterator/go v1.1.10
github.com/mattn/go-isatty v0.0.12
Expand All @@ -28,7 +28,7 @@ require (
github.com/sideshow/apns2 v0.20.0
github.com/sirupsen/logrus v1.8.1
github.com/spf13/viper v1.7.1
github.com/stretchr/testify v1.7.0
github.com/stretchr/testify v1.7.1
github.com/syndtr/goleveldb v1.0.0
github.com/thoas/stats v0.0.0-20190407194641-965cb2de1678
github.com/tidwall/buntdb v1.2.0
Expand All @@ -37,14 +37,14 @@ require (
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
google.golang.org/grpc v1.36.1
google.golang.org/protobuf v1.27.1
google.golang.org/protobuf v1.28.0
)

require (
github.com/aws/aws-lambda-go v1.17.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgraph-io/ristretto v0.1.0 // indirect
github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect
Expand All @@ -57,18 +57,20 @@ require (
github.com/go-playground/universal-translator v0.17.0 // indirect
github.com/go-playground/validator/v10 v10.4.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/glog v0.0.0-20210429001901-424d2337a529 // indirect
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect
github.com/golang/snappy v0.0.3 // indirect
github.com/google/flatbuffers v2.0.0+incompatible // indirect
github.com/google/flatbuffers v1.12.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/klauspost/compress v1.13.4 // indirect
github.com/klauspost/compress v1.12.3 // indirect
github.com/leodido/go-urn v1.2.0 // indirect
github.com/magiconair/properties v1.8.1 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/minio/highwayhash v1.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/nats-io/nats.go v1.13.1-0.20220121202836-972a071d373d // indirect
github.com/nats-io/jwt/v2 v2.2.0 // indirect
github.com/nats-io/nats.go v1.13.1-0.20220308171302-2f2f6968e98d // indirect
github.com/nats-io/nkeys v0.3.0 // indirect
github.com/nats-io/nuid v1.0.1 // indirect
github.com/nsqio/go-nsq v1.1.0 // indirect
Expand All @@ -84,19 +86,19 @@ require (
github.com/spf13/pflag v1.0.3 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/tidwall/btree v0.3.0 // indirect
github.com/tidwall/gjson v1.12.1 // indirect
github.com/tidwall/gjson v1.6.8 // indirect
github.com/tidwall/grect v0.1.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
github.com/tidwall/match v1.0.3 // indirect
github.com/tidwall/pretty v1.0.2 // indirect
github.com/tidwall/rtred v0.1.2 // indirect
github.com/tidwall/tinyqueue v0.1.1 // indirect
github.com/ugorji/go/codec v1.1.7 // indirect
go.etcd.io/bbolt v1.3.4 // indirect
go.opencensus.io v0.22.5 // indirect
golang.org/x/lint v0.0.0-20190930215403-16217165b5de // indirect
golang.org/x/sys v0.0.0-20220111092808-5a964db01320 // indirect
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
golang.org/x/text v0.3.6 // indirect
golang.org/x/tools v0.1.5 // indirect
golang.org/x/tools v0.1.0 // indirect
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect
gopkg.in/ini.v1 v1.51.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
Loading

0 comments on commit a45769c

Please sign in to comment.