mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-23 16:29:26 +00:00
## Summary The `--rpc.telemetry.sample-ratio` flag declares `Value: 1.0` and `geth --help` advertises `(default: 1)`. In practice, however, omitting the flag produces a sample ratio of `0`, causing `sdktrace.TraceIDRatioBased(0)` to drop 100% of spans. Users who enable `--rpc.telemetry` see the `OpenTelemetry trace export enabled` log line and a clean startup, but no traces ever leave the process. The root cause is the interaction between two pieces of code: 1. `cmd/utils/flags.go:setOpenTelemetry` (added in #34062) only copies the flag value when `ctx.IsSet(...)` returns true: ```go if ctx.IsSet(RPCTelemetrySampleRatioFlag.Name) { tcfg.SampleRatio = ctx.Float64(RPCTelemetrySampleRatioFlag.Name) } ``` That is the right pattern for "don't clobber a config-file value with the CLI default," but it implies that something else must initialise the field when neither source sets it. 2. `node/defaults.go:DefaultConfig` never initialises `OpenTelemetry.SampleRatio`, leaving it at the float64 zero value. The result for the common CLI-only user (no TOML config) is `SampleRatio = 0` → every span is silently dropped, despite the documented default of 1. ## Change Seed `OpenTelemetry: OpenTelemetryConfig{SampleRatio: 1.0}` in `node.DefaultConfig` so the documented default matches runtime behavior and the `ctx.IsSet` guard in `setOpenTelemetry` continues to do what it was designed to do. |
||
|---|---|---|
| .. | ||
| api.go | ||
| api_test.go | ||
| config.go | ||
| config_test.go | ||
| database.go | ||
| defaults.go | ||
| doc.go | ||
| endpoints.go | ||
| errors.go | ||
| jwt_auth.go | ||
| jwt_handler.go | ||
| lifecycle.go | ||
| node.go | ||
| node_auth_test.go | ||
| node_example_test.go | ||
| node_test.go | ||
| rpcstack.go | ||
| rpcstack_test.go | ||
| utils_test.go | ||