Skip to content

Commit

Permalink
Resolve comments
Browse files Browse the repository at this point in the history
Signed-off-by: Joffref <mariusjoffre@gmail.com>
  • Loading branch information
Joffref committed Aug 19, 2023
1 parent 7aa65ed commit a3d1b38
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
10 changes: 6 additions & 4 deletions modules/distributor/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ type Config struct {
// receivers map for shim.
// This receivers node is equivalent in format to the receiver node in the
// otel collector: https://github.com/open-telemetry/opentelemetry-collector/tree/main/receiver
Receivers map[string]interface{} `yaml:"receivers"`
OverrideRingKey string `yaml:"override_ring_key"`
LogReceivedTraces bool `yaml:"log_received_traces"` // Deprecated
LogReceivedSpans LogReceivedSpansConfig `yaml:"log_received_spans,omitempty"`
Receivers map[string]interface{} `yaml:"receivers"`
OverrideRingKey string `yaml:"override_ring_key"`
LogReceivedTraces bool `yaml:"log_received_traces"` // Deprecated
LogReceivedSpans LogReceivedSpansConfig `yaml:"log_received_spans,omitempty"`
GracefulShutdownPeriod time.Duration `yaml:"graceful_shutdown_period"`

Forwarders forwarder.ConfigList `yaml:"forwarders"`

Expand Down Expand Up @@ -66,4 +67,5 @@ func (cfg *Config) RegisterFlagsAndApplyDefaults(prefix string, f *flag.FlagSet)
f.BoolVar(&cfg.LogReceivedSpans.Enabled, util.PrefixConfig(prefix, "log-received-spans.enabled"), false, "Enable to log every received span to help debug ingestion or calculate span error distributions using the logs.")
f.BoolVar(&cfg.LogReceivedSpans.IncludeAllAttributes, util.PrefixConfig(prefix, "log-received-spans.include-attributes"), false, "Enable to include span attributes in the logs.")
f.BoolVar(&cfg.LogReceivedSpans.FilterByStatusError, util.PrefixConfig(prefix, "log-received-spans.filter-by-status-error"), false, "Enable to filter out spans without status error.")
f.DurationVar(&cfg.GracefulShutdownPeriod, "distributor.ring.graceful-period", 30*time.Second, "The duration to wait for a graceful shutdown before exiting.")
}
2 changes: 1 addition & 1 deletion modules/distributor/distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ func New(cfg Config, clientCfg ingester_client.Config, ingestersRing ring.ReadRi
cfgReceivers = defaultReceivers
}

receivers, err := receiver.New(cfgReceivers, d, middleware, loggingLevel, cfg.DistributorRing.GracefulShutdownPeriod)
receivers, err := receiver.New(cfgReceivers, d, middleware, loggingLevel, cfg.GracefulShutdownPeriod)
if err != nil {
return nil, err
}
Expand Down
9 changes: 3 additions & 6 deletions modules/distributor/distributor_ring.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ import (
// is used to strip down the config to the minimum, and avoid confusion
// to the user.
type RingConfig struct {
KVStore kv.Config `yaml:"kvstore"`
HeartbeatPeriod time.Duration `yaml:"heartbeat_period"`
HeartbeatTimeout time.Duration `yaml:"heartbeat_timeout"`
GracefulShutdownPeriod time.Duration `yaml:"graceful_shutdown_period"`

KVStore kv.Config `yaml:"kvstore"`
HeartbeatPeriod time.Duration `yaml:"heartbeat_period"`
HeartbeatTimeout time.Duration `yaml:"heartbeat_timeout"`
// Instance details
InstanceID string `yaml:"instance_id" doc:"hidden"`
InstanceInterfaceNames []string `yaml:"instance_interface_names"`
Expand All @@ -45,7 +43,6 @@ func (cfg *RingConfig) RegisterFlags(f *flag.FlagSet) {
cfg.KVStore.RegisterFlagsWithPrefix("distributor.ring.", "collectors/", f)
f.DurationVar(&cfg.HeartbeatPeriod, "distributor.ring.heartbeat-period", 5*time.Second, "Period at which to heartbeat to the ring. 0 = disabled.")
f.DurationVar(&cfg.HeartbeatTimeout, "distributor.ring.heartbeat-timeout", time.Minute, "The heartbeat timeout after which distributors are considered unhealthy within the ring. 0 = never (timeout disabled).")
f.DurationVar(&cfg.GracefulShutdownPeriod, "distributor.ring.graceful-period", 30*time.Second, "The duration to wait for a graceful shutdown before exiting.")
// Instance flags
cfg.InstanceInterfaceNames = []string{"eth0", "en0"}
f.Var((*flagext.StringSlice)(&cfg.InstanceInterfaceNames), "distributor.ring.instance-interface-names", "Name of network interface to read address from.")
Expand Down

0 comments on commit a3d1b38

Please sign in to comment.