mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix(tailnet): track agent names for http debug (#8744)
This commit is contained in:
@@ -262,7 +262,7 @@ func (c *coordinator) ServeClient(conn net.Conn, id, agentID uuid.UUID) error {
|
||||
logger := c.core.clientLogger(id, agentID)
|
||||
logger.Debug(ctx, "coordinating client")
|
||||
|
||||
tc := NewTrackedConn(ctx, cancel, conn, id, logger, 0)
|
||||
tc := NewTrackedConn(ctx, cancel, conn, id, logger, id.String(), 0)
|
||||
defer tc.Close()
|
||||
|
||||
c.core.addClient(id, tc)
|
||||
@@ -507,7 +507,7 @@ func (c *core) initAndTrackAgent(ctx context.Context, cancel func(), conn net.Co
|
||||
overwrites = oldAgentSocket.Overwrites() + 1
|
||||
_ = oldAgentSocket.Close()
|
||||
}
|
||||
tc := NewTrackedConn(ctx, cancel, conn, unique, logger, overwrites)
|
||||
tc := NewTrackedConn(ctx, cancel, conn, unique, logger, name, overwrites)
|
||||
c.agentNameCache.Add(id, name)
|
||||
|
||||
sockets, ok := c.agentToConnectionSockets[id]
|
||||
|
||||
@@ -35,7 +35,7 @@ type TrackedConn struct {
|
||||
overwrites int64
|
||||
}
|
||||
|
||||
func NewTrackedConn(ctx context.Context, cancel func(), conn net.Conn, id uuid.UUID, logger slog.Logger, overwrites int64) *TrackedConn {
|
||||
func NewTrackedConn(ctx context.Context, cancel func(), conn net.Conn, id uuid.UUID, logger slog.Logger, name string, overwrites int64) *TrackedConn {
|
||||
// buffer updates so they don't block, since we hold the
|
||||
// coordinator mutex while queuing. Node updates don't
|
||||
// come quickly, so 512 should be plenty for all but
|
||||
@@ -51,6 +51,7 @@ func NewTrackedConn(ctx context.Context, cancel func(), conn net.Conn, id uuid.U
|
||||
id: id,
|
||||
start: now,
|
||||
lastWrite: now,
|
||||
name: name,
|
||||
overwrites: overwrites,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user