Skip to content

Commit

Permalink
fix: include the IP of the leader in ASM follower sync error logs (#2049
Browse files Browse the repository at this point in the history
)

It can be hard to tell in logs when an ASM follower can not sync with
the leader what it thinks the leader is, which is important to know if
it is following the current leader or an old one.
  • Loading branch information
matt2e authored Jul 11, 2024
1 parent d41616f commit 3f88e8e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion common/configuration/asm.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func newASMForTesting(ctx context.Context, secretsClient *secretsmanager.Client,
}
followerFactory := func(ctx context.Context, url *url.URL) (client asmClient, err error) {
rpcClient := rpc.Dial(ftlv1connect.NewAdminServiceClient, url.String(), log.Error)
return newASMFollower(ctx, rpcClient, clock), nil
return newASMFollower(ctx, rpcClient, url.String(), clock), nil
}
return &ASM{
coordinator: leader.NewCoordinator[asmClient](
Expand Down
4 changes: 2 additions & 2 deletions common/configuration/asm_follower.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ type asmFollower struct {

var _ asmClient = &asmFollower{}

func newASMFollower(ctx context.Context, rpcClient ftlv1connect.AdminServiceClient, clock clock.Clock) *asmFollower {
func newASMFollower(ctx context.Context, rpcClient ftlv1connect.AdminServiceClient, leaderName string, clock clock.Clock) *asmFollower {
f := &asmFollower{
client: rpcClient,
cache: newSecretsCache("asm-follower"),
cache: newSecretsCache(fmt.Sprintf("asm/follower/%s", leaderName)),
}
go f.cache.sync(ctx, asmFollowerSyncInterval, func(ctx context.Context, secrets *xsync.MapOf[Ref, cachedSecret]) error {
return f.sync(ctx, secrets)
Expand Down
2 changes: 1 addition & 1 deletion common/configuration/asm_leader.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var _ asmClient = &asmLeader{}
func newASMLeader(ctx context.Context, client *secretsmanager.Client, clock clock.Clock) *asmLeader {
l := &asmLeader{
client: client,
cache: newSecretsCache("asm-leader"),
cache: newSecretsCache("asm/leader"),
}
go l.cache.sync(ctx, asmLeaderSyncInterval, func(ctx context.Context, secrets *xsync.MapOf[Ref, cachedSecret]) error {
return l.sync(ctx, secrets)
Expand Down
2 changes: 1 addition & 1 deletion common/configuration/asm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func TestFollowerSync(t *testing.T) {
// fakeRPCClient connects the follower to the leader
fakeRPCClient := &fakeAdminClient{asm: asm}
followerClock := clock.NewMock()
follower := newASMFollower(ctx, fakeRPCClient, followerClock)
follower := newASMFollower(ctx, fakeRPCClient, "fake", followerClock)

testClientSync(ctx, t, follower, follower.cache, sm, func(percentage float64) {
// sync leader
Expand Down

0 comments on commit 3f88e8e

Please sign in to comment.