RegisterFlags adds the flags required to config this to the given FlagSet
(f *flag.FlagSet)
| 35 | |
| 36 | // RegisterFlags adds the flags required to config this to the given FlagSet |
| 37 | func (cfg *RingConfig) RegisterFlags(f *flag.FlagSet) { |
| 38 | hostname, err := os.Hostname() |
| 39 | if err != nil { |
| 40 | level.Error(util_log.Logger).Log("msg", "failed to get hostname", "err", err) |
| 41 | os.Exit(1) |
| 42 | } |
| 43 | |
| 44 | // Ring flags |
| 45 | cfg.KVStore.RegisterFlagsWithPrefix("distributor.ring.", "collectors/", f) |
| 46 | f.DurationVar(&cfg.HeartbeatPeriod, "distributor.ring.heartbeat-period", 5*time.Second, "Period at which to heartbeat to the ring. 0 = disabled.") |
| 47 | 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).") |
| 48 | f.BoolVar(&cfg.DetailedMetricsEnabled, "distributor.ring.detailed-metrics-enabled", true, "Set to true to enable ring detailed metrics. These metrics provide detailed information, such as token count and ownership per tenant. Disabling them can significantly decrease the number of metrics emitted.") |
| 49 | |
| 50 | // Instance flags |
| 51 | cfg.InstanceInterfaceNames = []string{"eth0", "en0"} |
| 52 | f.Var((*flagext.StringSlice)(&cfg.InstanceInterfaceNames), "distributor.ring.instance-interface-names", "Name of network interface to read address from.") |
| 53 | f.StringVar(&cfg.InstanceAddr, "distributor.ring.instance-addr", "", "IP address to advertise in the ring.") |
| 54 | f.IntVar(&cfg.InstancePort, "distributor.ring.instance-port", 0, "Port to advertise in the ring (defaults to server.grpc-listen-port).") |
| 55 | f.StringVar(&cfg.InstanceID, "distributor.ring.instance-id", hostname, "Instance ID to register in the ring.") |
| 56 | } |
| 57 | |
| 58 | // ToLifecyclerConfig returns a LifecyclerConfig based on the distributor |
| 59 | // ring config. |
nothing calls this directly
no test coverage detected