diff --git a/auth/options.go b/auth/options.go index 49157a48..328d275a 100644 --- a/auth/options.go +++ b/auth/options.go @@ -6,13 +6,17 @@ import ( "github.com/unistack-org/micro/v3/logger" "github.com/unistack-org/micro/v3/metadata" + "github.com/unistack-org/micro/v3/meter" "github.com/unistack-org/micro/v3/store" + "github.com/unistack-org/micro/v3/tracer" ) // NewOptions creates Options struct from slice of options func NewOptions(opts ...Option) Options { options := Options{ + Tracer: tracer.DefaultTracer, Logger: logger.DefaultLogger, + Meter: meter.DefaultMeter, } for _, o := range opts { o(&options) @@ -41,6 +45,10 @@ type Options struct { Addrs []string // Logger sets the logger Logger logger.Logger + // Meter sets tht meter + Meter meter.Meter + // Tracer + Tracer tracer.Tracer // Context to store other options Context context.Context } @@ -288,3 +296,17 @@ func Logger(l logger.Logger) Option { o.Logger = l } } + +// Meter sets the meter +func Meter(m meter.Meter) Option { + return func(o *Options) { + o.Meter = m + } +} + +// Tracer sets the meter +func Tracer(t tracer.Tracer) Option { + return func(o *Options) { + o.Tracer = t + } +} diff --git a/broker/options.go b/broker/options.go index 5b7d2390..d41a313a 100644 --- a/broker/options.go +++ b/broker/options.go @@ -6,27 +6,30 @@ import ( "github.com/unistack-org/micro/v3/codec" "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/meter" "github.com/unistack-org/micro/v3/registry" + "github.com/unistack-org/micro/v3/tracer" ) // Options struct type Options struct { - Addrs []string - Secure bool - - // Codec - Codec codec.Codec - - // Logger the logger - Logger logger.Logger - // Handler executed when errors occur processing messages + // Addrs useed by broker + Addrs []string + // ErrorHandler executed when errors occur processing messages ErrorHandler Handler - + // Codec used to marshal/unmarshal messages + Codec codec.Codec + // Logger the used logger + Logger logger.Logger + // Meter the used for metrics + Meter meter.Meter + // Tracer used for trace + Tracer tracer.Tracer + // TLSConfig for secure communication TLSConfig *tls.Config // Registry used for clustering Registry registry.Registry - // Other options for implementations of the interface - // can be stored in a context + // Context is used for non default options Context context.Context } @@ -36,6 +39,9 @@ func NewOptions(opts ...Option) Options { Registry: registry.DefaultRegistry, Logger: logger.DefaultLogger, Context: context.Background(), + Meter: meter.DefaultMeter, + Codec: codec.DefaultCodec, + Tracer: tracer.DefaultTracer, } for _, o := range opts { o(&options) @@ -54,8 +60,7 @@ func Context(ctx context.Context) Option { type PublishOptions struct { // BodyOnly says that only body of the message must be published BodyOnly bool - // Other options for implementations of the interface - // can be stored in a context + // Context for non default options Context context.Context } @@ -77,10 +82,10 @@ type SubscribeOptions struct { // AutoAck ack messages if handler returns nil err AutoAck bool - // Handler executed when errors occur processing messages + // ErrorHandler executed when errors occur processing messages ErrorHandler Handler - // Subscribers with the same group name + // Group for subscriber, Subscribers with the same group name // will create a shared subscription where each // receives a subset of messages. Group string @@ -88,8 +93,7 @@ type SubscribeOptions struct { // BodyOnly says that consumed only body of the message BodyOnly bool - // Other options for implementations of the interface - // can be stored in a context + // Context is used for non default options Context context.Context } @@ -205,13 +209,6 @@ func Registry(r registry.Registry) Option { } } -// Secure communication with the broker -func Secure(b bool) Option { - return func(o *Options) { - o.Secure = b - } -} - // TLSConfig sets the TLS Config func TLSConfig(t *tls.Config) Option { return func(o *Options) { @@ -226,6 +223,20 @@ func Logger(l logger.Logger) Option { } } +// Tracer to be used for tracing +func Tracer(t tracer.Tracer) Option { + return func(o *Options) { + o.Tracer = t + } +} + +// Meter sets the meter +func Meter(m meter.Meter) Option { + return func(o *Options) { + o.Meter = m + } +} + // SubscribeContext set context func SubscribeContext(ctx context.Context) SubscribeOption { return func(o *SubscribeOptions) { diff --git a/client/options.go b/client/options.go index a84180eb..82c831e9 100644 --- a/client/options.go +++ b/client/options.go @@ -7,11 +7,13 @@ import ( "github.com/unistack-org/micro/v3/broker" "github.com/unistack-org/micro/v3/codec" "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/meter" "github.com/unistack-org/micro/v3/network/transport" "github.com/unistack-org/micro/v3/registry" "github.com/unistack-org/micro/v3/router" "github.com/unistack-org/micro/v3/selector" "github.com/unistack-org/micro/v3/selector/random" + "github.com/unistack-org/micro/v3/tracer" ) // Options holds client options @@ -28,21 +30,21 @@ type Options struct { Selector selector.Selector Transport transport.Transport Logger logger.Logger + Meter meter.Meter // Lookup used for looking up routes Lookup LookupFunc // Connection Pool PoolSize int PoolTTL time.Duration - - // Middleware for client + Tracer tracer.Tracer + // Wrapper that used client Wrappers []Wrapper - // Default Call Options + // CallOptions that used by default CallOptions CallOptions - // Other options for implementations of the interface - // can be stored in a context + // Context is used for non default options Context context.Context } @@ -81,12 +83,9 @@ type CallOptions struct { AuthToken bool // Network to lookup the route within Network string - // Middleware for low level call func CallWrappers []CallWrapper - - // Other options for implementations of the interface - // can be stored in a context + // Context is uded for non default options Context context.Context } @@ -142,7 +141,6 @@ func NewRequestOptions(opts ...RequestOption) RequestOptions { type RequestOptions struct { ContentType string Stream bool - // Other options for implementations of the interface // can be stored in a context Context context.Context @@ -167,6 +165,8 @@ func NewOptions(opts ...Option) Options { Selector: random.NewSelector(), Logger: logger.DefaultLogger, Broker: broker.DefaultBroker, + Meter: meter.DefaultMeter, + Tracer: tracer.DefaultTracer, } for _, o := range opts { @@ -183,6 +183,13 @@ func Broker(b broker.Broker) Option { } } +// Tracer to be used for tracing +func Tracer(t tracer.Tracer) Option { + return func(o *Options) { + o.Tracer = t + } +} + // Logger to be used for log mesages func Logger(l logger.Logger) Option { return func(o *Options) { @@ -190,6 +197,13 @@ func Logger(l logger.Logger) Option { } } +// Meter to be used for metrics +func Meter(m meter.Meter) Option { + return func(o *Options) { + o.Meter = m + } +} + // Codec to be used to encode/decode requests for a given content type func Codec(contentType string, c codec.Codec) Option { return func(o *Options) { diff --git a/codec/codec.go b/codec/codec.go index 1052d8e2..5702b8fb 100644 --- a/codec/codec.go +++ b/codec/codec.go @@ -25,7 +25,7 @@ var ( var ( // DefaultMaxMsgSize specifies how much data codec can handle - DefaultMaxMsgSize = 1024 * 1024 * 4 // 4Mb + DefaultMaxMsgSize int = 1024 * 1024 * 4 // 4Mb DefaultCodec Codec = NewCodec() ) @@ -62,21 +62,6 @@ type Message struct { Body []byte } -// Option func -type Option func(*Options) - -// Options contains codec options -type Options struct { - MaxMsgSize int64 -} - -// MaxMsgSize sets the max message size -func MaxMsgSize(n int64) Option { - return func(o *Options) { - o.MaxMsgSize = n - } -} - // NewMessage creates new codec message func NewMessage(t MessageType) *Message { return &Message{Type: t, Header: metadata.New(0)} diff --git a/codec/options.go b/codec/options.go new file mode 100644 index 00000000..8cbb0537 --- /dev/null +++ b/codec/options.go @@ -0,0 +1,61 @@ +package codec + +import ( + "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/meter" + "github.com/unistack-org/micro/v3/tracer" +) + +// Option func +type Option func(*Options) + +// Options contains codec options +type Options struct { + MaxMsgSize int + Meter meter.Meter + Logger logger.Logger + Tracer tracer.Tracer +} + +// MaxMsgSize sets the max message size +func MaxMsgSize(n int) Option { + return func(o *Options) { + o.MaxMsgSize = n + } +} + +// Logger sets the logger +func Logger(l logger.Logger) Option { + return func(o *Options) { + o.Logger = l + } +} + +// Tracer to be used for tracing +func Tracer(t tracer.Tracer) Option { + return func(o *Options) { + o.Tracer = t + } +} + +// Meter sets the meter +func Meter(m meter.Meter) Option { + return func(o *Options) { + o.Meter = m + } +} + +func NewOptions(opts ...Option) Options { + options := Options{ + Logger: logger.DefaultLogger, + Meter: meter.DefaultMeter, + Tracer: tracer.DefaultTracer, + MaxMsgSize: DefaultMaxMsgSize, + } + + for _, o := range opts { + o(&options) + } + + return options +} diff --git a/config/options.go b/config/options.go index b50c477c..69b7a0e4 100644 --- a/config/options.go +++ b/config/options.go @@ -5,6 +5,8 @@ import ( "github.com/unistack-org/micro/v3/codec" "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/meter" + "github.com/unistack-org/micro/v3/tracer" ) type Options struct { @@ -15,13 +17,17 @@ type Options struct { AfterSave []func(context.Context, Config) error // Struct that holds config data Struct interface{} - // struct tag name + // StructTag name StructTag string - // logger that will be used + // Logger that will be used Logger logger.Logger - // codec that used for load/save + // Meter that will be used + Meter meter.Meter + // Tracer used for trace + Tracer tracer.Tracer + // Codec that used for load/save Codec codec.Codec - // for alternative data + // Context for alternative data Context context.Context } @@ -30,6 +36,8 @@ type Option func(o *Options) func NewOptions(opts ...Option) Options { options := Options{ Logger: logger.DefaultLogger, + Meter: meter.DefaultMeter, + Tracer: tracer.DefaultTracer, Context: context.Background(), } for _, o := range opts { @@ -88,6 +96,13 @@ func Logger(l logger.Logger) Option { } } +// Tracer to be used for tracing +func Tracer(t tracer.Tracer) Option { + return func(o *Options) { + o.Tracer = t + } +} + // Struct used as config func Struct(v interface{}) Option { return func(o *Options) { diff --git a/network/options.go b/network/options.go index 38d8284f..bad160dc 100644 --- a/network/options.go +++ b/network/options.go @@ -3,9 +3,11 @@ package network import ( "github.com/google/uuid" "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/meter" "github.com/unistack-org/micro/v3/network/tunnel" "github.com/unistack-org/micro/v3/proxy" "github.com/unistack-org/micro/v3/router" + "github.com/unistack-org/micro/v3/tracer" ) // Option func @@ -31,6 +33,10 @@ type Options struct { Proxy proxy.Proxy // Logger Logger logger.Logger + // Meter + Meter meter.Meter + // Tracer + Tracer tracer.Tracer } // Id sets the id of the network node @@ -96,11 +102,34 @@ func Logger(l logger.Logger) Option { } } -// DefaultOptions returns network default options -func DefaultOptions() Options { - return Options{ +// Meter sets the meter +func Meter(m meter.Meter) Option { + return func(o *Options) { + o.Meter = m + } +} + +// Tracer to be used for tracing +func Tracer(t tracer.Tracer) Option { + return func(o *Options) { + o.Tracer = t + } +} + +// NewOptions returns network default options +func NewOptions(opts ...Option) Options { + options := Options{ Id: uuid.New().String(), Name: "go.micro", Address: ":0", + Logger: logger.DefaultLogger, + Meter: meter.DefaultMeter, + Tracer: tracer.DefaultTracer, } + + for _, o := range opts { + o(&options) + } + + return options } diff --git a/network/transport/options.go b/network/transport/options.go index 4c788be9..5b497c7d 100644 --- a/network/transport/options.go +++ b/network/transport/options.go @@ -7,6 +7,8 @@ import ( "github.com/unistack-org/micro/v3/codec" "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/meter" + "github.com/unistack-org/micro/v3/tracer" ) type Options struct { @@ -26,6 +28,10 @@ type Options struct { Timeout time.Duration // Logger sets the logger Logger logger.Logger + // Meter sets the meter + Meter meter.Meter + // Tracer + Tracer tracer.Tracer // Other options for implementations of the interface // can be stored in a context Context context.Context @@ -35,6 +41,8 @@ type Options struct { func NewOptions(opts ...Option) Options { options := Options{ Logger: logger.DefaultLogger, + Meter: meter.DefaultMeter, + Tracer: tracer.DefaultTracer, Context: context.Background(), } @@ -112,6 +120,13 @@ func Logger(l logger.Logger) Option { } } +// Meter sets the meter +func Meter(m meter.Meter) Option { + return func(o *Options) { + o.Meter = m + } +} + // Context sets the context func Context(ctx context.Context) Option { return func(o *Options) { @@ -134,14 +149,6 @@ func Timeout(t time.Duration) Option { } } -// Use secure communication. If TLSConfig is not specified we -// use InsecureSkipVerify and generate a self signed cert -func Secure(b bool) Option { - return func(o *Options) { - o.Secure = b - } -} - // TLSConfig to be used for the transport. func TLSConfig(t *tls.Config) Option { return func(o *Options) { @@ -162,3 +169,10 @@ func WithTimeout(d time.Duration) DialOption { o.Timeout = d } } + +// Tracer to be used for tracing +func Tracer(t tracer.Tracer) Option { + return func(o *Options) { + o.Tracer = t + } +} diff --git a/network/tunnel/options.go b/network/tunnel/options.go index 4a2fa6c9..788d69ba 100644 --- a/network/tunnel/options.go +++ b/network/tunnel/options.go @@ -5,7 +5,9 @@ import ( "github.com/google/uuid" "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/meter" "github.com/unistack-org/micro/v3/network/transport" + "github.com/unistack-org/micro/v3/tracer" ) var ( @@ -32,6 +34,10 @@ type Options struct { Transport transport.Transport // Logger Logger logger.Logger + // Meter + Meter meter.Meter + // Tracer + Tracer tracer.Tracer } // DialOption func @@ -74,6 +80,13 @@ func Logger(l logger.Logger) Option { } } +// Meter sets the meter +func Meter(m meter.Meter) Option { + return func(o *Options) { + o.Meter = m + } +} + // Address sets the tunnel address func Address(a string) Option { return func(o *Options) { @@ -152,9 +165,19 @@ func NewOptions(opts ...Option) Options { Id: uuid.New().String(), Address: DefaultAddress, Token: DefaultToken, + Logger: logger.DefaultLogger, + Meter: meter.DefaultMeter, + Tracer: tracer.DefaultTracer, } for _, o := range opts { o(&options) } return options } + +// Tracer to be used for tracing +func Tracer(t tracer.Tracer) Option { + return func(o *Options) { + o.Tracer = t + } +} diff --git a/options.go b/options.go index 78804e58..f023e171 100644 --- a/options.go +++ b/options.go @@ -11,6 +11,7 @@ import ( "github.com/unistack-org/micro/v3/debug/profile" "github.com/unistack-org/micro/v3/logger" "github.com/unistack-org/micro/v3/metadata" + "github.com/unistack-org/micro/v3/meter" "github.com/unistack-org/micro/v3/registry" "github.com/unistack-org/micro/v3/router" "github.com/unistack-org/micro/v3/runtime" @@ -25,11 +26,13 @@ type Options struct { Auth auth.Auth Broker broker.Broker Logger logger.Logger + Meter meter.Meter Configs []config.Config Client client.Client Server server.Server Store store.Store Registry registry.Registry + Tracer tracer.Tracer Router router.Router Runtime runtime.Runtime Profile profile.Profile @@ -56,6 +59,8 @@ func NewOptions(opts ...Option) Options { Router: router.DefaultRouter, Auth: auth.DefaultAuth, Logger: logger.DefaultLogger, + Tracer: tracer.DefaultTracer, + Meter: meter.DefaultMeter, Configs: []config.Config{config.DefaultConfig}, Store: store.DefaultStore, //Runtime runtime.Runtime @@ -129,6 +134,13 @@ func Logger(l logger.Logger) Option { } } +// Meter set the meter to use +func Meter(m meter.Meter) Option { + return func(o *Options) { + o.Meter = m + } +} + // Registry sets the registry for the service // and the underlying components func Registry(r registry.Registry) Option { @@ -152,10 +164,13 @@ func Registry(r registry.Registry) Option { // Tracer sets the tracer for the service func Tracer(t tracer.Tracer) Option { return func(o *Options) { + o.Tracer = t if o.Server != nil { - //todo client trace o.Server.Init(server.Tracer(t)) } + if o.Client != nil { + o.Client.Init(client.Tracer(t)) + } } } diff --git a/proxy/options.go b/proxy/options.go index 6ce8084a..77811cff 100644 --- a/proxy/options.go +++ b/proxy/options.go @@ -4,7 +4,9 @@ package proxy import ( "github.com/unistack-org/micro/v3/client" "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/meter" "github.com/unistack-org/micro/v3/router" + "github.com/unistack-org/micro/v3/tracer" ) // Options for proxy @@ -19,11 +21,29 @@ type Options struct { Links map[string]client.Client // Logger Logger logger.Logger + // Meter + Meter meter.Meter + // Tracer + Tracer tracer.Tracer } // Option func signature type Option func(o *Options) +func NewOptions(opts ...Option) Options { + options := Options{ + Logger: logger.DefaultLogger, + Meter: meter.DefaultMeter, + Tracer: tracer.DefaultTracer, + } + + for _, o := range opts { + o(&options) + } + + return options +} + // WithEndpoint sets a proxy endpoint func WithEndpoint(e string) Option { return func(o *Options) { @@ -52,6 +72,13 @@ func WithLogger(l logger.Logger) Option { } } +// WithMeter specifies the meter to use +func WithMeter(m meter.Meter) Option { + return func(o *Options) { + o.Meter = m + } +} + // WithLink sets a link for outbound requests func WithLink(name string, c client.Client) Option { return func(o *Options) { @@ -61,3 +88,10 @@ func WithLink(name string, c client.Client) Option { o.Links[name] = c } } + +// Tracer to be used for tracing +func Tracer(t tracer.Tracer) Option { + return func(o *Options) { + o.Tracer = t + } +} diff --git a/registry/options.go b/registry/options.go index 1c283b2e..64dc5c44 100644 --- a/registry/options.go +++ b/registry/options.go @@ -6,16 +6,21 @@ import ( "time" "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/meter" + "github.com/unistack-org/micro/v3/tracer" ) type Options struct { Addrs []string Timeout time.Duration - Secure bool TLSConfig *tls.Config - // Logger imp + // Logger that will be used Logger logger.Logger + // Meter that will be used + Meter meter.Meter + // Tracer + Tracer tracer.Tracer // Other options for implementations of the interface // can be stored in a context Context context.Context @@ -24,6 +29,8 @@ type Options struct { func NewOptions(opts ...Option) Options { options := Options{ Logger: logger.DefaultLogger, + Meter: meter.DefaultMeter, + Tracer: tracer.DefaultTracer, Context: context.Background(), } for _, o := range opts { @@ -142,13 +149,6 @@ func Timeout(t time.Duration) Option { } } -// Secure communication with the registry -func Secure(b bool) Option { - return func(o *Options) { - o.Secure = b - } -} - // Logger sets the logger func Logger(l logger.Logger) Option { return func(o *Options) { @@ -156,6 +156,20 @@ func Logger(l logger.Logger) Option { } } +// Meter sets the meter +func Meter(m meter.Meter) Option { + return func(o *Options) { + o.Meter = m + } +} + +// Tracer sets the tracer +func Tracer(t tracer.Tracer) Option { + return func(o *Options) { + o.Tracer = t + } +} + // Context sets the context func Context(ctx context.Context) Option { return func(o *Options) { diff --git a/server/options.go b/server/options.go index 5b177f93..7bac29f0 100644 --- a/server/options.go +++ b/server/options.go @@ -12,6 +12,7 @@ import ( "github.com/unistack-org/micro/v3/codec" "github.com/unistack-org/micro/v3/logger" "github.com/unistack-org/micro/v3/metadata" + "github.com/unistack-org/micro/v3/meter" "github.com/unistack-org/micro/v3/network/transport" "github.com/unistack-org/micro/v3/registry" "github.com/unistack-org/micro/v3/tracer" @@ -28,6 +29,7 @@ type Options struct { Tracer tracer.Tracer Auth auth.Auth Logger logger.Logger + Meter meter.Meter Transport transport.Transport Metadata metadata.Metadata Name string @@ -78,6 +80,7 @@ func NewOptions(opts ...Option) Options { RegisterTTL: DefaultRegisterTTL, RegisterCheck: DefaultRegisterCheck, Logger: logger.DefaultLogger, + Meter: meter.DefaultMeter, Tracer: tracer.DefaultTracer, Broker: broker.DefaultBroker, Registry: registry.DefaultRegistry, @@ -117,6 +120,13 @@ func Logger(l logger.Logger) Option { } } +// Meter sets the meter option +func Meter(m meter.Meter) Option { + return func(o *Options) { + o.Meter = m + } +} + // Id unique server id func Id(id string) Option { return func(o *Options) { @@ -235,7 +245,6 @@ func TLSConfig(t *tls.Config) Option { // set the transport tls o.Transport.Init( - transport.Secure(true), transport.TLSConfig(t), ) } diff --git a/store/options.go b/store/options.go index b21e4c42..d40b554d 100644 --- a/store/options.go +++ b/store/options.go @@ -7,6 +7,8 @@ import ( "github.com/unistack-org/micro/v3/codec" "github.com/unistack-org/micro/v3/logger" "github.com/unistack-org/micro/v3/metadata" + "github.com/unistack-org/micro/v3/meter" + "github.com/unistack-org/micro/v3/tracer" ) // Options contains configuration for the Store @@ -23,6 +25,10 @@ type Options struct { Codec codec.Codec // Logger the logger Logger logger.Logger + // Meter the meter + Meter meter.Meter + // Tracer the tacer + Tracer tracer.Tracer // Context should contain all implementation specific options, using context.WithValue. Context context.Context } @@ -33,6 +39,8 @@ func NewOptions(opts ...Option) Options { Logger: logger.DefaultLogger, Context: context.Background(), Codec: codec.DefaultCodec, + Tracer: tracer.DefaultTracer, + Meter: meter.DefaultMeter, } for _, o := range opts { o(&options) @@ -64,6 +72,20 @@ func Logger(l logger.Logger) Option { } } +// Meter sets the meter +func Meter(m meter.Meter) Option { + return func(o *Options) { + o.Meter = m + } +} + +// Tracer sets the tracer +func Tracer(t tracer.Tracer) Option { + return func(o *Options) { + o.Tracer = t + } +} + // Nodes contains the addresses or other connection information of the backing storage. // For example, an etcd implementation would contain the nodes of the cluster. // A SQL implementation could contain one or more connection strings. diff --git a/sync/options.go b/sync/options.go index d4f9d1c4..9c70a3d1 100644 --- a/sync/options.go +++ b/sync/options.go @@ -4,16 +4,34 @@ import ( "time" "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/meter" + "github.com/unistack-org/micro/v3/tracer" ) type Options struct { Nodes []string Prefix string Logger logger.Logger + Tracer tracer.Tracer + Meter meter.Meter } type Option func(o *Options) +func NewOptions(opts ...Option) Options { + options := Options{ + Logger: logger.DefaultLogger, + Meter: meter.DefaultMeter, + Tracer: tracer.DefaultTracer, + } + + for _, o := range opts { + o(&options) + } + + return options +} + type LeaderOptions struct{} type LeaderOption func(o *LeaderOptions) @@ -32,6 +50,20 @@ func Logger(l logger.Logger) Option { } } +// Meter sets the logger +func Meter(m meter.Meter) Option { + return func(o *Options) { + o.Meter = m + } +} + +// Tracer sets the tracer +func Tracer(t tracer.Tracer) Option { + return func(o *Options) { + o.Tracer = t + } +} + // Nodes sets the addresses to use func Nodes(a ...string) Option { return func(o *Options) {