Skip to content

Commit 48f76ed

Browse files
committed
chore(metric): Add default structure
Signed-off-by: Bo-Yi Wu <[email protected]>
1 parent 087bd93 commit 48f76ed

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ go 1.16
44

55
require (
66
github.com/go-redis/redis/v8 v8.11.3
7-
github.com/golang-queue/queue v0.0.10
7+
github.com/golang-queue/queue v0.0.11
88
github.com/stretchr/testify v1.7.0
99
)

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ github.com/go-redis/redis/v8 v8.11.3/go.mod h1:xNJ9xDG09FsIPwh3bWdk+0oDWHbtF9rPN
1313
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
1414
github.com/golang-queue/queue v0.0.10 h1:cGqMgHMf2eamwdd3hmOzGcSQogGu9tMhhVYPQMrMC1g=
1515
github.com/golang-queue/queue v0.0.10/go.mod h1:ku8iyjYffqYY6Duts+xl+QYfN3/KDK4MEvXMZUkHyio=
16+
github.com/golang-queue/queue v0.0.11 h1:qaE7rOYUh+11NcO6U9zZ7NazglIwEp0j7Dn0sSoavcI=
17+
github.com/golang-queue/queue v0.0.11/go.mod h1:ku8iyjYffqYY6Duts+xl+QYfN3/KDK4MEvXMZUkHyio=
1618
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
1719
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
1820
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=

redis.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@ func WithLogger(l queue.Logger) Option {
116116
}
117117
}
118118

119+
// WithMetric set custom Metric
120+
func WithMetric(m queue.Metric) Option {
121+
return func(w *Worker) {
122+
w.metric = m
123+
}
124+
}
125+
119126
// NewWorker for struc
120127
func NewWorker(opts ...Option) *Worker {
121128
var err error
@@ -128,6 +135,7 @@ func NewWorker(opts ...Option) *Worker {
128135
runFunc: func(context.Context, queue.QueuedMessage) error {
129136
return nil
130137
},
138+
metric: queue.NewMetric(),
131139
}
132140

133141
// Loop through each option

0 commit comments

Comments
 (0)