Move Shared/ Subpackages Into Monitoring/ Folder (#9591)

* add tracing

* monitoring pkg

* move prom

* Add client stats

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
Raul Jordan 2021-09-14 15:59:51 -05:00 committed by GitHub
parent 5b37deb1a6
commit 9935ca3733
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
102 changed files with 270 additions and 281 deletions

View File

@ -46,6 +46,7 @@ go_library(
"//beacon-chain/state:go_default_library",
"//beacon-chain/state/stategen:go_default_library",
"//cmd/beacon-chain/flags:go_default_library",
"//monitoring/tracing:go_default_library",
"//proto/eth/v1:go_default_library",
"//proto/prysm/v1alpha1:go_default_library",
"//proto/prysm/v1alpha1/block:go_default_library",
@ -57,7 +58,6 @@ go_library(
"//shared/params:go_default_library",
"//shared/slotutil:go_default_library",
"//shared/timeutils:go_default_library",
"//shared/traceutil:go_default_library",
"//shared/version:go_default_library",
"@com_github_emicklei_dot//:go_default_library",
"@com_github_pkg_errors//:go_default_library",

View File

@ -10,13 +10,13 @@ import (
"github.com/prysmaticlabs/prysm/beacon-chain/core"
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
"github.com/prysmaticlabs/prysm/beacon-chain/state"
"github.com/prysmaticlabs/prysm/monitoring/tracing"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block"
"github.com/prysmaticlabs/prysm/shared/attestationutil"
"github.com/prysmaticlabs/prysm/shared/bytesutil"
"github.com/prysmaticlabs/prysm/shared/featureconfig"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/traceutil"
"go.opencensus.io/trace"
)
@ -114,7 +114,7 @@ func (s *Service) VerifyBlkDescendant(ctx context.Context, root [32]byte) error
err := fmt.Errorf("block %#x is not a descendent of the current finalized block slot %d, %#x != %#x",
bytesutil.Trunc(root[:]), finalizedBlk.Slot(), bytesutil.Trunc(bFinalizedRoot),
bytesutil.Trunc(fRoot[:]))
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return err
}
return nil

View File

@ -8,10 +8,10 @@ import (
"github.com/prysmaticlabs/prysm/beacon-chain/core"
"github.com/prysmaticlabs/prysm/beacon-chain/core/feed"
statefeed "github.com/prysmaticlabs/prysm/beacon-chain/core/feed/state"
"github.com/prysmaticlabs/prysm/monitoring/tracing"
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block"
"github.com/prysmaticlabs/prysm/shared/featureconfig"
"github.com/prysmaticlabs/prysm/shared/timeutils"
"github.com/prysmaticlabs/prysm/shared/traceutil"
"go.opencensus.io/trace"
)
@ -39,7 +39,7 @@ func (s *Service) ReceiveBlock(ctx context.Context, block block.SignedBeaconBloc
// Apply state transition on the new block.
if err := s.onBlock(ctx, blockCopy, blockRoot); err != nil {
err := errors.Wrap(err, "could not process block")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return err
}
@ -99,14 +99,14 @@ func (s *Service) ReceiveBlockBatch(ctx context.Context, blocks []block.SignedBe
fCheckpoints, jCheckpoints, err := s.onBlockBatch(ctx, blocks, blkRoots)
if err != nil {
err := errors.Wrap(err, "could not process block in batch")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return err
}
for i, b := range blocks {
blockCopy := b.Copy()
if err = s.handleBlockAfterBatchVerify(ctx, blockCopy, blkRoots[i], fCheckpoints[i], jCheckpoints[i]); err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return err
}
// Send notification of the processed block to the state feed.

View File

@ -19,11 +19,11 @@ go_library(
"//beacon-chain/core:go_default_library",
"//beacon-chain/core/helpers:go_default_library",
"//beacon-chain/state:go_default_library",
"//monitoring/tracing:go_default_library",
"//proto/prysm/v1alpha1:go_default_library",
"//shared/attestationutil:go_default_library",
"//shared/mathutil:go_default_library",
"//shared/params:go_default_library",
"//shared/traceutil:go_default_library",
"@com_github_pkg_errors//:go_default_library",
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
"@io_opencensus_go//trace:go_default_library",

View File

@ -9,10 +9,10 @@ import (
"github.com/prysmaticlabs/prysm/beacon-chain/core"
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
"github.com/prysmaticlabs/prysm/beacon-chain/state"
"github.com/prysmaticlabs/prysm/monitoring/tracing"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/shared/attestationutil"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/traceutil"
"go.opencensus.io/trace"
)
@ -44,12 +44,12 @@ func ProcessAttestations(
}
v.IsCurrentEpochAttester, v.IsCurrentEpochTargetAttester, err = AttestedCurrentEpoch(state, a)
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return nil, nil, errors.Wrap(err, "could not check validator attested current epoch")
}
v.IsPrevEpochAttester, v.IsPrevEpochTargetAttester, v.IsPrevEpochHeadAttester, err = AttestedPrevEpoch(state, a)
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return nil, nil, errors.Wrap(err, "could not check validator attested previous epoch")
}

View File

@ -36,6 +36,7 @@ go_library(
"//beacon-chain/core/validators:go_default_library",
"//beacon-chain/state:go_default_library",
"//beacon-chain/state/v1:go_default_library",
"//monitoring/tracing:go_default_library",
"//proto/prysm/v1alpha1:go_default_library",
"//proto/prysm/v1alpha1/block:go_default_library",
"//shared/bls:go_default_library",
@ -44,7 +45,6 @@ go_library(
"//shared/hashutil:go_default_library",
"//shared/mathutil:go_default_library",
"//shared/params:go_default_library",
"//shared/traceutil:go_default_library",
"//shared/version:go_default_library",
"@com_github_pkg_errors//:go_default_library",
"@com_github_prometheus_client_golang//prometheus:go_default_library",

View File

@ -17,10 +17,10 @@ import (
"github.com/prysmaticlabs/prysm/beacon-chain/core/epoch/precompute"
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
"github.com/prysmaticlabs/prysm/beacon-chain/state"
"github.com/prysmaticlabs/prysm/monitoring/tracing"
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block"
"github.com/prysmaticlabs/prysm/shared/mathutil"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/traceutil"
"github.com/prysmaticlabs/prysm/shared/version"
"go.opencensus.io/trace"
)
@ -115,7 +115,7 @@ func ProcessSlot(ctx context.Context, state state.BeaconState) (state.BeaconStat
}
prevBlockRoot, err := state.LatestBlockHeader().HashTreeRoot()
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return nil, errors.Wrap(err, "could not determine prev block root")
}
// Cache the block root.
@ -181,7 +181,7 @@ func ProcessSlots(ctx context.Context, state state.BeaconState, slot types.Slot)
// The block must have a higher slot than parent state.
if state.Slot() >= slot {
err := fmt.Errorf("expected state.slot %d < slot %d", state.Slot(), slot)
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return nil, err
}
@ -215,14 +215,14 @@ func ProcessSlots(ctx context.Context, state state.BeaconState, slot types.Slot)
}
defer func() {
if err := SkipSlotCache.MarkNotInProgress(key); err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
log.WithError(err).Error("Failed to mark skip slot no longer in progress")
}
}()
for state.Slot() < slot {
if ctx.Err() != nil {
traceutil.AnnotateError(span, ctx.Err())
tracing.AnnotateError(span, ctx.Err())
// Cache last best value.
if highestSlot < state.Slot() {
if err := SkipSlotCache.Put(ctx, key, state); err != nil {
@ -233,7 +233,7 @@ func ProcessSlots(ctx context.Context, state state.BeaconState, slot types.Slot)
}
state, err = ProcessSlot(ctx, state)
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return nil, errors.Wrap(err, "could not process slot")
}
if CanProcessEpoch(state) {
@ -241,13 +241,13 @@ func ProcessSlots(ctx context.Context, state state.BeaconState, slot types.Slot)
case version.Phase0:
state, err = ProcessEpochPrecompute(ctx, state)
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return nil, errors.Wrap(err, "could not process epoch with optimizations")
}
case version.Altair:
state, err = altair.ProcessEpoch(ctx, state)
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return nil, errors.Wrap(err, "could not process epoch")
}
default:
@ -255,14 +255,14 @@ func ProcessSlots(ctx context.Context, state state.BeaconState, slot types.Slot)
}
}
if err := state.SetSlot(state.Slot() + 1); err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return nil, errors.Wrap(err, "failed to increment state slot")
}
if CanUpgradeToAltair(state.Slot()) {
state, err = altair.UpgradeToAltair(ctx, state)
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return nil, err
}
}
@ -271,7 +271,7 @@ func ProcessSlots(ctx context.Context, state state.BeaconState, slot types.Slot)
if highestSlot < state.Slot() {
if err := SkipSlotCache.Put(ctx, key, state); err != nil {
log.WithError(err).Error("Failed to put skip slot cache value")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
}
}

View File

@ -12,10 +12,10 @@ import (
"github.com/prysmaticlabs/prysm/beacon-chain/core/transition/interop"
v "github.com/prysmaticlabs/prysm/beacon-chain/core/validators"
"github.com/prysmaticlabs/prysm/beacon-chain/state"
"github.com/prysmaticlabs/prysm/monitoring/tracing"
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block"
"github.com/prysmaticlabs/prysm/shared/bls"
"github.com/prysmaticlabs/prysm/shared/featureconfig"
"github.com/prysmaticlabs/prysm/shared/traceutil"
"github.com/prysmaticlabs/prysm/shared/version"
"go.opencensus.io/trace"
)
@ -120,7 +120,7 @@ func CalculateStateRoot(
ctx, span := trace.StartSpan(ctx, "core.state.CalculateStateRoot")
defer span.End()
if ctx.Err() != nil {
traceutil.AnnotateError(span, ctx.Err())
tracing.AnnotateError(span, ctx.Err())
return [32]byte{}, ctx.Err()
}
if state == nil || state.IsNil() {
@ -207,12 +207,12 @@ func ProcessBlockNoVerifyAnySig(
bSet, err := b.BlockSignatureSet(state, blk.ProposerIndex(), signed.Signature(), blk.HashTreeRoot)
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return nil, nil, errors.Wrap(err, "could not retrieve block signature set")
}
rSet, err := b.RandaoSignatureSet(state, signed.Block().Body().RandaoReveal())
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return nil, nil, errors.Wrap(err, "could not retrieve randao signature set")
}
aSet, err := b.AttestationSignatureSet(ctx, state, signed.Block().Body().Attestations())
@ -302,25 +302,25 @@ func ProcessBlockForStateRoot(
}
state, err = b.ProcessBlockHeaderNoVerify(state, blk.Slot(), blk.ProposerIndex(), blk.ParentRoot(), bodyRoot[:])
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return nil, errors.Wrap(err, "could not process block header")
}
state, err = b.ProcessRandaoNoVerify(state, signed.Block().Body().RandaoReveal())
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return nil, errors.Wrap(err, "could not verify and process randao")
}
state, err = b.ProcessEth1DataInBlock(ctx, state, signed.Block().Body().Eth1Data())
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return nil, errors.Wrap(err, "could not process eth1 data")
}
state, err = ProcessOperationsNoVerifyAttsSigs(ctx, state, signed)
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return nil, errors.Wrap(err, "could not process block operation")
}

View File

@ -13,9 +13,9 @@ go_library(
"//beacon-chain/db/filters:go_default_library",
"//beacon-chain/slasher/types:go_default_library",
"//beacon-chain/state:go_default_library",
"//monitoring/backup:go_default_library",
"//proto/prysm/v1alpha1:go_default_library",
"//proto/prysm/v1alpha1/block:go_default_library",
"//shared/backuputil:go_default_library",
"@com_github_ethereum_go_ethereum//common:go_default_library",
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
],

View File

