Refactor debug/trace ready for Jaeger

This commit is contained in:
Micro
2020-01-29 15:45:11 +00:00
parent 1108cc5e91
commit 62c067adcd
10 changed files with 130 additions and 36 deletions

View File

@@ -7,6 +7,7 @@ import (
"github.com/micro/go-micro/broker"
"github.com/micro/go-micro/codec"
"github.com/micro/go-micro/debug/trace"
"github.com/micro/go-micro/registry"
"github.com/micro/go-micro/transport"
)
@@ -15,6 +16,7 @@ type Options struct {
Codecs map[string]codec.NewCodec
Broker broker.Broker
Registry registry.Registry
Tracer trace.Tracer
Transport transport.Transport
Metadata map[string]string
Name string
@@ -152,6 +154,13 @@ func Registry(r registry.Registry) Option {
}
}
// Tracer mechanism for distributed tracking
func Tracer(t trace.Tracer) Option {
return func(o *Options) {
o.Tracer = t
}
}
// Transport mechanism for communication e.g http, rabbitmq, etc
func Transport(t transport.Transport) Option {
return func(o *Options) {