Otel migration (#14424)

* remove opencensus

* gaz

* update dependencies

* add missing dependencies

* fix test?

* Fix note relevance

* add otel http transport middleware

* gaz

* tidy up

* gaz

* changelog

* feedback

* gaz

* fix merge issues
This commit is contained in:
Sammy Rosso
2024-09-12 16:00:20 -07:00
committed by GitHub
parent b5cfd0d35d
commit 170a864239
129 changed files with 416 additions and 415 deletions

View File

@@ -21,11 +21,11 @@ import (
"github.com/prysmaticlabs/prysm/v5/encoding/bytesutil"
"github.com/prysmaticlabs/prysm/v5/encoding/ssz/equality"
"github.com/prysmaticlabs/prysm/v5/monitoring/tracing"
"github.com/prysmaticlabs/prysm/v5/monitoring/tracing/trace"
prysmTrace "github.com/prysmaticlabs/prysm/v5/monitoring/tracing/trace"
"github.com/prysmaticlabs/prysm/v5/time/slots"
"github.com/sirupsen/logrus"
"github.com/trailofbits/go-mutexasserts"
goTrace "go.opencensus.io/trace"
"go.opentelemetry.io/otel/trace"
)
var processPendingBlocksPeriod = slots.DivideSlotBy(3 /* times per slot */)
@@ -53,7 +53,7 @@ func (s *Service) processPendingBlocksQueue() {
// processPendingBlocks validates, processes, and broadcasts pending blocks.
func (s *Service) processPendingBlocks(ctx context.Context) error {
ctx, span := trace.StartSpan(ctx, "processPendingBlocks")
ctx, span := prysmTrace.StartSpan(ctx, "processPendingBlocks")
defer span.End()
// Remove old blocks from our expiration cache.
@@ -67,7 +67,7 @@ func (s *Service) processPendingBlocks(ctx context.Context) error {
// Sort slots for ordered processing.
sortedSlots := s.sortedPendingSlots()
span.AddAttributes(trace.Int64Attribute("numSlots", int64(len(sortedSlots))), trace.Int64Attribute("numPeers", int64(len(s.cfg.p2p.Peers().Connected()))))
span.SetAttributes(prysmTrace.Int64Attribute("numSlots", int64(len(sortedSlots))), prysmTrace.Int64Attribute("numPeers", int64(len(s.cfg.p2p.Peers().Connected()))))
randGen := rand.NewGenerator()
var parentRoots [][32]byte
@@ -158,9 +158,9 @@ func (s *Service) processPendingBlocks(ctx context.Context) error {
}
// startInnerSpan starts a new tracing span for an inner loop and returns the new context and span.
func startInnerSpan(ctx context.Context, slot primitives.Slot) (context.Context, *goTrace.Span) {
ctx, span := trace.StartSpan(ctx, "processPendingBlocks.InnerLoop")
span.AddAttributes(trace.Int64Attribute("slot", int64(slot))) // lint:ignore uintcast -- This conversion is OK for tracing.
func startInnerSpan(ctx context.Context, slot primitives.Slot) (context.Context, trace.Span) {
ctx, span := prysmTrace.StartSpan(ctx, "processPendingBlocks.InnerLoop")
span.SetAttributes(prysmTrace.Int64Attribute("slot", int64(slot))) // lint:ignore uintcast -- This conversion is OK for tracing.
return ctx, span
}
@@ -255,7 +255,7 @@ func (s *Service) getBestPeers() []core.PeerID {
func (s *Service) checkIfBlockIsBad(
ctx context.Context,
span *goTrace.Span,
span trace.Span,
slot primitives.Slot,
b interfaces.ReadOnlySignedBeaconBlock,
blkRoot [32]byte,
@@ -283,7 +283,7 @@ func (s *Service) checkIfBlockIsBad(
}
func (s *Service) sendBatchRootRequest(ctx context.Context, roots [][32]byte, randGen *rand.Rand) error {
ctx, span := trace.StartSpan(ctx, "sendBatchRootRequest")
ctx, span := prysmTrace.StartSpan(ctx, "sendBatchRootRequest")
defer span.End()
roots = dedupRoots(roots)