Skip to content

Commit

Permalink
Merge pull request #196 from quorumcontrol/feature/opentracing
Browse files Browse the repository at this point in the history
opentracing
  • Loading branch information
brandonwestcott authored Mar 22, 2019
2 parents f916fee + c237998 commit d298e74
Show file tree
Hide file tree
Showing 12 changed files with 375 additions and 50 deletions.
146 changes: 143 additions & 3 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 19 additions & 1 deletion cmd/testnode.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
gossip3remote "github.com/quorumcontrol/tupelo-go-client/gossip3/remote"
gossip3types "github.com/quorumcontrol/tupelo-go-client/gossip3/types"
"github.com/quorumcontrol/tupelo-go-client/p2p"
"github.com/quorumcontrol/tupelo-go-client/tracing"
gossip3actors "github.com/quorumcontrol/tupelo/gossip3/actors"
"github.com/quorumcontrol/tupelo/gossip3/messages"
"github.com/spf13/cobra"
Expand All @@ -43,6 +44,9 @@ var (
BlsSignKeys []*bls.SignKey
EcdsaKeys []*ecdsa.PrivateKey
testnodePort int

enableJaegerTracing bool
enableElasticTracing bool
)

// testnodeCmd represents the testnode command
Expand All @@ -59,6 +63,15 @@ var testnodeCmd = &cobra.Command{
ecdsaKeyHex := os.Getenv("TUPELO_NODE_ECDSA_KEY_HEX")
blsKeyHex := os.Getenv("TUPELO_NODE_BLS_KEY_HEX")
signer := setupGossipNode(ctx, ecdsaKeyHex, blsKeyHex, "distributed-network", testnodePort)
if enableElasticTracing && enableJaegerTracing {
panic("only one tracing library may be used at once")
}
if enableJaegerTracing {
tracing.StartJaeger("signer-" + signer.ID)
}
if enableElasticTracing {
tracing.StartElastic()
}
actor.EmptyRootContext.Send(signer.Actor, &messages.StartGossip{})
stopOnSignal(signer)
},
Expand Down Expand Up @@ -161,16 +174,21 @@ func stopOnSignal(signers ...*gossip3types.Signer) {
fmt.Println(sig)
for _, signer := range signers {
log.Info("gracefully stopping signer")
signer.Actor.GracefulStop()
signer.Actor.GracefulPoison()
}
done <- true
}()
fmt.Println("awaiting signal")
<-done
if enableJaegerTracing {
tracing.StopJaeger()
}
fmt.Println("exiting")
}

func init() {
rootCmd.AddCommand(testnodeCmd)
testnodeCmd.Flags().IntVarP(&testnodePort, "port", "p", 0, "what port will the node listen on")
testnodeCmd.Flags().BoolVar(&enableJaegerTracing, "jaeger-tracing", false, "enable jaeger tracing")
testnodeCmd.Flags().BoolVar(&enableElasticTracing, "elastic-tracing", false, "enable elastic tracing")
}
Loading

0 comments on commit d298e74

Please sign in to comment.