Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --enable-tracing flag to booster-http #776

Merged
merged 1 commit into from
Sep 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions cmd/booster-http/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ var runCmd = &cli.Command{
Usage: "the endpoint for the storage node API",
Required: true,
},
&cli.BoolFlag{
Name: "enable-tracing",
Usage: "enables tracing of booster-http calls",
Value: false,
},
},
Action: func(cctx *cli.Context) error {
if cctx.Bool("pprof") {
Expand Down Expand Up @@ -113,9 +118,14 @@ var runCmd = &cli.Command{
defer storageCloser()

// Instantiate the tracer and exporter
tracingStopper, err := tracing.New(ctx, "booster-http")
if err != nil {
return fmt.Errorf("failed to instantiate tracer: %w", err)
enableTracing := cctx.Bool("enable-tracing")
var tracingStopper func(context.Context) error
if enableTracing {
tracingStopper, err = tracing.New(ctx, "booster-http")
if err != nil {
return fmt.Errorf("failed to instantiate tracer: %w", err)
}
log.Info("Tracing exporter enabled")
}

maddr, err := storageService.ActorAddress(ctx)
Expand Down Expand Up @@ -183,9 +193,11 @@ var runCmd = &cli.Command{
// Sync all loggers.
_ = log.Sync() //nolint:errcheck

err = tracingStopper(ctx)
if err != nil {
return err
if enableTracing {
err = tracingStopper(ctx)
if err != nil {
return err
}
}

return nil
Expand Down
2 changes: 1 addition & 1 deletion docker/devnet/booster-http/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ echo $MINER_API_INFO
echo $BOOST_API_INFO

echo Starting booster-http...
exec booster-http run --api-boost=$BOOST_API_INFO --api-fullnode=$FULLNODE_API_INFO --api-storage=$MINER_API_INFO
exec booster-http run --api-boost=$BOOST_API_INFO --api-fullnode=$FULLNODE_API_INFO --api-storage=$MINER_API_INFO --enable-tracing=true