You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
563 B
26 lines
563 B
package common
|
|
|
|
import (
|
|
"github.com/opentracing/opentracing-go"
|
|
"github.com/uber/jaeger-client-go"
|
|
"github.com/uber/jaeger-client-go/config"
|
|
"io"
|
|
"time"
|
|
)
|
|
|
|
func NewTracer(serviceName string, addr string) (opentracing.Tracer, io.Closer, error) {
|
|
cfg := config.Configuration{
|
|
ServiceName: serviceName,
|
|
Sampler: &config.SamplerConfig{
|
|
Type: jaeger.SamplerTypeConst,
|
|
Param: 1,
|
|
},
|
|
Reporter: &config.ReporterConfig{
|
|
BufferFlushInterval: time.Second,
|
|
LogSpans: true,
|
|
LocalAgentHostPort: addr,
|
|
},
|
|
}
|
|
return cfg.NewTracer()
|
|
}
|