@ -12,11 +12,11 @@ import (
"github.com/prysmaticlabs/prysm/beacon-chain/db/filters"
slashertypes "github.com/prysmaticlabs/prysm/beacon-chain/slasher/types"
"github.com/prysmaticlabs/prysm/beacon-chain/state"
"github.com/prysmaticlabs/prysm/monitoring/backup"
eth "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
v2 "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block"
"github.com/prysmaticlabs/prysm/shared/backuputil"
)
// ReadOnlyDatabase defines a struct which only has read access to database methods.
@ -151,7 +151,7 @@ type SlasherDatabase interface {
// Database interface with full access.
type Database interface {
io.Closer
backuputil.BackupExporter
backup.BackupExporter
HeadAccessDatabase
DatabasePath() string

View File

@ -43,6 +43,8 @@ go_library(
"//beacon-chain/state/genesis:go_default_library",
"//beacon-chain/state/v1:go_default_library",
"//beacon-chain/state/v2:go_default_library",
"//monitoring/progress:go_default_library",
"//monitoring/tracing:go_default_library",
"//proto/prysm/v1alpha1:go_default_library",
"//proto/prysm/v1alpha1/block:go_default_library",
"//proto/prysm/v1alpha1/wrapper:go_default_library",
@ -50,9 +52,7 @@ go_library(
"//shared/featureconfig:go_default_library",
"//shared/fileutil:go_default_library",
"//shared/params:go_default_library",
"//shared/progressutil:go_default_library",
"//shared/sliceutil:go_default_library",
"//shared/traceutil:go_default_library",
"//shared/version:go_default_library",
"@com_github_dgraph_io_ristretto//:go_default_library",
"@com_github_ethereum_go_ethereum//common:go_default_library",

View File

@ -6,11 +6,11 @@ import (
"fmt"
"github.com/prysmaticlabs/prysm/beacon-chain/db/filters"
"github.com/prysmaticlabs/prysm/monitoring/tracing"
dbpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block"
"github.com/prysmaticlabs/prysm/shared/bytesutil"
"github.com/prysmaticlabs/prysm/shared/traceutil"
bolt "go.etcd.io/bbolt"
"go.opencensus.io/trace"
)
@ -52,7 +52,7 @@ func (s *Store) updateFinalizedBlockRoots(ctx context.Context, tx *bolt.Tx, chec
previousFinalizedCheckpoint := &ethpb.Checkpoint{}
if b := bkt.Get(previousFinalizedCheckpointKey); b != nil {
if err := decode(ctx, b, previousFinalizedCheckpoint); err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return err
}
}
@ -62,12 +62,12 @@ func (s *Store) updateFinalizedBlockRoots(ctx context.Context, tx *bolt.Tx, chec
SetEndEpoch(checkpoint.Epoch+1),
)
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return err
}
for _, root := range blockRoots {
if err := bkt.Delete(root[:]); err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return err
}
}
@ -81,12 +81,12 @@ func (s *Store) updateFinalizedBlockRoots(ctx context.Context, tx *bolt.Tx, chec
signedBlock, err := s.Block(ctx, bytesutil.ToBytes32(root))
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return err
}
if signedBlock == nil || signedBlock.IsNil() || signedBlock.Block().IsNil() {
err := fmt.Errorf("missing block in database: block root=%#x", root)
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return err
}
block := signedBlock.Block()
@ -98,11 +98,11 @@ func (s *Store) updateFinalizedBlockRoots(ctx context.Context, tx *bolt.Tx, chec
enc, err := encode(ctx, container)
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return err
}
if err := bkt.Put(root, enc); err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return err
}
@ -110,17 +110,17 @@ func (s *Store) updateFinalizedBlockRoots(ctx context.Context, tx *bolt.Tx, chec
if parentBytes := bkt.Get(block.ParentRoot()); parentBytes != nil {
parent := &dbpb.FinalizedBlockRootContainer{}
if err := decode(ctx, parentBytes, parent); err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return err
}
parent.ChildRoot = root
enc, err := encode(ctx, parent)
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return err
}
if err := bkt.Put(block.ParentRoot(), enc); err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return err
}
break
@ -132,7 +132,7 @@ func (s *Store) updateFinalizedBlockRoots(ctx context.Context, tx *bolt.Tx, chec
// Upsert blocks from the current finalized epoch.
roots, err := s.BlockRoots(ctx, filters.NewFilter().SetStartEpoch(checkpoint.Epoch).SetEndEpoch(checkpoint.Epoch+1))
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return err
}
for _, root := range roots {
@ -141,7 +141,7 @@ func (s *Store) updateFinalizedBlockRoots(ctx context.Context, tx *bolt.Tx, chec
continue
}
if err := bkt.Put(root, containerFinalizedButNotCanonical); err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return err
}
}
@ -149,7 +149,7 @@ func (s *Store) updateFinalizedBlockRoots(ctx context.Context, tx *bolt.Tx, chec
// Update previous checkpoint
enc, err := encode(ctx, checkpoint)
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return err
}
@ -175,7 +175,7 @@ func (s *Store) IsFinalizedBlock(ctx context.Context, blockRoot [32]byte) bool {
return nil
})
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
}
return exists
}
@ -198,7 +198,7 @@ func (s *Store) FinalizedChildBlock(ctx context.Context, blockRoot [32]byte) (bl
}
ctr := &dbpb.FinalizedBlockRootContainer{}
if err := decode(ctx, blkBytes, ctr); err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return err
}
enc := tx.Bucket(blocksBucket).Get(ctr.ChildRoot)
@ -209,6 +209,6 @@ func (s *Store) FinalizedChildBlock(ctx context.Context, blockRoot [32]byte) (bl
blk, err = unmarshalBlock(ctx, enc)
return err
})
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return blk, err
}

View File

@ -8,9 +8,9 @@ import (
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/golang/snappy"
"github.com/pkg/errors"
"github.com/prysmaticlabs/prysm/monitoring/progress"
v1alpha1 "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/shared/featureconfig"
"github.com/prysmaticlabs/prysm/shared/progressutil"
bolt "go.etcd.io/bbolt"
)
@ -75,7 +75,7 @@ func migrateStateValidators(ctx context.Context, db *bolt.DB) error {
log.Infof("total keys = %d", len(keys))
// prepare the progress bar with the total count of the keys to migrate
bar := progressutil.InitializeProgressBar(len(keys), "Migrating state validators to new schema.")
bar := progress.InitializeProgressBar(len(keys), "Migrating state validators to new schema.")
batchNo := 0
for batchIndex := 0; batchIndex < len(keys); batchIndex += batchSize {

View File

@ -4,8 +4,8 @@ import (
"context"
"errors"
"github.com/prysmaticlabs/prysm/monitoring/tracing"
v2 "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/shared/traceutil"
bolt "go.etcd.io/bbolt"
"go.opencensus.io/trace"
"google.golang.org/protobuf/proto"
@ -18,7 +18,7 @@ func (s *Store) SavePowchainData(ctx context.Context, data *v2.ETH1ChainData) er
if data == nil {
err := errors.New("cannot save nil eth1data")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return err
}
@ -30,7 +30,7 @@ func (s *Store) SavePowchainData(ctx context.Context, data *v2.ETH1ChainData) er
}
return bkt.Put(powchainDataKey, enc)
})
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return err
}

View File

@ -13,12 +13,12 @@ import (
"github.com/prysmaticlabs/prysm/beacon-chain/state/genesis"
v1 "github.com/prysmaticlabs/prysm/beacon-chain/state/v1"
v2 "github.com/prysmaticlabs/prysm/beacon-chain/state/v2"
"github.com/prysmaticlabs/prysm/monitoring/tracing"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper"
"github.com/prysmaticlabs/prysm/shared/bytesutil"
"github.com/prysmaticlabs/prysm/shared/featureconfig"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/traceutil"
bolt "go.etcd.io/bbolt"
"go.opencensus.io/trace"
)
@ -52,7 +52,7 @@ func (s *Store) GenesisState(ctx context.Context) (state.BeaconState, error) {
cached, err := genesis.State(params.BeaconConfig().ConfigName)
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return nil, err
}
span.AddAttributes(trace.BoolAttribute("cache_hit", cached != nil))

View File

