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

@@ -4,14 +4,15 @@ import (
"context"
"time"
"github.com/micro/cli/v2"
"github.com/micro/go-micro/broker"
"github.com/micro/go-micro/client"
"github.com/micro/go-micro/client/selector"
"github.com/micro/go-micro/config/cmd"
"github.com/micro/go-micro/debug/trace"
"github.com/micro/go-micro/registry"
"github.com/micro/go-micro/server"
"github.com/micro/go-micro/transport"
"github.com/micro/cli/v2"
)
type Options struct {
@@ -112,6 +113,13 @@ func Registry(r registry.Registry) Option {
}
}
// Tracer sets the tracer for the service
func Tracer(t trace.Tracer) Option {
return func(o *Options) {
o.Server.Init(server.Tracer(t))
}
}
// Selector sets the selector for the service client
func Selector(s selector.Selector) Option {
return func(o *Options) {