node: default OpenTelemetry sample ratio to 1.0

The --rpc.telemetry.sample-ratio CLI flag declares a default of 1.0,
but cmd/utils.setOpenTelemetry only copies the flag value into the
node config when ctx.IsSet returns true. Without a corresponding
default on node.DefaultConfig.OpenTelemetry.SampleRatio, omitting the
flag leaves the runtime ratio at the float64 zero value, which causes
sdktrace.TraceIDRatioBased(0) to drop 100% of spans. Users see
"OpenTelemetry trace export enabled" but no traces ever leave geth.
Seed the default in DefaultConfig so the documented behavior matches
runtime behavior.
This commit is contained in:
Barnabas Busa 2026-05-12 14:32:23 +02:00
parent 726d657a4a
commit e1f7baeeb9
No known key found for this signature in database
GPG key ID: D7AF98F214C59E4E

View file

@ -76,6 +76,9 @@ var DefaultConfig = Config{
DiscoveryV5: true,
},
DBEngine: "", // Use whatever exists, will default to Pebble if non-existent and supported
OpenTelemetry: OpenTelemetryConfig{
SampleRatio: 1.0,
},
}
// DefaultDataDir is the default data directory to use for the databases and other