mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 21:38:05 -05:00
Use otelgrpc for tracing grpc server and client (#15237)
* Use otelgrpc for tracing grpc server and client. * Changelog fragment * gofmt * Use context in prometheus service * Remove async start of prometheus service * Use random port to reduce the probability of concurrent tests using the same port * Remove comment * fix lint error --------- Co-authored-by: Bastin <bastin.m@proton.me>
This commit is contained in:
@@ -84,7 +84,7 @@ go_library(
|
||||
"@com_github_prometheus_client_golang//prometheus/promauto:go_default_library",
|
||||
"@com_github_prysmaticlabs_go_bitfield//:go_default_library",
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@io_opencensus_go//plugin/ocgrpc:go_default_library",
|
||||
"@io_opentelemetry_go_contrib_instrumentation_google_golang_org_grpc_otelgrpc//:go_default_library",
|
||||
"@io_opentelemetry_go_contrib_instrumentation_net_http_otelhttp//:go_default_library",
|
||||
"@io_opentelemetry_go_otel_trace//:go_default_library",
|
||||
"@org_golang_google_grpc//:go_default_library",
|
||||
|
||||
@@ -32,7 +32,7 @@ import (
|
||||
grpcopentracing "github.com/grpc-ecosystem/go-grpc-middleware/tracing/opentracing"
|
||||
grpcprometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
|
||||
"github.com/pkg/errors"
|
||||
"go.opencensus.io/plugin/ocgrpc"
|
||||
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
|
||||
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials"
|
||||
@@ -314,7 +314,7 @@ func ConstructDialOptions(
|
||||
grpcretry.WithMax(grpcRetries),
|
||||
grpcretry.WithBackoff(grpcretry.BackoffLinear(grpcRetryDelay)),
|
||||
),
|
||||
grpc.WithStatsHandler(&ocgrpc.ClientHandler{}),
|
||||
grpc.WithStatsHandler(otelgrpc.NewClientHandler()),
|
||||
grpc.WithUnaryInterceptor(middleware.ChainUnaryClient(
|
||||
grpcopentracing.UnaryClientInterceptor(),
|
||||
grpcprometheus.UnaryClientInterceptor,
|
||||
|
||||
@@ -376,6 +376,7 @@ func (c *ValidatorClient) registerPrometheusService(cliCtx *cli.Context) error {
|
||||
return nil
|
||||
}
|
||||
service := prometheus.NewService(
|
||||
cliCtx.Context,
|
||||
fmt.Sprintf("%s:%d", cliCtx.String(cmd.MonitoringHostFlag.Name), cliCtx.Int(flags.MonitoringPortFlag.Name)),
|
||||
c.services,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user