Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/beekeeper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ on:
paths-ignore:
- packaging/**
- openapi/**
- '**/*.md'
- '.github/ISSUE_TEMPLATE/**'
- "**/*.md"
- ".github/ISSUE_TEMPLATE/**"
branches:
- "**"

Expand All @@ -19,7 +19,7 @@ env:
SETUP_CONTRACT_IMAGE: "ethersphere/bee-localchain"
SETUP_CONTRACT_IMAGE_TAG: "0.9.4"
BEELOCAL_BRANCH: "main"
BEEKEEPER_BRANCH: "master"
BEEKEEPER_BRANCH: "feat/bee-otlp-tracing-config"
Comment thread
martinconic marked this conversation as resolved.
Outdated
BEEKEEPER_METRICS_ENABLED: false
REACHABILITY_OVERRIDE_PUBLIC: true
BATCHFACTOR_OVERRIDE_PUBLIC: 2
Expand Down
48 changes: 40 additions & 8 deletions cmd/bee/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ const (
optionWelcomeMessage = "welcome-message"
optionCORSAllowedOrigins = "cors-allowed-origins"
optionNameTracingEnabled = "tracing-enable"
optionNameTracingEndpoint = "tracing-endpoint"
optionNameTracingHost = "tracing-host"
optionNameTracingPort = "tracing-port"
optionNameTracingOTLPEndpoint = "tracing-otlp-endpoint"
optionNameTracingOTLPInsecure = "tracing-otlp-insecure"
optionNameTracingOTLPProtocol = "tracing-otlp-protocol"
optionNameTracingSamplingRatio = "tracing-sampling-ratio"
optionNameTracingServiceName = "tracing-service-name"
Comment thread
martinconic marked this conversation as resolved.
optionNameVerbosity = "verbosity"
optionNamePaymentThreshold = "payment-threshold"
Expand Down Expand Up @@ -100,6 +101,14 @@ const (
configKeyBlockchainRpcTLSTimeout = "blockchain-rpc.tls-timeout"
configKeyBlockchainRpcIdleTimeout = "blockchain-rpc.idle-timeout"
configKeyBlockchainRpcKeepalive = "blockchain-rpc.keepalive"

// tracing
configKeyTracingEnabled = "tracing.enable"
configKeyTracingOTLPEndpoint = "tracing.otlp-endpoint"
configKeyTracingOTLPInsecure = "tracing.otlp-insecure"
configKeyTracingOTLPProtocol = "tracing.otlp-protocol"
configKeyTracingSamplingRatio = "tracing.sampling-ratio"
configKeyTracingServiceName = "tracing.service-name"
)

var blockchainRpcConfigPairs = []struct{ flat, dotted string }{
Expand All @@ -110,11 +119,23 @@ var blockchainRpcConfigPairs = []struct{ flat, dotted string }{
{optionNameBlockchainRpcKeepalive, configKeyBlockchainRpcKeepalive},
}

var tracingConfigPairs = []struct{ flat, dotted string }{
{optionNameTracingEnabled, configKeyTracingEnabled},
{optionNameTracingOTLPEndpoint, configKeyTracingOTLPEndpoint},
{optionNameTracingOTLPInsecure, configKeyTracingOTLPInsecure},
{optionNameTracingOTLPProtocol, configKeyTracingOTLPProtocol},
{optionNameTracingSamplingRatio, configKeyTracingSamplingRatio},
{optionNameTracingServiceName, configKeyTracingServiceName},
}

var knownNestedKeys = func() map[string]bool {
m := make(map[string]bool, len(blockchainRpcConfigPairs))
m := make(map[string]bool, len(blockchainRpcConfigPairs)+len(tracingConfigPairs))
for _, p := range blockchainRpcConfigPairs {
m[p.dotted] = true
}
for _, p := range tracingConfigPairs {
m[p.dotted] = true
}
return m
}()

Expand Down Expand Up @@ -281,9 +302,10 @@ func (c *command) setAllFlags(cmd *cobra.Command) {
cmd.Flags().Uint64(optionNameNetworkID, chaincfg.Mainnet.NetworkID, "ID of the Swarm network")
cmd.Flags().StringSlice(optionCORSAllowedOrigins, []string{}, "origins with CORS headers enabled")
cmd.Flags().Bool(optionNameTracingEnabled, false, "enable tracing")
cmd.Flags().String(optionNameTracingEndpoint, "127.0.0.1:6831", "endpoint to send tracing data")
cmd.Flags().String(optionNameTracingHost, "", "host to send tracing data")
cmd.Flags().String(optionNameTracingPort, "", "port to send tracing data")
cmd.Flags().String(optionNameTracingOTLPEndpoint, "127.0.0.1:4318", "OTLP endpoint to send tracing data (host:port); default port is 4318 for http, 4317 for grpc")
cmd.Flags().Bool(optionNameTracingOTLPInsecure, true, "disable TLS for the OTLP exporter (useful for a local collector)")
Comment thread
martinconic marked this conversation as resolved.
Outdated
cmd.Flags().String(optionNameTracingOTLPProtocol, "http", "OTLP exporter transport: http or grpc")
cmd.Flags().Float64(optionNameTracingSamplingRatio, 1.0, "head-based sampling ratio in [0,1]; 0 samples nothing, 1 samples everything")
cmd.Flags().String(optionNameTracingServiceName, "bee", "service name identifier for tracing")
cmd.Flags().String(optionNameVerbosity, "info", "log verbosity level 0=silent, 1=error, 2=warn, 3=info, 4=debug, 5=trace")
cmd.Flags().String(optionWelcomeMessage, "", "send a welcome message string during handshakes")
Expand Down Expand Up @@ -364,7 +386,17 @@ func (c *command) initLogger(cmd *cobra.Command) error {
// bindBlockchainRpcConfig supports both flat (blockchain-rpc-endpoint) and
// nested (blockchain-rpc.endpoint) YAML forms, with nested taking precedence.
func (c *command) bindBlockchainRpcConfig(cmd *cobra.Command) {
for _, p := range blockchainRpcConfigPairs {
c.bindNestedConfig(cmd, blockchainRpcConfigPairs)
}

// bindTracingConfig supports both flat (tracing-otlp-endpoint) and nested
// (tracing.otlp-endpoint) YAML forms, with nested taking precedence.
func (c *command) bindTracingConfig(cmd *cobra.Command) {
c.bindNestedConfig(cmd, tracingConfigPairs)
}

func (c *command) bindNestedConfig(cmd *cobra.Command, pairs []struct{ flat, dotted string }) {
for _, p := range pairs {
// Check before registering the alias; afterwards the flat value is unreachable.
if c.config.InConfig(p.flat) && c.config.InConfig(p.dotted) {
c.logger.Warning("config key conflict: nested form takes precedence", "ignored", p.flat, "used", p.dotted)
Expand Down
17 changes: 7 additions & 10 deletions cmd/bee/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"os"
"os/signal"
"path/filepath"
"strings"
"sync/atomic"
"syscall"
"time"
Expand Down Expand Up @@ -159,6 +158,7 @@ func (c *command) initStartCmd() (err error) {
return err
}
c.bindBlockchainRpcConfig(cmd)
c.bindTracingConfig(cmd)
return nil
},
}
Expand Down Expand Up @@ -241,12 +241,6 @@ func buildBeeNode(ctx context.Context, c *command, cmd *cobra.Command, logger lo
networkConfig.blockTime = time.Duration(blockTime) * time.Second
}

tracingEndpoint := c.config.GetString(optionNameTracingEndpoint)

if c.config.IsSet(optionNameTracingHost) && c.config.IsSet(optionNameTracingPort) {
tracingEndpoint = strings.Join([]string{c.config.GetString(optionNameTracingHost), c.config.GetString(optionNameTracingPort)}, ":")
}

staticNodesOpt := c.config.GetStringSlice(optionNameStaticNodes)
staticNodes := make([]swarm.Address, 0, len(staticNodesOpt))
for _, p := range staticNodesOpt {
Expand Down Expand Up @@ -325,9 +319,12 @@ func buildBeeNode(ctx context.Context, c *command, cmd *cobra.Command, logger lo
SwapFactoryAddress: c.config.GetString(optionNameSwapFactoryAddress),
SwapInitialDeposit: c.config.GetString(optionNameSwapInitialDeposit),
TargetNeighborhood: c.config.GetString(optionNameTargetNeighborhood),
TracingEnabled: c.config.GetBool(optionNameTracingEnabled),
TracingEndpoint: tracingEndpoint,
TracingServiceName: c.config.GetString(optionNameTracingServiceName),
TracingEnabled: c.config.GetBool(configKeyTracingEnabled),
TracingEndpoint: c.config.GetString(configKeyTracingOTLPEndpoint),
TracingInsecure: c.config.GetBool(configKeyTracingOTLPInsecure),
TracingProtocol: c.config.GetString(configKeyTracingOTLPProtocol),
TracingSamplingRatio: c.config.GetFloat64(configKeyTracingSamplingRatio),
TracingServiceName: c.config.GetString(configKeyTracingServiceName),
TrxDebugMode: c.config.GetBool(optionNameTransactionDebugMode),
WarmupTime: c.config.GetDuration(optionWarmUpTime),
WelcomeMessage: c.config.GetString(optionWelcomeMessage),
Expand Down
44 changes: 29 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,29 @@ require (
github.com/multiformats/go-multiaddr-dns v0.4.1
github.com/multiformats/go-multihash v0.2.3
github.com/multiformats/go-multistream v0.6.1
github.com/opentracing/opentracing-go v1.2.0
github.com/prometheus/client_golang v1.22.0
github.com/spf13/afero v1.6.0
github.com/spf13/cobra v1.8.1
github.com/spf13/viper v1.7.0
github.com/stretchr/testify v1.11.1
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
github.com/uber/jaeger-client-go v2.24.0+incompatible
github.com/vmihailenco/msgpack/v5 v5.4.1
github.com/wealdtech/go-ens/v3 v3.5.1
gitlab.com/nolash/go-mockbytes v0.0.7
go.opentelemetry.io/otel v1.43.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.43.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.43.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.43.0
go.opentelemetry.io/otel/sdk v1.43.0
go.opentelemetry.io/otel/trace v1.43.0
go.uber.org/atomic v1.11.0
go.uber.org/goleak v1.3.0
go.uber.org/zap v1.27.0
golang.org/x/crypto v0.48.0
golang.org/x/net v0.50.0
golang.org/x/sync v0.19.0
golang.org/x/sys v0.41.0
golang.org/x/term v0.40.0
golang.org/x/crypto v0.49.0
golang.org/x/net v0.52.0
golang.org/x/sync v0.20.0
golang.org/x/sys v0.42.0
golang.org/x/term v0.41.0
golang.org/x/time v0.12.0
gopkg.in/yaml.v2 v2.4.0
resenje.org/feed v0.1.2
Expand All @@ -59,6 +63,19 @@ require (
resenje.org/web v0.4.3
)

require (
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/otel/metric v1.43.0 // indirect
go.opentelemetry.io/proto/otlp v1.10.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260504160031-60b97b32f348 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260504160031-60b97b32f348 // indirect
google.golang.org/grpc v1.80.0 // indirect
)

require (
filippo.io/bigmod v0.1.1-0.20260103110540-f8a47775ebe5 // indirect
filippo.io/keygen v0.0.0-20260114151900-8e2790ea4c5b // indirect
Expand All @@ -72,7 +89,6 @@ require (
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect
github.com/caddyserver/zerossl v0.1.3 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/codahale/hdrhistogram v0.0.0-00010101000000-000000000000 // indirect
github.com/consensys/gnark-crypto v0.18.1 // indirect
github.com/crate-crypto/go-eth-kzg v1.4.0 // indirect
github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a // indirect
Expand Down Expand Up @@ -160,7 +176,6 @@ require (
github.com/quic-go/qpack v0.6.0 // indirect
github.com/quic-go/quic-go v0.59.0 // indirect
github.com/quic-go/webtransport-go v0.10.0 // indirect
github.com/rogpeppe/go-internal v1.13.1 // indirect
github.com/shirou/gopsutil v3.21.5+incompatible // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/cast v1.3.0 // indirect
Expand All @@ -170,7 +185,6 @@ require (
github.com/supranational/blst v0.3.16-0.20250831170142-f48500c1fdbe // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/uber/jaeger-lib v2.2.0+incompatible // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/wealdtech/go-multicodec v1.4.0 // indirect
github.com/wlynxg/anet v0.0.5 // indirect
Expand All @@ -182,11 +196,11 @@ require (
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap/exp v0.3.0 // indirect
golang.org/x/exp v0.0.0-20250606033433-dcc06ee1d476 // indirect
golang.org/x/mod v0.32.0 // indirect
golang.org/x/telemetry v0.0.0-20260109210033-bd525da824e2 // indirect
golang.org/x/text v0.34.0 // indirect
golang.org/x/tools v0.41.0 // indirect
google.golang.org/protobuf v1.36.6 // indirect
golang.org/x/mod v0.33.0 // indirect
golang.org/x/telemetry v0.0.0-20260209163413-e7419c687ee4 // indirect
golang.org/x/text v0.35.0 // indirect
golang.org/x/tools v0.42.0 // indirect
google.golang.org/protobuf v1.36.11 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/blake3 v1.4.1 // indirect
Expand Down
Loading
Loading