mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
P2P Message Execution Tracing (#517)
* Request execution tracing initial commit * Resolve linter issues * Run gazelle * Make trace sampling configurable, clean up, update doc * Document trace span creation * Fix linter issue
This commit is contained in:
committed by
Preston Van Loon
parent
75d32588e0
commit
2a51ed3f39
@@ -65,6 +65,9 @@ VERSION:
|
||||
types.BeaconRPCProviderFlag,
|
||||
cmd.VerbosityFlag,
|
||||
cmd.DataDirFlag,
|
||||
cmd.EnableTracingFlag,
|
||||
cmd.TracingEndpointFlag,
|
||||
cmd.TraceSampleFractionFlag,
|
||||
debug.PProfFlag,
|
||||
debug.PProfAddrFlag,
|
||||
debug.PProfPortFlag,
|
||||
|
||||
@@ -22,6 +22,7 @@ go_library(
|
||||
"//shared/database:go_default_library",
|
||||
"//shared/debug:go_default_library",
|
||||
"//shared/p2p:go_default_library",
|
||||
"//shared/p2p/adapter/tracer:go_default_library",
|
||||
"//validator/attester:go_default_library",
|
||||
"//validator/beacon:go_default_library",
|
||||
"//validator/proposer:go_default_library",
|
||||
|
||||
@@ -51,7 +51,7 @@ func NewShardInstance(ctx *cli.Context) (*ShardEthereum, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := shardEthereum.registerP2P(); err != nil {
|
||||
if err := shardEthereum.registerP2P(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -136,8 +136,8 @@ func (s *ShardEthereum) startDB(ctx *cli.Context) error {
|
||||
}
|
||||
|
||||
// registerP2P attaches a p2p server to the ShardEthereum instance.
|
||||
func (s *ShardEthereum) registerP2P() error {
|
||||
shardp2p, err := configureP2P()
|
||||
func (s *ShardEthereum) registerP2P(ctx *cli.Context) error {
|
||||
shardp2p, err := configureP2P(ctx)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not register shardp2p service: %v", err)
|
||||
}
|
||||
|
||||
@@ -2,7 +2,10 @@ package node
|
||||
|
||||
import (
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/prysmaticlabs/prysm/shared/cmd"
|
||||
"github.com/prysmaticlabs/prysm/shared/p2p"
|
||||
"github.com/prysmaticlabs/prysm/shared/p2p/adapter/tracer"
|
||||
"github.com/urfave/cli"
|
||||
|
||||
pb "github.com/prysmaticlabs/prysm/proto/sharding/p2p/v1"
|
||||
)
|
||||
@@ -13,15 +16,22 @@ var topicMappings = map[pb.Topic]proto.Message{
|
||||
pb.Topic_TRANSACTIONS: &pb.Transaction{},
|
||||
}
|
||||
|
||||
func configureP2P() (*p2p.Server, error) {
|
||||
func configureP2P(ctx *cli.Context) (*p2p.Server, error) {
|
||||
s, err := p2p.NewServer()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
traceAdapter, err := tracer.New("validator",
|
||||
ctx.GlobalString(cmd.TracingEndpointFlag.Name),
|
||||
ctx.GlobalFloat64(cmd.TraceSampleFractionFlag.Name),
|
||||
ctx.GlobalBool(cmd.EnableTracingFlag.Name))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// TODO(437): Define default adapters for logging, monitoring, etc.
|
||||
// TODO(438): Define default adapters for logging, monitoring, etc.
|
||||
var adapters []p2p.Adapter
|
||||
adapters := []p2p.Adapter{traceAdapter}
|
||||
for k, v := range topicMappings {
|
||||
s.RegisterTopic(k.String(), v, adapters...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user