Skip to content

Commit c2899cc

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

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/golang-queue/nsq
33
go 1.16
44

55
require (
6-
github.com/golang-queue/queue v0.0.10
6+
github.com/golang-queue/queue v0.0.11
77
github.com/nsqio/go-nsq v1.0.8
88
github.com/stretchr/testify v1.7.0
99
)

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
22
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3-
github.com/golang-queue/queue v0.0.10 h1:cGqMgHMf2eamwdd3hmOzGcSQogGu9tMhhVYPQMrMC1g=
4-
github.com/golang-queue/queue v0.0.10/go.mod h1:ku8iyjYffqYY6Duts+xl+QYfN3/KDK4MEvXMZUkHyio=
3+
github.com/golang-queue/queue v0.0.11 h1:qaE7rOYUh+11NcO6U9zZ7NazglIwEp0j7Dn0sSoavcI=
4+
github.com/golang-queue/queue v0.0.11/go.mod h1:ku8iyjYffqYY6Duts+xl+QYfN3/KDK4MEvXMZUkHyio=
55
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
66
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
77
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=

nsq.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ func WithLogger(l queue.Logger) Option {
9191
}
9292
}
9393

94+
// WithMetric set custom Metric
95+
func WithMetric(m queue.Metric) Option {
96+
return func(w *Worker) {
97+
w.metric = m
98+
}
99+
}
100+
94101
// NewWorker for struc
95102
func NewWorker(opts ...Option) *Worker {
96103
var err error
@@ -104,6 +111,7 @@ func NewWorker(opts ...Option) *Worker {
104111
runFunc: func(context.Context, queue.QueuedMessage) error {
105112
return nil
106113
},
114+
metric: queue.NewMetric(),
107115
}
108116

109117
// Loop through each option

0 commit comments

Comments
 (0)