go-ethereum/cmd
Barnabas Busa da34eb59fd
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
node: default OpenTelemetry SampleRatio to 1.0 (#34948)
## 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.
2026-05-13 14:08:21 -05:00
..
abidump all: update license headers and AUTHORS from git history (#24947) 2022-05-24 20:39:40 +02:00
abigen cmd/abigen: respect --v2=false (#34943) 2026-05-12 09:02:40 -04:00
blsync beacon/blsync: add checkpoint import/export file feature (#31469) 2025-04-03 16:04:11 +02:00
clef cmd/clef: update Safe API documentation links in changelog (#32136) 2025-07-09 14:09:11 -06:00
devp2p cmd/devp2p: fix typo in ENR IP printing code (#34909) 2026-05-09 15:59:03 +02:00
era internal/era/onedb: return false if err (#34816) 2026-05-01 14:10:41 +02:00
ethkey cmd: fix some typos in readmes (#29405) 2024-04-11 14:06:49 +03:00
evm core/state: track the block-level accessList (#34803) 2026-05-13 20:38:47 +08:00
fetchpayload cmd/fetchpayload: add payload-building utility (#33919) 2026-03-11 16:18:42 +01:00
geth cmd/geth: respect --dev=false (#34920) 2026-05-11 22:08:55 +08:00
keeper internal/telemetry: add gRPC transport for OTLP trace export (#33941) 2026-04-21 14:48:21 +02:00
rlpdump build: update to golangci-lint 1.61.0 (#30587) 2024-10-14 19:25:22 +02:00
utils node: default OpenTelemetry SampleRatio to 1.0 (#34948) 2026-05-13 14:08:21 -05:00
workload core/history: refactor pruning configuration (#34036) 2026-03-18 13:54:29 +01:00