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 | |
| 49 | // Instance flags |
| 50 | cfg.InstanceInterfaceNames = []string{"eth0", "en0"} |
| 51 | f.Var((*flagext.StringSlice)(&cfg.InstanceInterfaceNames), "distributor.ring.instance-interface-names", "Name of network interface to read address from.") |
| 52 | f.StringVar(&cfg.InstanceAddr, "distributor.ring.instance-addr", "", "IP address to advertise in the ring.") |
| 53 | f.IntVar(&cfg.InstancePort, "distributor.ring.instance-port", 0, "Port to advertise in the ring (defaults to server.grpc-listen-port).") |
| 54 | f.StringVar(&cfg.InstanceID, "distributor.ring.instance-id", hostname, "Instance ID to register in the ring.") |
| 55 | } |
| 56 | |
| 57 | // ToLifecyclerConfig returns a LifecyclerConfig based on the distributor |
| 58 | // ring config. |