tilt icon indicating copy to clipboard operation
tilt copied to clipboard

handling resource names with the same prefix

Open nicks opened this issue 2 years ago • 2 comments

Current Behavior

Tilt caps resource names in tilt ci / tilt cli output at 13 characters https://github.com/tilt-dev/tilt/blob/master/pkg/model/logstore/prefix.go

If two resources have the same 13 character prefix, you won't be able to differentiate them.

Describe the Feature You Want

There are a few ways you could imagine we might differentiate:

  • using different colors
  • choosing a "unique" prefix
  • letting users configure the number of characters in the prefix

we should also look into what Compose does for this. maybe there's an opportunity to share logic?

nicks avatar Jan 12 '23 15:01 nicks

Thanks @nicks !

I think our CI system supports colors, that's a good start but not very cmd+f-able. We are also dumping snapshots at the end so this is somewhat tangential to that (since this is while it's running). Perhaps a combo of a unique color generated from the hash of the resource name (since they can't conflict) + some configurability of the length before it's truncated? That way it's easy to see while logs are flying by, and easy to search for, letting teams pick a length that works for them (if your resources are 5 letters like nginx and web, 13 may also be a bunch of wasted space). The issue really crops up when you're using tilt with microservices so you have service1-web and service1-worker and the like (but longer service names)

nsheaps avatar Jan 12 '23 15:01 nsheaps

i talked to the Compose people about how they handle this problem. The code is here: https://github.com/docker/compose/blob/v2/cmd/formatter/logs.go where they don't do any truncation at all; they just expand the prefix until it fits the whole resource name. that might be a better solution here :thinking:

nicks avatar Jan 18 '23 16:01 nicks