Skip to content
This repository has been archived by the owner on Oct 17, 2018. It is now read-only.

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Chao Wang committed Jun 6, 2017
1 parent aa76a6e commit b2e7996
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
8 changes: 4 additions & 4 deletions server/msgpack/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type Options interface {

type options struct {
instrumentOpts instrument.Options
rOpts xretry.Options
retryOpts xretry.Options
iteratorPool msgpack.UnaggregatedIteratorPool
}

Expand All @@ -63,7 +63,7 @@ func NewOptions() Options {

return &options{
instrumentOpts: instrument.NewOptions(),
rOpts: xretry.NewOptions(),
retryOpts: xretry.NewOptions(),
iteratorPool: iteratorPool,
}
}
Expand All @@ -80,12 +80,12 @@ func (o *options) InstrumentOptions() instrument.Options {

func (o *options) SetRetryOptions(value xretry.Options) Options {
opts := *o
opts.rOpts = value
opts.retryOpts = value
return &opts
}

func (o *options) RetryOptions() xretry.Options {
return o.rOpts
return o.retryOpts
}

func (o *options) SetIteratorPool(value msgpack.UnaggregatedIteratorPool) Options {
Expand Down
18 changes: 8 additions & 10 deletions server/msgpack/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,14 @@ const (
func NewServer(address string, aggregator aggregator.Aggregator, opts Options) xserver.Server {
iOpts := opts.InstrumentOptions()
scope := iOpts.MetricsScope()
return xserver.NewServer(
address,
NewHandler(
aggregator,
opts.SetInstrumentOptions(iOpts.SetMetricsScope(scope.Tagged(map[string]string{"handler": "msgpack"}))),
),
xserver.NewOptions().
SetInstrumentOptions(iOpts.SetMetricsScope(scope.Tagged(map[string]string{"server": "msgpack"}))).
SetRetryOptions(opts.RetryOptions()),
)

handlerInstrumentOpts := iOpts.SetMetricsScope(scope.Tagged(map[string]string{"handler": "msgpack"}))
handler := NewHandler(aggregator, opts.SetInstrumentOptions(handlerInstrumentOpts))

serverInstrumentOpts := iOpts.SetMetricsScope(scope.Tagged(map[string]string{"server": "msgpack"}))
serverOpts := xserver.NewOptions().SetInstrumentOptions(serverInstrumentOpts).SetRetryOptions(opts.RetryOptions())

return xserver.NewServer(address, handler, serverOpts)
}

type handlerMetrics struct {
Expand Down
4 changes: 2 additions & 2 deletions services/m3aggregator/config/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ func (c *MsgpackServerConfiguration) NewMsgpackServerOptions(
opts := msgpack.NewOptions().SetInstrumentOptions(instrumentOpts)

// Set retry options.
rOpts := c.Retry.NewOptions(instrumentOpts.MetricsScope())
opts = opts.SetRetryOptions(rOpts)
retryOpts := c.Retry.NewOptions(instrumentOpts.MetricsScope())
opts = opts.SetRetryOptions(retryOpts)

// Set unaggregated iterator pool.
iteratorPool := c.Iterator.NewUnaggregatedIteratorPool(instrumentOpts)
Expand Down

0 comments on commit b2e7996

Please sign in to comment.