lotus/tracing/setup.go
Jakub Sztandera 81b5f46062 Implement RPC tracing
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
2019-07-26 08:50:21 +02:00

30 lines
608 B
Go

package tracing
import (
"contrib.go.opencensus.io/exporter/jaeger"
logging "github.com/ipfs/go-log"
"go.opencensus.io/trace"
)
var log = logging.Logger("tracing")
func SetupJaegerTracing(serviceName string) *jaeger.Exporter {
agentEndpointURI := "localhost:6831"
je, err := jaeger.NewExporter(jaeger.Options{
AgentEndpoint: agentEndpointURI,
ServiceName: serviceName,
})
if err != nil {
log.Errorw("Failed to create the Jaeger exporter", "error", err)
return nil
}
trace.RegisterExporter(je)
trace.ApplyConfig(trace.Config{
DefaultSampler: trace.AlwaysSample(),
})
return je
}