Skip to content

Commit

Permalink
fix: All lifecycler cfgs ref a valid IPv6 addr and port combination
Browse files Browse the repository at this point in the history
  • Loading branch information
periklis committed Nov 2, 2023
1 parent e7ecb41 commit 956fbaa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
5 changes: 3 additions & 2 deletions pkg/distributor/distributor_ring.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package distributor

import (
"flag"
"fmt"
"net"
"os"
"strconv"
"time"

"github.com/go-kit/log"
Expand Down Expand Up @@ -72,7 +73,7 @@ func (cfg *RingConfig) ToBasicLifecyclerConfig(logger log.Logger) (ring.BasicLif

return ring.BasicLifecyclerConfig{
ID: cfg.InstanceID,
Addr: fmt.Sprintf("%s:%d", instanceAddr, instancePort),
Addr: net.JoinHostPort(instanceAddr, strconv.Itoa(instancePort)),
HeartbeatPeriod: cfg.HeartbeatPeriod,
HeartbeatTimeout: cfg.HeartbeatTimeout,
TokensObservePeriod: 0,
Expand Down
4 changes: 3 additions & 1 deletion pkg/ruler/base/ruler_ring.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ package base
import (
"flag"
"fmt"
"net"
"os"
"strconv"
"time"

"github.com/go-kit/log"
Expand Down Expand Up @@ -88,7 +90,7 @@ func (cfg *RingConfig) ToLifecyclerConfig(logger log.Logger) (ring.BasicLifecycl

return ring.BasicLifecyclerConfig{
ID: cfg.InstanceID,
Addr: fmt.Sprintf("%s:%d", instanceAddr, instancePort),
Addr: net.JoinHostPort(instanceAddr, strconv.Itoa(instancePort)),
HeartbeatPeriod: cfg.HeartbeatPeriod,
TokensObservePeriod: 0,
NumTokens: cfg.NumTokens,
Expand Down
5 changes: 3 additions & 2 deletions pkg/util/ring/ring_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package ring

import (
"flag"
"fmt"
"net"
"os"
"strconv"
"time"

"github.com/go-kit/log"
Expand Down Expand Up @@ -81,7 +82,7 @@ func (cfg *RingConfig) ToLifecyclerConfig(numTokens int, logger log.Logger) (rin

return ring.BasicLifecyclerConfig{
ID: cfg.InstanceID,
Addr: fmt.Sprintf("%s:%d", instanceAddr, instancePort),
Addr: net.JoinHostPort(instanceAddr, strconv.Itoa(instancePort)),
Zone: cfg.InstanceZone,
HeartbeatPeriod: cfg.HeartbeatPeriod,
TokensObservePeriod: 0,
Expand Down

0 comments on commit 956fbaa

Please sign in to comment.