forked from ethereum-optimism/op-geth
-
Notifications
You must be signed in to change notification settings - Fork 15
Tracing celo v2.1.x #444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alvarof2
wants to merge
9
commits into
release/celo-v2.1.x
Choose a base branch
from
tracing-celo-v2.1.x
base: release/celo-v2.1.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Tracing celo v2.1.x #444
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ae3845b
feat: Add OpenTelemetry distributed tracing support
kailuo-uniswap 5bdb08d
remove backups
kailuo-uniswap d3f679a
Add Tracing
alvarof2 59f26e3
nodeFlags
alvarof2 3e38418
RPC tracing
alvarof2 9842bf9
Handle http
alvarof2 eee139d
Log and tracing options
alvarof2 df69892
Link traces
alvarof2 9b93e98
OpenTelemetry Standards Compliance
alvarof2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| package utils | ||
|
|
||
| import ( | ||
| "time" | ||
|
|
||
| "github.com/ethereum/go-ethereum/tracing" | ||
| "github.com/urfave/cli/v2" | ||
| ) | ||
|
|
||
| var ( | ||
| // Tracing flags | ||
| TracingEnabledFlag = &cli.BoolFlag{ | ||
| Name: "tracing.enabled", | ||
| Usage: "Enable OpenTelemetry tracing", | ||
| } | ||
| TracingEndpointFlag = &cli.StringFlag{ | ||
| Name: "tracing.endpoint", | ||
| Usage: "OpenTelemetry OTLP endpoint URL", | ||
| Value: "", | ||
| } | ||
| TracingServiceNameFlag = &cli.StringFlag{ | ||
| Name: "tracing.service-name", | ||
| Usage: "Service name for tracing", | ||
| Value: "geth", | ||
| } | ||
| TracingServiceVersionFlag = &cli.StringFlag{ | ||
| Name: "tracing.service-version", | ||
| Usage: "Service version for tracing", | ||
| Value: "", | ||
| } | ||
| TracingSampleRateFlag = &cli.Float64Flag{ | ||
| Name: "tracing.sample-rate", | ||
| Usage: "Tracing sample rate (0.0 to 1.0)", | ||
| Value: 1.0, | ||
| } | ||
| TracingTimeoutFlag = &cli.DurationFlag{ | ||
| Name: "tracing.timeout", | ||
| Usage: "Tracing export timeout", | ||
| Value: 10 * time.Second, | ||
| } | ||
| TracingRPCFlag = &cli.BoolFlag{ | ||
| Name: "tracing.rpc", | ||
| Usage: "Enable RPC tracing", | ||
| Value: true, | ||
| } | ||
| TracingEngineAPIFlag = &cli.BoolFlag{ | ||
| Name: "tracing.engine-api", | ||
| Usage: "Enable Engine API tracing", | ||
| Value: true, | ||
| } | ||
| TracingTransactionFlag = &cli.BoolFlag{ | ||
| Name: "tracing.transactions", | ||
| Usage: "Enable transaction-level tracing", | ||
| Value: false, | ||
| } | ||
| ) | ||
|
|
||
| // TracingFlags contains all tracing-related flags | ||
| var TracingFlags = []cli.Flag{ | ||
| TracingEnabledFlag, | ||
| TracingEndpointFlag, | ||
| TracingServiceNameFlag, | ||
| TracingServiceVersionFlag, | ||
| TracingSampleRateFlag, | ||
| TracingTimeoutFlag, | ||
| TracingRPCFlag, | ||
| TracingEngineAPIFlag, | ||
| TracingTransactionFlag, | ||
| } | ||
|
|
||
| // SetTracing configures tracing from CLI context | ||
| func SetTracing(ctx *cli.Context) *tracing.Config { | ||
| cfg := tracing.DefaultConfig() | ||
|
|
||
| if ctx.IsSet(TracingEnabledFlag.Name) { | ||
| cfg.Enabled = ctx.Bool(TracingEnabledFlag.Name) | ||
| } | ||
|
|
||
| if ctx.IsSet(TracingEndpointFlag.Name) { | ||
| cfg.Endpoint = ctx.String(TracingEndpointFlag.Name) | ||
| if cfg.Endpoint != "" { | ||
| cfg.Enabled = true // Auto-enable if endpoint is provided | ||
| } | ||
| } | ||
|
|
||
| if ctx.IsSet(TracingServiceNameFlag.Name) { | ||
| cfg.ServiceName = ctx.String(TracingServiceNameFlag.Name) | ||
| } | ||
|
|
||
| if ctx.IsSet(TracingServiceVersionFlag.Name) { | ||
| cfg.ServiceVersion = ctx.String(TracingServiceVersionFlag.Name) | ||
| } | ||
|
|
||
| if ctx.IsSet(TracingSampleRateFlag.Name) { | ||
| cfg.SampleRate = ctx.Float64(TracingSampleRateFlag.Name) | ||
| } | ||
|
|
||
| if ctx.IsSet(TracingTimeoutFlag.Name) { | ||
| cfg.Timeout = ctx.Duration(TracingTimeoutFlag.Name) | ||
| } | ||
|
|
||
| if ctx.IsSet(TracingRPCFlag.Name) { | ||
| cfg.EnableRPCTracing = ctx.Bool(TracingRPCFlag.Name) | ||
| } | ||
|
|
||
| if ctx.IsSet(TracingEngineAPIFlag.Name) { | ||
| cfg.EnableEngineAPITracing = ctx.Bool(TracingEngineAPIFlag.Name) | ||
| } | ||
|
|
||
| if ctx.IsSet(TracingTransactionFlag.Name) { | ||
| cfg.EnableTransactionTracing = ctx.Bool(TracingTransactionFlag.Name) | ||
| } | ||
|
|
||
| return cfg | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,10 +30,10 @@ require ( | |
| github.com/fsnotify/fsnotify v1.6.0 | ||
| github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff | ||
| github.com/gofrs/flock v0.8.1 | ||
| github.com/golang-jwt/jwt/v4 v4.5.2 | ||
| github.com/golang-jwt/jwt/v4 v4.5.1 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Dependency version downgrade may break compatibilityThe |
||
| github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb | ||
| github.com/google/gofuzz v1.2.0 | ||
| github.com/google/uuid v1.3.0 | ||
| github.com/google/uuid v1.4.0 | ||
| github.com/gorilla/websocket v1.4.2 | ||
| github.com/graph-gophers/graphql-go v1.3.0 | ||
| github.com/hashicorp/go-bexpr v0.1.10 | ||
|
|
@@ -65,6 +65,10 @@ require ( | |
| github.com/supranational/blst v0.3.14 | ||
| github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 | ||
| github.com/urfave/cli/v2 v2.27.5 | ||
| go.opentelemetry.io/otel v1.24.0 | ||
| go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.24.0 | ||
| go.opentelemetry.io/otel/sdk v1.24.0 | ||
| go.opentelemetry.io/otel/trace v1.24.0 | ||
| go.uber.org/automaxprocs v1.5.2 | ||
| go.uber.org/goleak v1.3.0 | ||
| golang.org/x/crypto v0.32.0 | ||
|
|
@@ -95,6 +99,7 @@ require ( | |
| github.com/aws/smithy-go v1.15.0 // indirect | ||
| github.com/beorn7/perks v1.0.1 // indirect | ||
| github.com/bits-and-blooms/bitset v1.17.0 // indirect | ||
| github.com/cenkalti/backoff/v4 v4.2.1 // indirect | ||
| github.com/cespare/xxhash/v2 v2.3.0 // indirect | ||
| github.com/cockroachdb/errors v1.11.3 // indirect | ||
| github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect | ||
|
|
@@ -107,13 +112,16 @@ require ( | |
| github.com/dlclark/regexp2 v1.7.0 // indirect | ||
| github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61 // indirect | ||
| github.com/getsentry/sentry-go v0.27.0 // indirect | ||
| github.com/go-logr/logr v1.4.1 // indirect | ||
| github.com/go-logr/stdr v1.2.2 // indirect | ||
| github.com/go-ole/go-ole v1.3.0 // indirect | ||
| github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect | ||
| github.com/goccy/go-json v0.10.4 // indirect | ||
| github.com/gogo/protobuf v1.3.2 // indirect | ||
| github.com/golang/protobuf v1.5.4 // indirect | ||
| github.com/google/go-querystring v1.1.0 // indirect | ||
| github.com/google/pprof v0.0.0-20230207041349-798e818bf904 // indirect | ||
| github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect | ||
| github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839 // indirect | ||
| github.com/jmespath/go-jmespath v0.4.0 // indirect | ||
| github.com/kilic/bls12-381 v0.1.0 // indirect | ||
|
|
@@ -144,8 +152,14 @@ require ( | |
| github.com/tklauser/go-sysconf v0.3.12 // indirect | ||
| github.com/tklauser/numcpus v0.6.1 // indirect | ||
| github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect | ||
| go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 // indirect | ||
| go.opentelemetry.io/otel/metric v1.24.0 // indirect | ||
| go.opentelemetry.io/proto/otlp v1.1.0 // indirect | ||
| golang.org/x/mod v0.22.0 // indirect | ||
| golang.org/x/net v0.34.0 // indirect | ||
| google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 // indirect | ||
| google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 // indirect | ||
| google.golang.org/grpc v1.61.1 // indirect | ||
| gopkg.in/yaml.v2 v2.4.0 // indirect | ||
| rsc.io/tmplfunc v0.0.3 // indirect | ||
| ) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Endpoint flag overrides explicit tracing disable
When a user explicitly sets
--tracing.enabled=falsebut also provides--tracing.endpoint, the auto-enable logic unconditionally setscfg.Enabled = trueif the endpoint is non-empty. This overrides the user's explicit intent to disable tracing, making it impossible to disable tracing when an endpoint is configured. The auto-enable should only apply when the enabled flag hasn't been explicitly set.