feat(tracing): switch to OpenTelemetry

Switch the underlying tracing library to OpenTelemetry, with a bridge to OpenCensus for
compatibility
This commit is contained in:
hannahhoward
2021-12-01 16:19:47 -08:00
parent 0cfc344f82
commit f3b691d618
5 changed files with 84 additions and 50 deletions
+3 -3
View File
@@ -7,7 +7,6 @@ import (
"github.com/fatih/color"
logging "github.com/ipfs/go-log/v2"
"github.com/urfave/cli/v2"
"go.opencensus.io/trace"
"golang.org/x/xerrors"
cliutil "github.com/filecoin-project/lotus/cli/util"
@@ -55,10 +54,11 @@ func main() {
lcli.WithCategory("storage", sealingCmd),
lcli.WithCategory("retrieval", piecesCmd),
}
jaeger := tracing.SetupJaegerTracing("lotus")
defer func() {
if jaeger != nil {
jaeger.Flush()
_ = jaeger.ForceFlush(context.Background())
}
}()
@@ -66,7 +66,7 @@ func main() {
cmd := cmd
originBefore := cmd.Before
cmd.Before = func(cctx *cli.Context) error {
trace.UnregisterExporter(jaeger)
_ = jaeger.Shutdown(cctx.Context)
jaeger = tracing.SetupJaegerTracing("lotus/" + cmd.Name)
if cctx.IsSet("color") {
+2 -2
View File
@@ -39,7 +39,7 @@ func main() {
jaeger := tracing.SetupJaegerTracing("lotus")
defer func() {
if jaeger != nil {
jaeger.Flush()
_ = jaeger.ForceFlush(context.Background())
}
}()
@@ -47,7 +47,7 @@ func main() {
cmd := cmd
originBefore := cmd.Before
cmd.Before = func(cctx *cli.Context) error {
trace.UnregisterExporter(jaeger)
_ = jaeger.Shutdown(cctx.Context)
jaeger = tracing.SetupJaegerTracing("lotus/" + cmd.Name)
if originBefore != nil {