@ -36,8 +36,10 @@ go_library(
"//beacon-chain/sync:go_default_library",
"//beacon-chain/sync/initial-sync:go_default_library",
"//cmd/beacon-chain/flags:go_default_library",
"//monitoring/backup:go_default_library",
"//monitoring/prometheus:go_default_library",
"//monitoring/tracing:go_default_library",
"//shared:go_default_library",
"//shared/backuputil:go_default_library",
"//shared/cmd:go_default_library",
"//shared/debug:go_default_library",
"//shared/event:go_default_library",
@ -45,9 +47,7 @@ go_library(
"//shared/gateway:go_default_library",
"//shared/params:go_default_library",
"//shared/prereq:go_default_library",
"//shared/prometheus:go_default_library",
"//shared/sliceutil:go_default_library",
"//shared/tracing:go_default_library",
"//shared/version:go_default_library",
"@com_github_ethereum_go_ethereum//common:go_default_library",
"@com_github_pkg_errors//:go_default_library",

View File

@ -3,14 +3,14 @@ package node
import (
types "github.com/prysmaticlabs/eth2-types"
"github.com/prysmaticlabs/prysm/cmd/beacon-chain/flags"
tracing2 "github.com/prysmaticlabs/prysm/monitoring/tracing"
"github.com/prysmaticlabs/prysm/shared/cmd"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/tracing"
"github.com/urfave/cli/v2"
)
func configureTracing(cliCtx *cli.Context) error {
return tracing.Setup(
return tracing2.Setup(
"beacon-chain", // service name
cliCtx.String(cmd.TracingProcessNameFlag.Name),
cliCtx.String(cmd.TracingEndpointFlag.Name),

View File

@ -38,8 +38,9 @@ import (
regularsync "github.com/prysmaticlabs/prysm/beacon-chain/sync"
initialsync "github.com/prysmaticlabs/prysm/beacon-chain/sync/initial-sync"
"github.com/prysmaticlabs/prysm/cmd/beacon-chain/flags"
"github.com/prysmaticlabs/prysm/monitoring/backup"
"github.com/prysmaticlabs/prysm/monitoring/prometheus"
"github.com/prysmaticlabs/prysm/shared"
"github.com/prysmaticlabs/prysm/shared/backuputil"
"github.com/prysmaticlabs/prysm/shared/cmd"
"github.com/prysmaticlabs/prysm/shared/debug"
"github.com/prysmaticlabs/prysm/shared/event"
@ -47,7 +48,6 @@ import (
"github.com/prysmaticlabs/prysm/shared/gateway"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/prereq"
"github.com/prysmaticlabs/prysm/shared/prometheus"
"github.com/prysmaticlabs/prysm/shared/sliceutil"
"github.com/prysmaticlabs/prysm/shared/version"
"github.com/sirupsen/logrus"
@ -631,7 +631,7 @@ func (b *BeaconNode) registerPrometheusService(cliCtx *cli.Context) error {
additionalHandlers,
prometheus.Handler{
Path: "/db/backup",
Handler: backuputil.BackupHandler(b.db, cliCtx.String(cmd.BackupWebhookOutputDir.Name)),
Handler: backup.BackupHandler(b.db, cliCtx.String(cmd.BackupWebhookOutputDir.Name)),
},
)
}

View File

@ -53,6 +53,7 @@ go_library(
"//beacon-chain/p2p/peers/scorers:go_default_library",
"//beacon-chain/p2p/types:go_default_library",
"//cmd/beacon-chain/flags:go_default_library",
"//monitoring/tracing:go_default_library",
"//proto/prysm/v1alpha1:go_default_library",
"//proto/prysm/v1alpha1/metadata:go_default_library",
"//proto/prysm/v1alpha1/wrapper:go_default_library",
@ -67,7 +68,6 @@ go_library(
"//shared/runutil:go_default_library",
"//shared/slotutil:go_default_library",
"//shared/timeutils:go_default_library",
"//shared/traceutil:go_default_library",
"//shared/version:go_default_library",
"@com_github_ethereum_go_ethereum//crypto:go_default_library",
"@com_github_ethereum_go_ethereum//p2p/discover:go_default_library",

View File

@ -11,11 +11,11 @@ import (
"github.com/pkg/errors"
"github.com/prysmaticlabs/prysm/beacon-chain/core"
"github.com/prysmaticlabs/prysm/beacon-chain/core/altair"
"github.com/prysmaticlabs/prysm/monitoring/tracing"
eth "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/shared/hashutil"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/traceutil"
"go.opencensus.io/trace"
"google.golang.org/protobuf/proto"
)
@ -37,13 +37,13 @@ func (s *Service) Broadcast(ctx context.Context, msg proto.Message) error {
forkDigest, err := s.currentForkDigest()
if err != nil {
err := errors.Wrap(err, "could not retrieve fork digest")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return err
}
topic, ok := GossipTypeMapping[reflect.TypeOf(msg)]
if !ok {
traceutil.AnnotateError(span, ErrMessageNotMapped)
tracing.AnnotateError(span, ErrMessageNotMapped)
return ErrMessageNotMapped
}
castMsg, ok := msg.(ssz.Marshaler)
@ -61,7 +61,7 @@ func (s *Service) BroadcastAttestation(ctx context.Context, subnet uint64, att *
forkDigest, err := s.currentForkDigest()
if err != nil {
err := errors.Wrap(err, "could not retrieve fork digest")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return err
}
@ -79,7 +79,7 @@ func (s *Service) BroadcastSyncCommitteeMessage(ctx context.Context, subnet uint
forkDigest, err := s.currentForkDigest()
if err != nil {
err := errors.Wrap(err, "could not retrieve fork digest")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return err
}
@ -125,7 +125,7 @@ func (s *Service) broadcastAttestation(ctx context.Context, subnet uint64, att *
return errors.New("failed to find peers for subnet")
}(); err != nil {
log.WithError(err).Error("Failed to find peers")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
}
}
// In the event our attestation is outdated and beyond the
@ -138,7 +138,7 @@ func (s *Service) broadcastAttestation(ctx context.Context, subnet uint64, att *
if err := s.broadcastObject(ctx, att, attestationToTopic(subnet, forkDigest)); err != nil {
log.WithError(err).Error("Failed to broadcast attestation")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
}
}
@ -181,7 +181,7 @@ func (s *Service) broadcastSyncCommittee(ctx context.Context, subnet uint64, sMs
return errors.New("failed to find peers for subnet")
}(); err != nil {
log.WithError(err).Error("Failed to find peers")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
}
}
// In the event our sync message is outdated and beyond the
@ -193,7 +193,7 @@ func (s *Service) broadcastSyncCommittee(ctx context.Context, subnet uint64, sMs
if err := s.broadcastObject(ctx, sMsg, syncCommitteeToTopic(subnet, forkDigest)); err != nil {
log.WithError(err).Error("Failed to broadcast sync committee message")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
}
}
@ -207,7 +207,7 @@ func (s *Service) broadcastObject(ctx context.Context, obj ssz.Marshaler, topic
buf := new(bytes.Buffer)
if _, err := s.Encoding().EncodeGossip(buf, obj); err != nil {
err := errors.Wrap(err, "could not encode message")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return err
}
@ -218,7 +218,7 @@ func (s *Service) broadcastObject(ctx context.Context, obj ssz.Marshaler, topic
}
if err := s.PublishToTopic(ctx, topic+s.Encoding().ProtocolSuffix(), buf.Bytes()); err != nil {
err := errors.Wrap(err, "could not publish message")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return err
}
return nil

View File

@ -9,7 +9,7 @@ import (
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/protocol"
"github.com/pkg/errors"
"github.com/prysmaticlabs/prysm/shared/traceutil"
"github.com/prysmaticlabs/prysm/monitoring/tracing"
"github.com/sirupsen/logrus"
"go.opencensus.io/trace"
)
@ -38,7 +38,7 @@ func (s *Service) Send(ctx context.Context, message interface{}, baseTopic strin
stream, err := s.host.NewStream(ctx, pid, protocol.ID(topic))
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return nil, err
}
// do not encode anything if we are sending a metadata request
@ -48,7 +48,7 @@ func (s *Service) Send(ctx context.Context, message interface{}, baseTopic strin
return nil, errors.Errorf("%T does not support the ssz marshaller interface", message)
}
if _, err := s.Encoding().EncodeWithMaxLength(stream, castedMsg); err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
_err := stream.Reset()
_ = _err
return nil, err
@ -57,7 +57,7 @@ func (s *Service) Send(ctx context.Context, message interface{}, baseTopic strin
// Close stream for writing.
if err := stream.CloseWrite(); err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
_err := stream.Reset()
_ = _err
return nil, err

View File

@ -31,16 +31,16 @@ go_library(
"//beacon-chain/state/stategen:go_default_library",
"//beacon-chain/state/v1:go_default_library",
"//contracts/deposit-contract:go_default_library",
"//monitoring/clientstats:go_default_library",
"//monitoring/tracing:go_default_library",
"//proto/prysm/v1alpha1:go_default_library",
"//shared/bytesutil:go_default_library",
"//shared/clientstats:go_default_library",
"//shared/hashutil:go_default_library",
"//shared/httputils:go_default_library",
"//shared/httputils/authorizationmethod:go_default_library",
"//shared/logutil:go_default_library",
"//shared/params:go_default_library",
"//shared/timeutils:go_default_library",
"//shared/traceutil:go_default_library",
"//shared/trieutil:go_default_library",
"@com_github_ethereum_go_ethereum//:go_default_library",
"@com_github_ethereum_go_ethereum//accounts/abi/bind:go_default_library",
@ -83,10 +83,10 @@ go_test(
"//beacon-chain/powchain/testing:go_default_library",
"//beacon-chain/powchain/types:go_default_library",
"//contracts/deposit-contract:go_default_library",
"//monitoring/clientstats:go_default_library",
"//proto/prysm/v1alpha1:go_default_library",
"//shared/bls:go_default_library",
"//shared/bytesutil:go_default_library",
"//shared/clientstats:go_default_library",
"//shared/event:go_default_library",
"//shared/httputils:go_default_library",
"//shared/httputils/authorizationmethod:go_default_library",

View File

@ -8,8 +8,8 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/pkg/errors"
"github.com/prysmaticlabs/prysm/beacon-chain/powchain/types"
"github.com/prysmaticlabs/prysm/monitoring/tracing"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/traceutil"
"go.opencensus.io/trace"
)
@ -76,7 +76,7 @@ func (s *Service) BlockHashByHeight(ctx context.Context, height *big.Int) (commo
if s.eth1DataFetcher == nil {
err := errors.New("nil eth1DataFetcher")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return [32]byte{}, err
}
@ -96,7 +96,7 @@ func (s *Service) BlockTimeByHeight(ctx context.Context, height *big.Int) (uint6
defer span.End()
if s.eth1DataFetcher == nil {
err := errors.New("nil eth1DataFetcher")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return 0, err
}

View File

@ -5,7 +5,7 @@ import (
"sync"
"github.com/prometheus/client_golang/prometheus"
"github.com/prysmaticlabs/prysm/shared/clientstats"
"github.com/prysmaticlabs/prysm/monitoring/clientstats"
)
type BeaconNodeStatsUpdater interface {

View File

@ -33,10 +33,10 @@ import (
"github.com/prysmaticlabs/prysm/beacon-chain/state/stategen"
v1 "github.com/prysmaticlabs/prysm/beacon-chain/state/v1"
contracts "github.com/prysmaticlabs/prysm/contracts/deposit-contract"
"github.com/prysmaticlabs/prysm/monitoring/clientstats"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
protodb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/shared/bytesutil"
"github.com/prysmaticlabs/prysm/shared/clientstats"
"github.com/prysmaticlabs/prysm/shared/httputils"
"github.com/prysmaticlabs/prysm/shared/httputils/authorizationmethod"
"github.com/prysmaticlabs/prysm/shared/logutil"

View File

@ -19,9 +19,9 @@ import (
dbutil "github.com/prysmaticlabs/prysm/beacon-chain/db/testing"
mockPOW "github.com/prysmaticlabs/prysm/beacon-chain/powchain/testing"
contracts "github.com/prysmaticlabs/prysm/contracts/deposit-contract"
"github.com/prysmaticlabs/prysm/monitoring/clientstats"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
protodb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/shared/clientstats"
"github.com/prysmaticlabs/prysm/shared/event"
"github.com/prysmaticlabs/prysm/shared/httputils"
"github.com/prysmaticlabs/prysm/shared/params"

View File

@ -34,12 +34,12 @@ go_library(
"//beacon-chain/rpc/statefetcher:go_default_library",
"//beacon-chain/state/stategen:go_default_library",
"//beacon-chain/sync:go_default_library",
"//monitoring/tracing:go_default_library",
"//proto/eth/service:go_default_library",
"//proto/prysm/v1alpha1:go_default_library",
"//shared/featureconfig:go_default_library",
"//shared/logutil:go_default_library",
"//shared/params:go_default_library",
"//shared/traceutil:go_default_library",
"@com_github_grpc_ecosystem_go_grpc_middleware//:go_default_library",
"@com_github_grpc_ecosystem_go_grpc_middleware//recovery:go_default_library",
"@com_github_grpc_ecosystem_go_grpc_middleware//tracing/opentracing:go_default_library",

View File

@ -41,6 +41,7 @@ go_library(
"//beacon-chain/state:go_default_library",
"//beacon-chain/state/stategen:go_default_library",
"//beacon-chain/sync:go_default_library",
"//monitoring/tracing:go_default_library",
"//proto/eth/v1:go_default_library",
"//proto/prysm/v1alpha1:go_default_library",
"//proto/prysm/v1alpha1/block:go_default_library",
@ -59,7 +60,6 @@ go_library(
"//shared/rand:go_default_library",
"//shared/slotutil:go_default_library",
"//shared/timeutils:go_default_library",
"//shared/traceutil:go_default_library",
"//shared/trieutil:go_default_library",
"//shared/version:go_default_library",
"@com_github_ferranbt_fastssz//:go_default_library",

View File

@ -8,11 +8,11 @@ import (
"github.com/prysmaticlabs/prysm/beacon-chain/core"
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
"github.com/prysmaticlabs/prysm/beacon-chain/state"
"github.com/prysmaticlabs/prysm/monitoring/tracing"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/shared/bytesutil"
"github.com/prysmaticlabs/prysm/shared/depositutil"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/traceutil"
"go.opencensus.io/trace"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
@ -238,14 +238,14 @@ func (vs *Server) validatorStatus(
}
vStatus, idx, err := statusForPubKey(headState, pubKey)
if err != nil && err != errPubkeyDoesNotExist {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return resp, nonExistentIndex
}
resp.Status = vStatus
if err != errPubkeyDoesNotExist {
val, err := headState.ValidatorAtIndexReadOnly(idx)
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return resp, idx
}
resp.ActivationEpoch = val.ActivationEpoch()

View File

@ -38,12 +38,12 @@ import (
"github.com/prysmaticlabs/prysm/beacon-chain/rpc/statefetcher"
"github.com/prysmaticlabs/prysm/beacon-chain/state/stategen"
chainSync "github.com/prysmaticlabs/prysm/beacon-chain/sync"
"github.com/prysmaticlabs/prysm/monitoring/tracing"
ethpbservice "github.com/prysmaticlabs/prysm/proto/eth/service"
ethpbv1alpha1 "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/shared/featureconfig"
"github.com/prysmaticlabs/prysm/shared/logutil"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/traceutil"
"github.com/sirupsen/logrus"
"go.opencensus.io/plugin/ocgrpc"
"google.golang.org/grpc"
@ -136,7 +136,7 @@ func (s *Service) Start() {
grpc.StatsHandler(&ocgrpc.ServerHandler{}),
grpc.StreamInterceptor(middleware.ChainStreamServer(
recovery.StreamServerInterceptor(
recovery.WithRecoveryHandlerContext(traceutil.RecoveryHandlerFunc),
recovery.WithRecoveryHandlerContext(tracing.RecoveryHandlerFunc),
),
grpc_prometheus.StreamServerInterceptor,
grpc_opentracing.StreamServerInterceptor(),
@ -144,7 +144,7 @@ func (s *Service) Start() {
)),
grpc.UnaryInterceptor(middleware.ChainUnaryServer(
recovery.UnaryServerInterceptor(
recovery.WithRecoveryHandlerContext(traceutil.RecoveryHandlerFunc),
recovery.WithRecoveryHandlerContext(tracing.RecoveryHandlerFunc),
),
grpc_prometheus.UnaryServerInterceptor,
grpc_opentracing.UnaryServerInterceptor(),

View File

@ -74,6 +74,7 @@ go_library(
"//beacon-chain/state:go_default_library",
"//beacon-chain/state/stategen:go_default_library",
"//cmd/beacon-chain/flags:go_default_library",
"//monitoring/tracing:go_default_library",
"//proto/prysm/v1alpha1:go_default_library",
"//proto/prysm/v1alpha1/block:go_default_library",
"//proto/prysm/v1alpha1/metadata:go_default_library",
@ -94,7 +95,6 @@ go_library(
"//shared/slotutil:go_default_library",
"//shared/sszutil:go_default_library",
"//shared/timeutils:go_default_library",
"//shared/traceutil:go_default_library",
"//shared/version:go_default_library",
"@com_github_ferranbt_fastssz//:go_default_library",
"@com_github_hashicorp_golang_lru//:go_default_library",

View File

@ -12,6 +12,7 @@ import (
"github.com/prysmaticlabs/prysm/beacon-chain/core"
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
p2ptypes "github.com/prysmaticlabs/prysm/beacon-chain/p2p/types"
"github.com/prysmaticlabs/prysm/monitoring/tracing"
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block"
"github.com/prysmaticlabs/prysm/shared/bytesutil"
"github.com/prysmaticlabs/prysm/shared/params"
@ -19,7 +20,6 @@ import (
"github.com/prysmaticlabs/prysm/shared/runutil"
"github.com/prysmaticlabs/prysm/shared/slotutil"
"github.com/prysmaticlabs/prysm/shared/sszutil"
"github.com/prysmaticlabs/prysm/shared/traceutil"
"github.com/sirupsen/logrus"
"github.com/trailofbits/go-mutexasserts"
"go.opencensus.io/trace"
@ -95,7 +95,7 @@ func (s *Service) processPendingBlocks(ctx context.Context) error {
blkRoot, err := b.Block().HashTreeRoot()
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
span.End()
return err
}
@ -142,7 +142,7 @@ func (s *Service) processPendingBlocks(ctx context.Context) error {
if err := s.validateBeaconBlock(ctx, b, blkRoot); err != nil {
log.Debugf("Could not validate block from slot %d: %v", b.Block().Slot(), err)
s.setBadBlock(ctx, blkRoot)
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
// In the next iteration of the queue, this block will be removed from
// the pending queue as it has been marked as a 'bad' block.
span.End()
@ -152,7 +152,7 @@ func (s *Service) processPendingBlocks(ctx context.Context) error {
if err := s.cfg.Chain.ReceiveBlock(ctx, b, blkRoot); err != nil {
log.Debugf("Could not process block from slot %d: %v", b.Block().Slot(), err)
s.setBadBlock(ctx, blkRoot)
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
// In the next iteration of the queue, this block will be removed from
// the pending queue as it has been marked as a 'bad' block.
span.End()
@ -206,7 +206,7 @@ func (s *Service) sendBatchRootRequest(ctx context.Context, roots [][32]byte, ra
req = roots[:params.BeaconNetworkConfig().MaxRequestBlocks]
}
if err := s.sendRecentBeaconBlocksRequest(ctx, &req, pid); err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
log.Debugf("Could not send recent block request: %v", err)
}
newRoots := make([][32]byte, 0, len(roots))

View File

@ -13,9 +13,9 @@ import (
"github.com/prysmaticlabs/prysm/beacon-chain/core"
"github.com/prysmaticlabs/prysm/beacon-chain/p2p"
p2ptypes "github.com/prysmaticlabs/prysm/beacon-chain/p2p/types"
"github.com/prysmaticlabs/prysm/monitoring/tracing"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/timeutils"
"github.com/prysmaticlabs/prysm/shared/traceutil"
"go.opencensus.io/trace"
)
@ -175,7 +175,7 @@ func (s *Service) registerRPC(baseTopic string, handle rpcHandler) {
if err != p2ptypes.ErrWrongForkDigestVersion {
log.WithError(err).Debug("Could not handle p2p RPC")
}
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
}
return
}
@ -193,11 +193,11 @@ func (s *Service) registerRPC(baseTopic string, handle rpcHandler) {
// Debug logs for goodbye/status errors
if strings.Contains(topic, p2p.RPCGoodByeTopicV1) || strings.Contains(topic, p2p.RPCStatusTopicV1) {
log.WithError(err).Debug("Could not decode goodbye stream message")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return
}
log.WithError(err).Debug("Could not decode stream message")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return
}
if err := handle(ctx, msg, stream); err != nil {
@ -205,7 +205,7 @@ func (s *Service) registerRPC(baseTopic string, handle rpcHandler) {
if err != p2ptypes.ErrWrongForkDigestVersion {
log.WithError(err).Debug("Could not handle p2p RPC")
}
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
}
} else {
nTyp := reflect.New(t)
@ -216,7 +216,7 @@ func (s *Service) registerRPC(baseTopic string, handle rpcHandler) {
}
if err := s.cfg.P2P.Encoding().DecodeWithMaxLength(stream, msg); err != nil {
log.WithError(err).Debug("Could not decode stream message")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return
}
if err := handle(ctx, nTyp.Elem().Interface(), stream); err != nil {
@ -224,7 +224,7 @@ func (s *Service) registerRPC(baseTopic string, handle rpcHandler) {
if err != p2ptypes.ErrWrongForkDigestVersion {
log.WithError(err).Debug("Could not handle p2p RPC")
}
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
}
}
})

View File

@ -10,11 +10,11 @@ import (
"github.com/prysmaticlabs/prysm/beacon-chain/db/filters"
p2ptypes "github.com/prysmaticlabs/prysm/beacon-chain/p2p/types"
"github.com/prysmaticlabs/prysm/cmd/beacon-chain/flags"
"github.com/prysmaticlabs/prysm/monitoring/tracing"
pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block"
"github.com/prysmaticlabs/prysm/shared/bytesutil"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/traceutil"
"go.opencensus.io/trace"
)
@ -37,7 +37,7 @@ func (s *Service) beaconBlocksByRangeRPCHandler(ctx context.Context, msg interfa
if err := s.validateRangeRequest(m); err != nil {
s.writeErrorResponseToStream(responseCodeInvalidRequest, err.Error(), stream)
s.cfg.P2P.Peers().Scorers().BadResponsesScorer().Increment(stream.Conn().RemotePeer())
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return err
}
@ -72,14 +72,14 @@ func (s *Service) beaconBlocksByRangeRPCHandler(ctx context.Context, msg interfa
var prevRoot [32]byte
for startSlot <= endReqSlot {
if err := s.rateLimiter.validateRequest(stream, allowedBlocksPerSecond); err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return err
}
if endSlot-startSlot > rangeLimit {
s.writeErrorResponseToStream(responseCodeInvalidRequest, p2ptypes.ErrInvalidRequest.Error(), stream)
err := p2ptypes.ErrInvalidRequest
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return err
}
@ -127,7 +127,7 @@ func (s *Service) writeBlockRangeToStream(ctx context.Context, startSlot, endSlo
if err != nil {
log.WithError(err).Debug("Could not retrieve blocks")
s.writeErrorResponseToStream(responseCodeServerError, p2ptypes.ErrGeneric.Error(), stream)
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return err
}
// handle genesis case
@ -136,7 +136,7 @@ func (s *Service) writeBlockRangeToStream(ctx context.Context, startSlot, endSlo
if err != nil {
log.WithError(err).Debug("Could not retrieve genesis block")
s.writeErrorResponseToStream(responseCodeServerError, p2ptypes.ErrGeneric.Error(), stream)
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return err
}
blks = append([]block.SignedBeaconBlock{genBlock}, blks...)
@ -147,7 +147,7 @@ func (s *Service) writeBlockRangeToStream(ctx context.Context, startSlot, endSlo
blks, roots, err = s.dedupBlocksAndRoots(blks, roots)
if err != nil {
s.writeErrorResponseToStream(responseCodeServerError, p2ptypes.ErrGeneric.Error(), stream)
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return err
}
blks, roots = s.sortBlocksAndRoots(blks, roots)
@ -155,7 +155,7 @@ func (s *Service) writeBlockRangeToStream(ctx context.Context, startSlot, endSlo
blks, err = s.filterBlocks(ctx, blks, roots, prevRoot, step, startSlot)
if err != nil && err != p2ptypes.ErrInvalidParent {
s.writeErrorResponseToStream(responseCodeServerError, p2ptypes.ErrGeneric.Error(), stream)
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return err
}
for _, b := range blks {
@ -165,7 +165,7 @@ func (s *Service) writeBlockRangeToStream(ctx context.Context, startSlot, endSlo
if chunkErr := s.chunkBlockWriter(stream, b); chunkErr != nil {
log.WithError(chunkErr).Debug("Could not send a chunked response")
s.writeErrorResponseToStream(responseCodeServerError, p2ptypes.ErrGeneric.Error(), stream)
traceutil.AnnotateError(span, chunkErr)
tracing.AnnotateError(span, chunkErr)
return chunkErr
}

View File

@ -15,6 +15,7 @@ import (
"github.com/prysmaticlabs/prysm/beacon-chain/core"
"github.com/prysmaticlabs/prysm/beacon-chain/p2p"
"github.com/prysmaticlabs/prysm/cmd/beacon-chain/flags"
"github.com/prysmaticlabs/prysm/monitoring/tracing"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/shared/messagehandler"
@ -22,7 +23,6 @@ import (
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/sliceutil"
"github.com/prysmaticlabs/prysm/shared/slotutil"
"github.com/prysmaticlabs/prysm/shared/traceutil"
"go.opencensus.io/trace"
"google.golang.org/protobuf/proto"
)
@ -169,7 +169,7 @@ func (s *Service) subscribeWithBase(topic string, validator pubsub.ValidatorEx,
defer func() {
if r := recover(); r != nil {
traceutil.AnnotateError(span, fmt.Errorf("panic occurred: %v", r))
tracing.AnnotateError(span, fmt.Errorf("panic occurred: %v", r))
log.WithField("error", r).Error("Panic occurred")
debug.PrintStack()
}
@ -184,7 +184,7 @@ func (s *Service) subscribeWithBase(topic string, validator pubsub.ValidatorEx,
}
if err := handle(ctx, msg.ValidatorData.(proto.Message)); err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
log.WithError(err).Debug("Could not handle p2p pubsub")
messageFailedProcessingCounter.WithLabelValues(topic).Inc()
return

View File

@ -15,11 +15,11 @@ import (
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
"github.com/prysmaticlabs/prysm/beacon-chain/core/transition"
"github.com/prysmaticlabs/prysm/beacon-chain/state"
"github.com/prysmaticlabs/prysm/monitoring/tracing"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/shared/bls"
"github.com/prysmaticlabs/prysm/shared/bytesutil"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/traceutil"
"go.opencensus.io/trace"
)
@ -42,7 +42,7 @@ func (s *Service) validateAggregateAndProof(ctx context.Context, pid peer.ID, ms
raw, err := s.decodePubsubMessage(msg)
if err != nil {
log.WithError(err).Debug("Could not decode message")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationReject
}
m, ok := raw.(*ethpb.SignedAggregateAttestationAndProof)
@ -73,7 +73,7 @@ func (s *Service) validateAggregateAndProof(ctx context.Context, pid peer.ID, ms
// processing tolerance.
if err := helpers.ValidateAttestationTime(m.Message.Aggregate.Data.Slot, s.cfg.Chain.GenesisTime(),
earlyAttestationProcessingTolerance); err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationIgnore
}
@ -91,7 +91,7 @@ func (s *Service) validateAggregateAndProof(ctx context.Context, pid peer.ID, ms
// Verify aggregate attestation has not already been seen via aggregate gossip, within a block, or through the creation locally.
seen, err := s.cfg.AttPool.HasAggregatedAttestation(m.Message.Aggregate)
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationIgnore
}
if seen {
@ -122,19 +122,19 @@ func (s *Service) validateAggregatedAtt(ctx context.Context, signed *ethpb.Signe
// to weird edge cases during verification. The attestation technically could be used to add value to a block,
// but it's invalid in the spirit of the protocol. Here we choose safety over profit.
if err := s.cfg.Chain.VerifyLmdFfgConsistency(ctx, signed.Message.Aggregate); err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationReject
}
// Verify current finalized checkpoint is an ancestor of the block defined by the attestation's beacon block root.
if err := s.cfg.Chain.VerifyFinalizedConsistency(ctx, signed.Message.Aggregate.Data.BeaconBlockRoot); err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationReject
}
bs, err := s.cfg.Chain.AttestationPreState(ctx, signed.Message.Aggregate)
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationIgnore
}
@ -147,21 +147,21 @@ func (s *Service) validateAggregatedAtt(ctx context.Context, signed *ethpb.Signe
}
bs, err = transition.ProcessSlots(ctx, bs, startSlot)
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationIgnore
}
}
// Verify validator index is within the beacon committee.
if err := validateIndexInCommittee(ctx, bs, signed.Message.Aggregate, signed.Message.AggregatorIndex); err != nil {
traceutil.AnnotateError(span, errors.Wrapf(err, "Could not validate index in committee"))
tracing.AnnotateError(span, errors.Wrapf(err, "Could not validate index in committee"))
return pubsub.ValidationReject
}
// Verify selection proof reflects to the right validator.
selectionSigSet, err := validateSelectionIndex(ctx, bs, signed.Message.Aggregate.Data, signed.Message.AggregatorIndex, signed.Message.SelectionProof)
if err != nil {
traceutil.AnnotateError(span, errors.Wrapf(err, "Could not validate selection for validator %d", signed.Message.AggregatorIndex))
tracing.AnnotateError(span, errors.Wrapf(err, "Could not validate selection for validator %d", signed.Message.AggregatorIndex))
return pubsub.ValidationReject
}
@ -169,23 +169,23 @@ func (s *Service) validateAggregatedAtt(ctx context.Context, signed *ethpb.Signe
// We use batch verify here to save compute.
aggregatorSigSet, err := aggSigSet(bs, signed)
if err != nil {
traceutil.AnnotateError(span, errors.Wrapf(err, "Could not get aggregator sig set %d", signed.Message.AggregatorIndex))
tracing.AnnotateError(span, errors.Wrapf(err, "Could not get aggregator sig set %d", signed.Message.AggregatorIndex))
return pubsub.ValidationIgnore
}
attSigSet, err := blocks.AttestationSignatureSet(ctx, bs, []*ethpb.Attestation{signed.Message.Aggregate})
if err != nil {
traceutil.AnnotateError(span, errors.Wrapf(err, "Could not verify aggregator signature %d", signed.Message.AggregatorIndex))
tracing.AnnotateError(span, errors.Wrapf(err, "Could not verify aggregator signature %d", signed.Message.AggregatorIndex))
return pubsub.ValidationIgnore
}
set := bls.NewSet()
set.Join(selectionSigSet).Join(aggregatorSigSet).Join(attSigSet)
valid, err := set.Verify()
if err != nil {
traceutil.AnnotateError(span, errors.Errorf("Could not join signature set"))
tracing.AnnotateError(span, errors.Errorf("Could not join signature set"))
return pubsub.ValidationIgnore
}
if !valid {
traceutil.AnnotateError(span, errors.Errorf("Could not verify selection or aggregator or attestation signature"))
tracing.AnnotateError(span, errors.Errorf("Could not verify selection or aggregator or attestation signature"))
return pubsub.ValidationReject
}

View File

@ -6,9 +6,9 @@ import (
"github.com/libp2p/go-libp2p-core/peer"
pubsub "github.com/libp2p/go-libp2p-pubsub"
"github.com/prysmaticlabs/prysm/beacon-chain/core/blocks"
"github.com/prysmaticlabs/prysm/monitoring/tracing"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/shared/sliceutil"
"github.com/prysmaticlabs/prysm/shared/traceutil"
"go.opencensus.io/trace"
)
@ -32,7 +32,7 @@ func (s *Service) validateAttesterSlashing(ctx context.Context, pid peer.ID, msg
m, err := s.decodePubsubMessage(msg)
if err != nil {
log.WithError(err).Debug("Could not decode message")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationReject
}
slashing, ok := m.(*ethpb.AttesterSlashing)

View File

@ -16,9 +16,9 @@ import (
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
"github.com/prysmaticlabs/prysm/beacon-chain/p2p"
"github.com/prysmaticlabs/prysm/beacon-chain/state"
"github.com/prysmaticlabs/prysm/monitoring/tracing"
eth "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/shared/bytesutil"
"github.com/prysmaticlabs/prysm/shared/traceutil"
"go.opencensus.io/trace"
)
@ -47,7 +47,7 @@ func (s *Service) validateCommitteeIndexBeaconAttestation(ctx context.Context, p
m, err := s.decodePubsubMessage(msg)
if err != nil {
log.WithError(err).Debug("Could not decode message")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationReject
}
@ -73,7 +73,7 @@ func (s *Service) validateCommitteeIndexBeaconAttestation(ctx context.Context, p
// processing tolerance.
if err := helpers.ValidateAttestationTime(att.Data.Slot, s.cfg.Chain.GenesisTime(),
earlyAttestationProcessingTolerance); err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationIgnore
}
if err := helpers.ValidateSlotTargetEpoch(att.Data); err != nil {
@ -101,18 +101,18 @@ func (s *Service) validateCommitteeIndexBeaconAttestation(ctx context.Context, p
}
if err := s.cfg.Chain.VerifyFinalizedConsistency(ctx, att.Data.BeaconBlockRoot); err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationReject
}
if err := s.cfg.Chain.VerifyLmdFfgConsistency(ctx, att); err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationReject
}
preState, err := s.cfg.Chain.AttestationPreState(ctx, att)
if err != nil {
log.WithError(err).Error("Could not to retrieve pre state")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationIgnore
}
@ -141,7 +141,7 @@ func (s *Service) validateUnaggregatedAttTopic(ctx context.Context, a *eth.Attes
valCount, err := helpers.ActiveValidatorCount(bs, core.SlotToEpoch(a.Data.Slot))
if err != nil {
log.WithError(err).Error("Could not retrieve active validator count")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationIgnore
}
count := helpers.SlotCommitteeCount(valCount)
@ -153,7 +153,7 @@ func (s *Service) validateUnaggregatedAttTopic(ctx context.Context, a *eth.Attes
digest, err := s.currentForkDigest()
if err != nil {
log.WithError(err).Error("Could not compute fork digest")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationIgnore
}
if !strings.HasPrefix(t, fmt.Sprintf(format, digest, subnet)) {
@ -171,7 +171,7 @@ func (s *Service) validateUnaggregatedAttWithState(ctx context.Context, a *eth.A
committee, err := helpers.BeaconCommitteeFromState(bs, a.Data.Slot, a.Data.CommitteeIndex)
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationIgnore
}
@ -189,7 +189,7 @@ func (s *Service) validateUnaggregatedAttWithState(ctx context.Context, a *eth.A
if err := blocks.VerifyAttestationSignature(ctx, bs, a); err != nil {
log.WithError(err).Debug("Could not verify attestation")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationReject
}

View File

@ -15,11 +15,11 @@ import (
blockfeed "github.com/prysmaticlabs/prysm/beacon-chain/core/feed/block"
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
"github.com/prysmaticlabs/prysm/beacon-chain/core/transition"
"github.com/prysmaticlabs/prysm/monitoring/tracing"
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block"
"github.com/prysmaticlabs/prysm/shared/bytesutil"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/timeutils"
"github.com/prysmaticlabs/prysm/shared/traceutil"
"github.com/sirupsen/logrus"
"go.opencensus.io/trace"
)
@ -46,7 +46,7 @@ func (s *Service) validateBeaconBlockPubSub(ctx context.Context, pid peer.ID, ms
m, err := s.decodePubsubMessage(msg)
if err != nil {
log.WithError(err).Debug("Could not decode message")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationReject
}

View File

@ -7,8 +7,8 @@ import (
pubsub "github.com/libp2p/go-libp2p-pubsub"
types "github.com/prysmaticlabs/eth2-types"
"github.com/prysmaticlabs/prysm/beacon-chain/core/blocks"
"github.com/prysmaticlabs/prysm/monitoring/tracing"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/shared/traceutil"
"go.opencensus.io/trace"
)
@ -32,7 +32,7 @@ func (s *Service) validateProposerSlashing(ctx context.Context, pid peer.ID, msg
m, err := s.decodePubsubMessage(msg)
if err != nil {
log.WithError(err).Debug("Could not decode message")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationReject
}

View File

@ -13,11 +13,11 @@ import (
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
"github.com/prysmaticlabs/prysm/beacon-chain/p2p"
p2ptypes "github.com/prysmaticlabs/prysm/beacon-chain/p2p/types"
"github.com/prysmaticlabs/prysm/monitoring/tracing"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/shared/bls"
"github.com/prysmaticlabs/prysm/shared/bytesutil"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/traceutil"
"go.opencensus.io/trace"
)
@ -63,7 +63,7 @@ func (s *Service) validateSyncCommitteeMessage(
m, err := s.readSyncCommitteeMessage(msg)
if err != nil {
log.WithError(err).Debug("Could not decode message")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationReject
}
@ -74,13 +74,13 @@ func (s *Service) validateSyncCommitteeMessage(
s.cfg.Chain.GenesisTime(),
params.BeaconNetworkConfig().MaximumGossipClockDisparity,
); err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationIgnore
}
committeeIndices, err := s.cfg.Chain.HeadCurrentSyncCommitteeIndices(ctx, m.ValidatorIndex, m.Slot)
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationIgnore
}
@ -159,7 +159,7 @@ func (s *Service) rejectIncorrectSyncCommittee(
isValid := false
digest, err := s.currentForkDigest()
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationIgnore
}
@ -213,13 +213,13 @@ func (s *Service) rejectInvalidSyncCommitteeSignature(m *ethpb.SyncCommitteeMess
// since the failure is locally derived.
d, err := s.cfg.Chain.HeadSyncCommitteeDomain(ctx, m.Slot)
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationIgnore
}
rawBytes := p2ptypes.SSZBytes(m.BlockRoot)
sigRoot, err := helpers.ComputeSigningRoot(&rawBytes, d)
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationIgnore
}
@ -227,21 +227,21 @@ func (s *Service) rejectInvalidSyncCommitteeSignature(m *ethpb.SyncCommitteeMess
// that is on such a different fork than our chain.
pubKey, err := s.cfg.Chain.HeadValidatorIndexToPublicKey(ctx, m.ValidatorIndex)
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationReject
}
// We reject a malformed signature from bytes according to the p2p specification.
blsSig, err := bls.SignatureFromBytes(m.Signature)
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationReject
}
// Ignore a malformed public key from bytes according to the p2p specification.
pKey, err := bls.PublicKeyFromBytes(pubKey[:])
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationIgnore
}

View File

@ -9,11 +9,11 @@ import (
"github.com/prysmaticlabs/prysm/beacon-chain/core/altair"
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
p2ptypes "github.com/prysmaticlabs/prysm/beacon-chain/p2p/types"
"github.com/prysmaticlabs/prysm/monitoring/tracing"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/shared/bls"
"github.com/prysmaticlabs/prysm/shared/bytesutil"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/traceutil"
"go.opencensus.io/trace"
)
@ -51,13 +51,13 @@ func (s *Service) validateSyncContributionAndProof(ctx context.Context, pid peer
m, err := s.readSyncContributionMessage(msg)
if err != nil {
log.WithError(err).Debug("Could not decode message")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationReject
}
// The contribution's slot is for the current slot (with a `MAXIMUM_GOSSIP_CLOCK_DISPARITY` allowance).
if err := altair.ValidateSyncMessageTime(m.Message.Contribution.Slot, s.cfg.Chain.GenesisTime(), params.BeaconNetworkConfig().MaximumGossipClockDisparity); err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationIgnore
}
// Validate the message's data according to the p2p specification.
@ -152,11 +152,11 @@ func (s *Service) rejectInvalidIndexInSubCommittee(m *ethpb.SignedContributionAn
// The aggregator's validator index is in the declared subcommittee of the current sync committee.
committeeIndices, err := s.cfg.Chain.HeadCurrentSyncCommitteeIndices(ctx, m.Message.AggregatorIndex, m.Message.Contribution.Slot)
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationIgnore
}
if len(committeeIndices) == 0 {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationIgnore
}
isValid := false
@ -180,7 +180,7 @@ func (s *Service) rejectInvalidSelectionProof(m *ethpb.SignedContributionAndProo
defer span.End()
// The `contribution_and_proof.selection_proof` is a valid signature of the `SyncAggregatorSelectionData`.
if err := s.verifySyncSelectionData(ctx, m.Message); err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationReject
}
return pubsub.ValidationAccept
@ -194,7 +194,7 @@ func (s *Service) rejectInvalidContributionSignature(m *ethpb.SignedContribution
// The aggregator signature, `signed_contribution_and_proof.signature`, is valid.
d, err := s.cfg.Chain.HeadSyncContributionProofDomain(ctx, m.Message.Contribution.Slot)
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationIgnore
}
pubkey, err := s.cfg.Chain.HeadValidatorIndexToPublicKey(ctx, m.Message.AggregatorIndex)
@ -202,7 +202,7 @@ func (s *Service) rejectInvalidContributionSignature(m *ethpb.SignedContribution
return pubsub.ValidationIgnore
}
if err := helpers.VerifySigningRoot(m.Message, pubkey[:], m.Signature, d); err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationReject
}
return pubsub.ValidationAccept
@ -230,7 +230,7 @@ func (s *Service) rejectInvalidSyncAggregateSignature(m *ethpb.SignedContributio
if bVector.BitAt(uint64(i)) {
pubK, err := bls.PublicKeyFromBytes(pk)
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationIgnore
}
activePubkeys = append(activePubkeys, pubK)
@ -238,18 +238,18 @@ func (s *Service) rejectInvalidSyncAggregateSignature(m *ethpb.SignedContributio
}
sig, err := bls.SignatureFromBytes(m.Message.Contribution.Signature)
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationReject
}
d, err := s.cfg.Chain.HeadSyncCommitteeDomain(ctx, m.Message.Contribution.Slot)
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationIgnore
}
rawBytes := p2ptypes.SSZBytes(m.Message.Contribution.BlockRoot)
sigRoot, err := helpers.ComputeSigningRoot(&rawBytes, d)
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationIgnore
}
verified := sig.Eth2FastAggregateVerify(activePubkeys, sigRoot)

View File

@ -7,8 +7,8 @@ import (
pubsub "github.com/libp2p/go-libp2p-pubsub"
types "github.com/prysmaticlabs/eth2-types"
"github.com/prysmaticlabs/prysm/beacon-chain/core/blocks"
"github.com/prysmaticlabs/prysm/monitoring/tracing"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/shared/traceutil"
"go.opencensus.io/trace"
)
@ -32,7 +32,7 @@ func (s *Service) validateVoluntaryExit(ctx context.Context, pid peer.ID, msg *p
m, err := s.decodePubsubMessage(msg)
if err != nil {
log.WithError(err).Debug("Could not decode message")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return pubsub.ValidationReject
}

View File

@ -18,11 +18,11 @@ go_library(
"//beacon-chain/node:go_default_library",
"//cmd/beacon-chain/db:go_default_library",
"//cmd/beacon-chain/flags:go_default_library",
"//monitoring/journald:go_default_library",
"//shared/cmd:go_default_library",
"//shared/debug:go_default_library",
"//shared/featureconfig:go_default_library",
"//shared/fileutil:go_default_library",
"//shared/journald:go_default_library",
"//shared/logutil:go_default_library",
"//shared/maxprocs:go_default_library",
"//shared/tos:go_default_library",

View File

@ -14,11 +14,11 @@ import (
"github.com/prysmaticlabs/prysm/beacon-chain/node"
dbcommands "github.com/prysmaticlabs/prysm/cmd/beacon-chain/db"
"github.com/prysmaticlabs/prysm/cmd/beacon-chain/flags"
"github.com/prysmaticlabs/prysm/monitoring/journald"
"github.com/prysmaticlabs/prysm/shared/cmd"
"github.com/prysmaticlabs/prysm/shared/debug"
"github.com/prysmaticlabs/prysm/shared/featureconfig"
"github.com/prysmaticlabs/prysm/shared/fileutil"
"github.com/prysmaticlabs/prysm/shared/journald"
"github.com/prysmaticlabs/prysm/shared/logutil"
_ "github.com/prysmaticlabs/prysm/shared/maxprocs"
"github.com/prysmaticlabs/prysm/shared/tos"

View File

@ -12,9 +12,9 @@ go_library(
visibility = ["//visibility:private"],
deps = [
"//cmd/client-stats/flags:go_default_library",
"//shared/clientstats:go_default_library",
"//monitoring/clientstats:go_default_library",
"//monitoring/journald:go_default_library",
"//shared/cmd:go_default_library",
"//shared/journald:go_default_library",
"//shared/logutil:go_default_library",
"//shared/version:go_default_library",
"@com_github_joonix_log//:go_default_library",

View File

@ -8,9 +8,9 @@ import (
joonix "github.com/joonix/log"
"github.com/prysmaticlabs/prysm/cmd/client-stats/flags"
"github.com/prysmaticlabs/prysm/shared/clientstats"
"github.com/prysmaticlabs/prysm/monitoring/clientstats"
"github.com/prysmaticlabs/prysm/monitoring/journald"
"github.com/prysmaticlabs/prysm/shared/cmd"
"github.com/prysmaticlabs/prysm/shared/journald"
"github.com/prysmaticlabs/prysm/shared/logutil"
"github.com/prysmaticlabs/prysm/shared/version"
"github.com/sirupsen/logrus"

View File

@ -15,10 +15,10 @@ go_library(
visibility = ["//slasher:__subpackages__"],
deps = [
"//cmd/slasher/flags:go_default_library",
"//monitoring/journald:go_default_library",
"//shared/cmd:go_default_library",
"//shared/debug:go_default_library",
"//shared/featureconfig:go_default_library",
"//shared/journald:go_default_library",
"//shared/logutil:go_default_library",
"//shared/tos:go_default_library",
"//shared/version:go_default_library",

View File

@ -10,10 +10,10 @@ import (
joonix "github.com/joonix/log"
"github.com/prysmaticlabs/prysm/cmd/slasher/flags"
"github.com/prysmaticlabs/prysm/monitoring/journald"
"github.com/prysmaticlabs/prysm/shared/cmd"
"github.com/prysmaticlabs/prysm/shared/debug"
"github.com/prysmaticlabs/prysm/shared/featureconfig"
"github.com/prysmaticlabs/prysm/shared/journald"
"github.com/prysmaticlabs/prysm/shared/logutil"
"github.com/prysmaticlabs/prysm/shared/tos"
"github.com/prysmaticlabs/prysm/shared/version"

View File

@ -20,11 +20,11 @@ go_library(
"//cmd/validator/flags:go_default_library",
"//cmd/validator/slashing-protection:go_default_library",
"//cmd/validator/wallet:go_default_library",
"//monitoring/journald:go_default_library",
"//shared/cmd:go_default_library",
"//shared/debug:go_default_library",
"//shared/featureconfig:go_default_library",
"//shared/fileutil:go_default_library",
"//shared/journald:go_default_library",
"//shared/logutil:go_default_library",
"//shared/maxprocs:go_default_library",
"//shared/tos:go_default_library",

View File

@ -16,11 +16,11 @@ import (
"github.com/prysmaticlabs/prysm/cmd/validator/flags"
slashingprotectioncommands "github.com/prysmaticlabs/prysm/cmd/validator/slashing-protection"
walletcommands "github.com/prysmaticlabs/prysm/cmd/validator/wallet"
"github.com/prysmaticlabs/prysm/monitoring/journald"
"github.com/prysmaticlabs/prysm/shared/cmd"
"github.com/prysmaticlabs/prysm/shared/debug"
"github.com/prysmaticlabs/prysm/shared/featureconfig"
"github.com/prysmaticlabs/prysm/shared/fileutil"
"github.com/prysmaticlabs/prysm/shared/journald"
"github.com/prysmaticlabs/prysm/shared/logutil"
_ "github.com/prysmaticlabs/prysm/shared/maxprocs"
"github.com/prysmaticlabs/prysm/shared/tos"

View File

@ -3,7 +3,7 @@ load("@prysm//tools/go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["http_backup_handler.go"],
importpath = "github.com/prysmaticlabs/prysm/shared/backuputil",
importpath = "github.com/prysmaticlabs/prysm/monitoring/backup",
visibility = ["//visibility:public"],
deps = ["@com_github_sirupsen_logrus//:go_default_library"],
)

View File

@ -1,4 +1,4 @@
package backuputil
package backup
import (
"context"

View File

@ -8,7 +8,7 @@ go_library(
"types.go",
"updaters.go",
],
importpath = "github.com/prysmaticlabs/prysm/shared/clientstats",
importpath = "github.com/prysmaticlabs/prysm/monitoring/clientstats",
visibility = ["//visibility:public"],
deps = [
"//proto/prysm/v1alpha1:go_default_library",

View File

@ -6,7 +6,7 @@ go_library(
"journald.go",
"journald_linux.go",
],
importpath = "github.com/prysmaticlabs/prysm/shared/journald",
importpath = "github.com/prysmaticlabs/prysm/monitoring/journald",
visibility = ["//visibility:public"],
deps = select({
"@io_bazel_rules_go//go/platform:android": [

View File

@ -3,7 +3,7 @@ load("@prysm//tools/go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["progress.go"],
importpath = "github.com/prysmaticlabs/prysm/shared/progressutil",
importpath = "github.com/prysmaticlabs/prysm/monitoring/progress",
visibility = ["//visibility:public"],
deps = [
"@com_github_k0kubun_go_ansi//:go_default_library",

View File

@ -1,4 +1,4 @@
package progressutil
package progress
import (
"fmt"

View File

@ -8,7 +8,7 @@ go_library(
"service.go",
"simple_server.go",
],
importpath = "github.com/prysmaticlabs/prysm/shared/prometheus",
importpath = "github.com/prysmaticlabs/prysm/monitoring/prometheus",
visibility = ["//visibility:public"],
deps = [
"//shared:go_default_library",

View File

@ -9,7 +9,7 @@ import (
"testing"
"time"
"github.com/prysmaticlabs/prysm/shared/prometheus"
"github.com/prysmaticlabs/prysm/monitoring/prometheus"
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
"github.com/prysmaticlabs/prysm/shared/testutil/require"
log "github.com/sirupsen/logrus"

View File

@ -2,8 +2,12 @@ load("@prysm//tools/go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["tracer.go"],
importpath = "github.com/prysmaticlabs/prysm/shared/tracing",
srcs = [
"errors.go",
"recovery_interceptor_option.go",
"tracer.go",
],
importpath = "github.com/prysmaticlabs/prysm/monitoring/tracing",
visibility = ["//visibility:public"],
deps = [
"//shared/version:go_default_library",

View File

@ -1,5 +1,5 @@
// Package traceutil includes useful functions for opentracing annotations.
package traceutil
// Package tracing includes useful functions for opentracing annotations.
package tracing
import (
"go.opencensus.io/trace"

View File

@ -1,4 +1,4 @@
package traceutil
package tracing
import (
"context"

View File

@ -1,15 +0,0 @@
load("@prysm//tools/go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"errors.go",
"recovery_interceptor_option.go",
],
importpath = "github.com/prysmaticlabs/prysm/shared/traceutil",
visibility = ["//visibility:public"],
deps = [
"@com_github_sirupsen_logrus//:go_default_library",
"@io_opencensus_go//trace:go_default_library",
],
)

View File

@ -6,8 +6,8 @@ go_library(
importpath = "github.com/prysmaticlabs/prysm/slasher/db/iface",
visibility = ["//slasher/db:__subpackages__"],
deps = [
"//monitoring/backup:go_default_library",
"//proto/prysm/v1alpha1:go_default_library",
"//shared/backuputil:go_default_library",
"//slasher/db/types:go_default_library",
"//slasher/detection/attestations/types:go_default_library",
"@com_github_prysmaticlabs_eth2_types//:go_default_library",

View File

@ -8,9 +8,9 @@ import (
"io"
types "github.com/prysmaticlabs/eth2-types"
"github.com/prysmaticlabs/prysm/monitoring/backup"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
slashpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/shared/backuputil"
dbtypes "github.com/prysmaticlabs/prysm/slasher/db/types"
slashertypes "github.com/prysmaticlabs/prysm/slasher/detection/attestations/types"
)
@ -99,7 +99,7 @@ type FullAccessDatabase interface {
// Database represents a full access database with the proper DB helper functions.
type Database interface {
io.Closer
backuputil.BackupExporter
backup.BackupExporter
FullAccessDatabase
DatabasePath() string
ClearDB() error

View File

@ -13,16 +13,16 @@ go_library(
],
deps = [
"//cmd/slasher/flags:go_default_library",
"//monitoring/backup:go_default_library",
"//monitoring/prometheus:go_default_library",
"//monitoring/tracing:go_default_library",
"//shared:go_default_library",
"//shared/backuputil:go_default_library",
"//shared/cmd:go_default_library",
"//shared/debug:go_default_library",
"//shared/event:go_default_library",
"//shared/featureconfig:go_default_library",
"//shared/params:go_default_library",
"//shared/prereq:go_default_library",
"//shared/prometheus:go_default_library",
"//shared/tracing:go_default_library",
"//shared/version:go_default_library",
"//slasher/beaconclient:go_default_library",
"//slasher/db:go_default_library",

View File

@ -14,16 +14,16 @@ import (
"github.com/pkg/errors"
"github.com/prysmaticlabs/prysm/cmd/slasher/flags"
"github.com/prysmaticlabs/prysm/monitoring/backup"
"github.com/prysmaticlabs/prysm/monitoring/prometheus"
tracing2 "github.com/prysmaticlabs/prysm/monitoring/tracing"
"github.com/prysmaticlabs/prysm/shared"
"github.com/prysmaticlabs/prysm/shared/backuputil"
"github.com/prysmaticlabs/prysm/shared/cmd"
"github.com/prysmaticlabs/prysm/shared/debug"
"github.com/prysmaticlabs/prysm/shared/event"
"github.com/prysmaticlabs/prysm/shared/featureconfig"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/prereq"
"github.com/prysmaticlabs/prysm/shared/prometheus"
"github.com/prysmaticlabs/prysm/shared/tracing"
"github.com/prysmaticlabs/prysm/shared/version"
"github.com/prysmaticlabs/prysm/slasher/beaconclient"
"github.com/prysmaticlabs/prysm/slasher/db"
@ -52,7 +52,7 @@ type SlasherNode struct {
// New creates a new node instance, sets up configuration options,
// and registers every required service.
func New(cliCtx *cli.Context) (*SlasherNode, error) {
if err := tracing.Setup(
if err := tracing2.Setup(
"slasher", // Service name.
cliCtx.String(cmd.TracingProcessNameFlag.Name),
cliCtx.String(cmd.TracingEndpointFlag.Name),
@ -165,7 +165,7 @@ func (n *SlasherNode) registerPrometheusService(cliCtx *cli.Context) error {
additionalHandlers,
prometheus.Handler{
Path: "/db/backup",
Handler: backuputil.BackupHandler(n.db, cliCtx.String(cmd.BackupWebhookOutputDir.Name)),
Handler: backup.BackupHandler(n.db, cliCtx.String(cmd.BackupWebhookOutputDir.Name)),
},
)
}

View File

@ -12,12 +12,12 @@ go_library(
deps = [
"//beacon-chain/core:go_default_library",
"//beacon-chain/core/helpers:go_default_library",
"//monitoring/tracing:go_default_library",
"//proto/prysm/v1alpha1:go_default_library",
"//shared/attestationutil:go_default_library",
"//shared/bls:go_default_library",
"//shared/p2putils:go_default_library",
"//shared/params:go_default_library",
"//shared/traceutil:go_default_library",
"//slasher/beaconclient:go_default_library",
"//slasher/db:go_default_library",
"//slasher/detection:go_default_library",

View File

@ -12,8 +12,8 @@ import (
recovery "github.com/grpc-ecosystem/go-grpc-middleware/recovery"
grpc_opentracing "github.com/grpc-ecosystem/go-grpc-middleware/tracing/opentracing"
grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
"github.com/prysmaticlabs/prysm/monitoring/tracing"
slashpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/shared/traceutil"
"github.com/prysmaticlabs/prysm/slasher/beaconclient"
"github.com/prysmaticlabs/prysm/slasher/db"
"github.com/prysmaticlabs/prysm/slasher/detection"
@ -70,14 +70,14 @@ func (s *Service) Start() {
grpc.StatsHandler(&ocgrpc.ServerHandler{}),
grpc.StreamInterceptor(middleware.ChainStreamServer(
recovery.StreamServerInterceptor(
recovery.WithRecoveryHandlerContext(traceutil.RecoveryHandlerFunc),
recovery.WithRecoveryHandlerContext(tracing.RecoveryHandlerFunc),
),
grpc_prometheus.StreamServerInterceptor,
grpc_opentracing.StreamServerInterceptor(),
)),
grpc.UnaryInterceptor(middleware.ChainUnaryServer(
recovery.UnaryServerInterceptor(
recovery.WithRecoveryHandlerContext(traceutil.RecoveryHandlerFunc),
recovery.WithRecoveryHandlerContext(tracing.RecoveryHandlerFunc),
),
grpc_prometheus.UnaryServerInterceptor,
grpc_opentracing.UnaryServerInterceptor(),

View File

@ -24,6 +24,7 @@ go_library(
"//beacon-chain/core:go_default_library",
"//beacon-chain/core/altair:go_default_library",
"//beacon-chain/core/helpers:go_default_library",
"//monitoring/tracing:go_default_library",
"//proto/prysm/v1alpha1:go_default_library",
"//proto/prysm/v1alpha1/block:go_default_library",
"//proto/prysm/v1alpha1/validator-client:go_default_library",
@ -43,7 +44,6 @@ go_library(
"//shared/slashutil:go_default_library",
"//shared/slotutil:go_default_library",
"//shared/timeutils:go_default_library",
"//shared/traceutil:go_default_library",
"//shared/version:go_default_library",
"//validator/accounts/iface:go_default_library",
"//validator/accounts/wallet:go_default_library",

View File

@ -8,13 +8,13 @@ import (
types "github.com/prysmaticlabs/eth2-types"
"github.com/prysmaticlabs/prysm/beacon-chain/core"
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
"github.com/prysmaticlabs/prysm/monitoring/tracing"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
validatorpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client"
"github.com/prysmaticlabs/prysm/shared/bls"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/slotutil"
"github.com/prysmaticlabs/prysm/shared/timeutils"
"github.com/prysmaticlabs/prysm/shared/traceutil"
"go.opencensus.io/trace"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
@ -163,7 +163,7 @@ func (v *validator) waitToSlotTwoThirds(ctx context.Context, slot types.Slot) {
defer t.Stop()
select {
case <-ctx.Done():
traceutil.AnnotateError(span, ctx.Err())
tracing.AnnotateError(span, ctx.Err())
return
case <-t.C:
return

View File

@ -11,6 +11,7 @@ import (
types "github.com/prysmaticlabs/eth2-types"
"github.com/prysmaticlabs/go-bitfield"
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
"github.com/prysmaticlabs/prysm/monitoring/tracing"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block"
validatorpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client"
@ -21,7 +22,6 @@ import (
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/slotutil"
"github.com/prysmaticlabs/prysm/shared/timeutils"
"github.com/prysmaticlabs/prysm/shared/traceutil"
"github.com/prysmaticlabs/prysm/validator/client/iface"
"github.com/sirupsen/logrus"
"go.opencensus.io/trace"
@ -41,13 +41,13 @@ func (v *validator) SubmitAttestation(ctx context.Context, slot types.Slot, pubK
var b strings.Builder
if err := b.WriteByte(byte(iface.RoleAttester)); err != nil {
log.WithError(err).Error("Could not write role byte for lock key")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return
}
_, err := b.Write(pubKey[:])
if err != nil {
log.WithError(err).Error("Could not write pubkey bytes for lock key")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return
}
lock := mputil.NewMultilock(b.String())
@ -62,7 +62,7 @@ func (v *validator) SubmitAttestation(ctx context.Context, slot types.Slot, pubK
if v.emitAccountMetrics {
ValidatorAttestFailVec.WithLabelValues(fmtKey).Inc()
}
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return
}
if len(duty.Committee) == 0 {
@ -80,7 +80,7 @@ func (v *validator) SubmitAttestation(ctx context.Context, slot types.Slot, pubK
if v.emitAccountMetrics {
ValidatorAttestFailVec.WithLabelValues(fmtKey).Inc()
}
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return
}
@ -95,7 +95,7 @@ func (v *validator) SubmitAttestation(ctx context.Context, slot types.Slot, pubK
if v.emitAccountMetrics {
ValidatorAttestFailVec.WithLabelValues(fmtKey).Inc()
}
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return
}
@ -105,7 +105,7 @@ func (v *validator) SubmitAttestation(ctx context.Context, slot types.Slot, pubK
if v.emitAccountMetrics {
ValidatorAttestFailVec.WithLabelValues(fmtKey).Inc()
}
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return
}
@ -141,7 +141,7 @@ func (v *validator) SubmitAttestation(ctx context.Context, slot types.Slot, pubK
log.WithFields(
attestationLogFields(pubKey, indexedAtt),
).Debug("Attempted slashable attestation details")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return
}
attResp, err := v.validatorClient.ProposeAttestation(ctx, attestation)
@ -150,7 +150,7 @@ func (v *validator) SubmitAttestation(ctx context.Context, slot types.Slot, pubK
if v.emitAccountMetrics {
ValidatorAttestFailVec.WithLabelValues(fmtKey).Inc()
}
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return
}
@ -159,7 +159,7 @@ func (v *validator) SubmitAttestation(ctx context.Context, slot types.Slot, pubK
if v.emitAccountMetrics {
ValidatorAttestFailVec.WithLabelValues(fmtKey).Inc()
}
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return
}
@ -280,7 +280,7 @@ func (v *validator) waitOneThirdOrValidBlock(ctx context.Context, slot types.Slo
}
}
case <-ctx.Done():
traceutil.AnnotateError(span, ctx.Err())
tracing.AnnotateError(span, ctx.Err())
return
case <-sub.Err():
log.Error("Subscriber closed, exiting goroutine")

View File

@ -10,12 +10,12 @@ import (
"github.com/prysmaticlabs/prysm/beacon-chain/core"
"github.com/prysmaticlabs/prysm/beacon-chain/core/altair"
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
"github.com/prysmaticlabs/prysm/monitoring/tracing"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
validatorpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client"
"github.com/prysmaticlabs/prysm/shared/bls"
"github.com/prysmaticlabs/prysm/shared/bytesutil"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/traceutil"
"github.com/sirupsen/logrus"
"go.opencensus.io/trace"
)
@ -31,7 +31,7 @@ func (v *validator) SubmitSyncCommitteeMessage(ctx context.Context, slot types.S
res, err := v.validatorClient.GetSyncMessageBlockRoot(ctx, &emptypb.Empty{})
if err != nil {
log.WithError(err).Error("Could not request sync message block root to sign")
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return
}

View File

@ -6,12 +6,12 @@ import (
"time"
"github.com/pkg/errors"
"github.com/prysmaticlabs/prysm/monitoring/tracing"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/shared/bytesutil"
"github.com/prysmaticlabs/prysm/shared/mathutil"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/slotutil"
"github.com/prysmaticlabs/prysm/shared/traceutil"
"github.com/prysmaticlabs/prysm/validator/keymanager/remote"
"go.opencensus.io/trace"
)
@ -80,7 +80,7 @@ func (v *validator) waitForActivation(ctx context.Context, accountsChangedChan <
}
stream, err := v.validatorClient.WaitForActivation(ctx, req)
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
attempts := streamAttempts(ctx)
log.WithError(err).WithField("attempts", attempts).
Error("Stream broken while waiting for activation. Reconnecting...")
@ -150,7 +150,7 @@ func (v *validator) waitForActivation(ctx context.Context, accountsChangedChan <
return errors.Wrap(ctx.Err(), "context has been canceled so shutting down the loop")
}
if err != nil {
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
attempts := streamAttempts(ctx)
log.WithError(err).WithField("attempts", attempts).
Error("Stream broken while waiting for activation. Reconnecting...")

View File

@ -7,8 +7,8 @@ go_library(
# Other packages must use github.com/prysmaticlabs/prysm/validator/db.Database alias.
visibility = ["//validator/db:__subpackages__"],
deps = [
"//monitoring/backup:go_default_library",
"//proto/prysm/v1alpha1:go_default_library",
"//shared/backuputil:go_default_library",
"//validator/db/kv:go_default_library",
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
],

View File

@ -6,8 +6,8 @@ import (
"io"
types "github.com/prysmaticlabs/eth2-types"
"github.com/prysmaticlabs/prysm/monitoring/backup"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/shared/backuputil"
"github.com/prysmaticlabs/prysm/validator/db/kv"
)
@ -17,7 +17,7 @@ var _ = ValidatorDB(&kv.Store{})
// ValidatorDB defines the necessary methods for a Prysm validator DB.
type ValidatorDB interface {
io.Closer
backuputil.BackupExporter
backup.BackupExporter
DatabasePath() string
ClearDB() error
RunUpMigrations(ctx context.Context) error

View File

@ -22,6 +22,8 @@ go_library(
visibility = ["//validator:__subpackages__"],
deps = [
"//beacon-chain/core:go_default_library",
"//monitoring/progress:go_default_library",
"//monitoring/tracing:go_default_library",
"//proto/prysm/v1alpha1:go_default_library",
"//shared/abool:go_default_library",
"//shared/bytesutil:go_default_library",
@ -29,9 +31,7 @@ go_library(
"//shared/featureconfig:go_default_library",
"//shared/fileutil:go_default_library",
"//shared/params:go_default_library",
"//shared/progressutil:go_default_library",
"//shared/slashutil:go_default_library",
"//shared/traceutil:go_default_library",
"@com_github_pkg_errors//:go_default_library",
"@com_github_prometheus_client_golang//prometheus:go_default_library",
"@com_github_prysmaticlabs_eth2_types//:go_default_library",

View File

@ -8,10 +8,10 @@ import (
"github.com/pkg/errors"
types "github.com/prysmaticlabs/eth2-types"
"github.com/prysmaticlabs/prysm/monitoring/tracing"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/shared/bytesutil"
"github.com/prysmaticlabs/prysm/shared/slashutil"
"github.com/prysmaticlabs/prysm/shared/traceutil"
bolt "go.etcd.io/bbolt"
"go.opencensus.io/trace"
)
@ -187,7 +187,7 @@ func (s *Store) CheckSlashableAttestation(
return nil
})
traceutil.AnnotateError(span, err)
tracing.AnnotateError(span, err)
return slashKind, err
}

View File

@ -5,9 +5,9 @@ import (
"context"
types "github.com/prysmaticlabs/eth2-types"
"github.com/prysmaticlabs/prysm/monitoring/progress"
"github.com/prysmaticlabs/prysm/shared/bytesutil"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/progressutil"
bolt "go.etcd.io/bbolt"
)
@ -59,7 +59,7 @@ func (s *Store) migrateOptimalAttesterProtectionUp(ctx context.Context) error {
return err
}
bar := progressutil.InitializeProgressBar(numKeys, "Migrating attesting history to more efficient format")
bar := progress.InitializeProgressBar(numKeys, "Migrating attesting history to more efficient format")
for i, publicKey := range publicKeyBytes {
attestingHistory := deprecatedEncodedAttestingHistory(attestingHistoryBytes[i])
err = s.db.Update(func(tx *bolt.Tx) error {
@ -193,7 +193,7 @@ func (s *Store) migrateOptimalAttesterProtectionDown(ctx context.Context) error
if bkt == nil {
return nil
}
bar := progressutil.InitializeProgressBar(len(pubKeys), "Migrating attesting history to old format")
bar := progress.InitializeProgressBar(len(pubKeys), "Migrating attesting history to old format")
for _, pubKey := range pubKeys {
// Now we write the attesting history using the data we extracted
// from the buckets accordingly.

View File

@ -4,7 +4,7 @@ import (
"bytes"
"context"
"github.com/prysmaticlabs/prysm/shared/progressutil"
"github.com/prysmaticlabs/prysm/monitoring/progress"
bolt "go.etcd.io/bbolt"
)
@ -43,7 +43,7 @@ func (s *Store) migrateSourceTargetEpochsBucketUp(ctx context.Context) error {
// If we did a single transaction for all public keys, resource use might be too high,
// and if we do a single one per key, the migration will take too long.
batchedKeys := batchPublicKeys(publicKeyBytes, publicKeyMigrationBatchSize)
bar := progressutil.InitializeProgressBar(
bar := progress.InitializeProgressBar(
len(batchedKeys), "Adding optimizations for validator slashing protection",
)
for _, batch := range batchedKeys {

View File

@ -29,10 +29,12 @@ go_library(
],
deps = [
"//cmd/validator/flags:go_default_library",
"//monitoring/backup:go_default_library",
"//monitoring/prometheus:go_default_library",
"//monitoring/tracing:go_default_library",
"//proto/prysm/v1alpha1:go_default_library",
"//proto/prysm/v1alpha1/validator-client:go_default_library",
"//shared:go_default_library",
"//shared/backuputil:go_default_library",
"//shared/cmd:go_default_library",
"//shared/debug:go_default_library",
"//shared/event:go_default_library",
@ -41,8 +43,6 @@ go_library(
"//shared/gateway:go_default_library",
"//shared/params:go_default_library",
"//shared/prereq:go_default_library",
"//shared/prometheus:go_default_library",
"//shared/tracing:go_default_library",
"//shared/version:go_default_library",
"//validator/accounts/iface:go_default_library",
"//validator/accounts/wallet:go_default_library",

View File

@ -17,10 +17,12 @@ import (
gwruntime "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/pkg/errors"
"github.com/prysmaticlabs/prysm/cmd/validator/flags"
"github.com/prysmaticlabs/prysm/monitoring/backup"
"github.com/prysmaticlabs/prysm/monitoring/prometheus"
tracing2 "github.com/prysmaticlabs/prysm/monitoring/tracing"
pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
validatorpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client"
"github.com/prysmaticlabs/prysm/shared"
"github.com/prysmaticlabs/prysm/shared/backuputil"
"github.com/prysmaticlabs/prysm/shared/cmd"
"github.com/prysmaticlabs/prysm/shared/debug"
"github.com/prysmaticlabs/prysm/shared/event"
@ -29,8 +31,6 @@ import (
"github.com/prysmaticlabs/prysm/shared/gateway"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/prereq"
"github.com/prysmaticlabs/prysm/shared/prometheus"
"github.com/prysmaticlabs/prysm/shared/tracing"
"github.com/prysmaticlabs/prysm/shared/version"
accountsiface "github.com/prysmaticlabs/prysm/validator/accounts/iface"
"github.com/prysmaticlabs/prysm/validator/accounts/wallet"
@ -64,7 +64,7 @@ type ValidatorClient struct {
// NewValidatorClient creates a new instance of the Prysm validator client.
func NewValidatorClient(cliCtx *cli.Context) (*ValidatorClient, error) {
if err := tracing.Setup(
if err := tracing2.Setup(
"validator", // service name
cliCtx.String(cmd.TracingProcessNameFlag.Name),
cliCtx.String(cmd.TracingEndpointFlag.Name),
@ -370,7 +370,7 @@ func (c *ValidatorClient) registerPrometheusService(cliCtx *cli.Context) error {
additionalHandlers,
prometheus.Handler{
Path: "/db/backup",
Handler: backuputil.BackupHandler(c.db, cliCtx.String(cmd.BackupWebhookOutputDir.Name)),
Handler: backup.BackupHandler(c.db, cliCtx.String(cmd.BackupWebhookOutputDir.Name)),
},
)
}

View File

@ -16,6 +16,7 @@ go_library(
importpath = "github.com/prysmaticlabs/prysm/validator/rpc",
visibility = ["//validator:__subpackages__"],
deps = [
"//monitoring/tracing:go_default_library",
"//proto/prysm/v1alpha1:go_default_library",
"//proto/prysm/v1alpha1/validator-client:go_default_library",
"//shared/bls:go_default_library",
@ -30,7 +31,6 @@ go_library(
"//shared/promptutil:go_default_library",
"//shared/rand:go_default_library",
"//shared/timeutils:go_default_library",
"//shared/traceutil:go_default_library",
"//shared/version:go_default_library",
"//validator/accounts:go_default_library",
"//validator/accounts/iface:go_default_library",

View File

@ -11,13 +11,13 @@ import (
recovery "github.com/grpc-ecosystem/go-grpc-middleware/recovery"
grpc_opentracing "github.com/grpc-ecosystem/go-grpc-middleware/tracing/opentracing"
grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
"github.com/prysmaticlabs/prysm/monitoring/tracing"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
validatorpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client"
"github.com/prysmaticlabs/prysm/shared/event"
"github.com/prysmaticlabs/prysm/shared/logutil"
"github.com/prysmaticlabs/prysm/shared/rand"
"github.com/prysmaticlabs/prysm/shared/traceutil"
"github.com/prysmaticlabs/prysm/validator/accounts/wallet"
"github.com/prysmaticlabs/prysm/validator/client"
"github.com/prysmaticlabs/prysm/validator/db"
@ -147,7 +147,7 @@ func (s *Server) Start() {
grpc.StatsHandler(&ocgrpc.ServerHandler{}),
grpc.UnaryInterceptor(middleware.ChainUnaryServer(
recovery.UnaryServerInterceptor(
recovery.WithRecoveryHandlerContext(traceutil.RecoveryHandlerFunc),
recovery.WithRecoveryHandlerContext(tracing.RecoveryHandlerFunc),
),
grpc_prometheus.UnaryServerInterceptor,
grpc_opentracing.UnaryServerInterceptor(),

Some files were not shown because too many files have changed in this diff Show More