Skip to content

More visualization plumbing and polish - #6704

Merged
vito merged 24 commits into
dagger:mainfrom
vito:collapse-internal
Feb 26, 2024
Merged

vito merged 24 commits into
dagger:mainfrom
vito:collapse-internal

Conversation

@vito

@vito vito commented Feb 21, 2024 •

Copy link
Copy Markdown
Contributor

(I pinged a bunch of people at the end to fish for any super quick feedback, low prio, ignore if busy)

Summary

  • Switches all our (*progrock.Recorder).Vertex calls to use a new higher-level progrock.Span API which additionally sets the vertex as the current parent in ctx so any subsequent progress is grouped benath it, tracing/span-style.
  • TUI now displays a single collapsed "initialize" step, hiding all the crazy noise that happens on run. (More on this below the summary)
  • Rather than always marking ID vertices internal to avoid cluttering Cloud and the old TUI(s), we mark them internal just before sending downstream to either. This is done using Progrock vertex labels, which are a thing now.
  • The same vertex label from the previous point is additionally used to make the TUI resilient to the timing window between seeing a vertex and receiving its ID payload. (If you don't know what that means, don't worry about it 😅)
  • Better panic handling in DagQL (catch panics and return errors) and the TUI (reset terminal so the trace doesn't staircase across the screen).
  • DagQL now returns proper gqlerror.Error results for each failed path.
  • DagQL now flags all intra-server calls (dag.Select) as internal, exposed via dagql.IsInternal. This supersedes the shortlived analytics.WithInternal/IsInternal pattern.
    • This means a few APIs that make self-calls will collapse/hide their children unless you --debug, which I think is a good balance; it means we can refactor things into fine-grained APIs that call each other without exposing a ton of extra calls.

re: collapsing in the TUI

After changing the TUI to collapse all the initialization and internal calls, my gut reaction was to dislike it. It kind of sucks not seeing what's going on when you're forced to wait anyway. It definitely makes sense in the web UI but I wonder if the TUI should just keep showing the user exactly what's going on.

Now that the TUI has been out for a bit, how do people feel about the noise level? cc @shykes @jedevc @helderco @sipsma @samalba (sorry for the spam, ignore if busy)

@vito
vito requested a review from a team as a code owner February 21, 2024 03:52
@vito
vito force-pushed the collapse-internal branch from e6f787b to 30e0df3 Compare February 21, 2024 15:06
@vito vito added this to the v0.10.0 milestone Feb 21, 2024
Comment thread core/modulesource.go Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sipsma I had to make this nullable since otherwise it's possible to call it and get back a zero-value dagql.Instance[*Directory] which leads to a nil panic. (Nothing load-bearing hit this, I was just monkeying around in the GraphQL playground and accidentally triggered it.)

Comment thread dagql/server.go Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sipsma I mentioned this could probably be simplified before, decided to do that now but lmk if there was a reason you couldn't (seems OK judging by tests)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I left it as is because it wasn't 100% clear to me that it was doing all the exact same things. E.g. the previous code appended the obj from s.ToSelectable(nthID, val) but afaict just using assign won't end up doing that (based on the implementation of DynamicArrayOutput.SetField).

Really not sure whether that's meaningful and, if so, in which cases, so no biggie either way at the moment. Can patch up more if we hit a case where it breaks.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, it looks like nothing actually calls this path right now because the whole conditional is beneath if _, ok := s.ObjectType(res.Type().Name()); ok { and the only slice value we ever select out is []string, which is not an object type. I'll just revert this to reduce noise.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shykes

shykes commented Feb 22, 2024

Copy link
Copy Markdown
Contributor

After changing the TUI to collapse all the initialization and internal calls, my gut reaction was to dislike it. It kind of sucks not seeing what's going on when you're forced to wait anyway

I think there is a middle ground. I propose defining 2 rules:

  1. Keep it moving. If things are happening, communicate progress frequently. (Arbitrary threshold: once per second at least).
  2. Only show understandable things. When showing information to the user, it should be possible to understand what it means.

The first rule is an incentive to show more detail. The second rule is an incentive to show less. Hopefully, together they get us to a good middle ground.

Applying this to the problem of "initialize":

Option Does it keep it moving? Does it only show understandable things?
Only show "initialize" No ❌ Yes ✅
Show all initialization calls at full detail (current design) Yes ✅ No ❌ Users see tons of internal calls that they don't understand
Show one top-level "initialize " for the top-level module + each dependency + "downlading engine container" + "running engine container" I argue that yes :) ✅ Yes ✅

You get the idea. I think it's OK to show more detail than just "initialize", to keep things moving, but we should be careful to only show information that is relevant to the end user.

@vito

vito commented Feb 22, 2024

Copy link
Copy Markdown
Contributor Author

@shykes Sounds good, I agree with those guidelines. I wonder if the new hiding of self-calls helps balance things out any. Will try an iteration that reveals the initialize content, since at least some of it should be reduced.

@sipsma

sipsma commented Feb 22, 2024

Copy link
Copy Markdown
Contributor

DagQL now flags all intra-server calls (dag.Select) as internal, exposed via dagql.IsInternal. This supersedes the shortlived analytics.WithInternal/IsInternal pattern.

Ooo nice! I had just been thinking about adding something similar but for the entirely different purpose of making some APIs like Blob and (added in my other open pr for improving sdk loading) BuiltinContainer hidden entirely from external clients and only available internally. That would alleviate a common itch I get with dagql where I need an Instance in order to use an arg which means I have to add an API which currently means it will end up being user facing too.

Just a driveby tangential thought, I may follow up with that if time.

@vito

vito commented Feb 23, 2024 •

Copy link
Copy Markdown
Contributor Author

@shykes Here are three readily available options:

1. Collapse initialize entirely

Current PR. I think we can agree this is too quiet for too long.

asciicast

2. Show everything

Roughly how it is today. Everything is shown, including self-calls, but now there's a toplevel initialize step that groups together all the initialization work. (Maybe there's some other way to show this, haven't experimented here much.)

asciicast

3. Middle ground

Expand initialize but hide internal calls.

asciicast


None of them seem to hit that sweet spot to me. The middle ground shows slightly more info but doesn't give me any useful info about what modules are being loaded, since those are all self-calls on the engine side that get hidden away.

For now I'm going to go with the middle ground, since it seems closer to what we want than just collapsing it all. We can keep iterating on this in later PRs.

edit: bonus demo: a failing module dependency reveals all the info, even through the internal calls:

asciicast

@sipsma sipsma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RE: initialize output, the main thing that came to mind looking at verbose and middle ground options was actually just that I want slightly more higher-level/annotated vertexes. Like ModuleSource.asModule just really means nothing. At the very minimum just having the source metadata being displayed (path for local, git url/path for git) alongside would be better.

You could probably also debate whether it should only be human readable by default (e.g. Loading module from "/home/you/coolmod") and only show the api name in a debug mode, show both always, etc. etc.

(None of the above is a blocker of course, just throwing it out there)

Comment thread dagql/server.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I left it as is because it wasn't 100% clear to me that it was doing all the exact same things. E.g. the previous code appended the obj from s.ToSelectable(nthID, val) but afaict just using assign won't end up doing that (based on the implementation of DynamicArrayOutput.SetField).

Really not sure whether that's meaningful and, if so, in which cases, so no biggie either way at the moment. Can patch up more if we hit a case where it breaks.

Comment thread core/healthcheck.go
defer func() {
vtx.Done(err)
}()
// always show health checks

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no-blocker, but are the health check intervals at the beginning slow enough to not like show 3 every time before either the check passes or exponential backoff grows enough to make them not noisy?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial interval is 100ms, up to 1 minute, giving up after 15 mins total so shouldn't be anything too crazy.

In ad-hoc testing it's been pretty quiet, so it seems like a decent balance:

image

Comment thread core/schema/schema.go Outdated

rec := progrock.FromContext(ctx)
if callContext.ProgrockParent != "" {
if header := r.Header.Get("X-Progrock-Parent"); header != "" {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: const where this is used

vito added 15 commits February 26, 2024 12:54
previously marked all ID vertices as internal so they wouldn't be
displayed in non-Zenith UIs like dagger run or in Cloud.

now we will consider any `dag.Select` call as internal, and not set it
for IDs corresponding to direct user queries.

to maintain compatibility, the telemetry.LegacyIDInternalizer
progrock.Writer is used for Cloud and the old TUIs.

Signed-off-by: Alex Suraci <[email protected]>
originally wrote these for the initial idtui PR. seems worth committing
rather than deleting; in lieu of integration tests these have been an
easy way to just spot check various use cases and record before/after.

Signed-off-by: Alex Suraci <[email protected]>
* allows CLI to group initialization work separate from the primary work
* adopt progrock.Span everywhere (new higher-level otel-style API)
  * make service health check vertex non-internal, grouped under service
* TODO update TUI to respect primary vertex

Signed-off-by: Alex Suraci <[email protected]>
otherwise this defaultPlatform call shows up in everyone's builds

Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
* now uses same CollectLogsView function used by dagviz
* renders primary output at the bottom of the screen, though i don't
  think this really matters at the moment since nothing streams to it
* TODO: support expanding

Signed-off-by: Alex Suraci <[email protected]>
previously it would go on to show their children

+ start switching to dagql.IsInternal
+ unrelated tweak for robustness of MostInterestingVertex

Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
vito added 8 commits February 26, 2024 12:54
way too quiet

Signed-off-by: Alex Suraci <[email protected]>
ideally the image pull stuff would be moved to progrock tasks so it can
have the same progress style from elsewhere, but that's too much work atm

Signed-off-by: Alex Suraci <[email protected]>
@vito
vito force-pushed the collapse-internal branch from a9dd807 to 67d6341 Compare February 26, 2024 17:54
@vito

vito commented Feb 26, 2024 •

Copy link
Copy Markdown
Contributor Author

Pushed another commit that brings back the connect vertex, but only the root-level one, where we'll now also print the docker pull output (thanks for the heads-up @marcosnils 🙏). It's not perfect but it puts the fire out (no engine connect/pull status atm) and shows more detail than before if you're on a slow connection. In the future it would be way cooler to show the 2-dimension layer progress bar for the image pull, and ideally this vertex would be somehow consolidated with initialize but we need to refactor some things for that to be possible atm (related to engine label collection, which @aluzzardi and I are currently cleaning up)

asciicast

(Ignore the silent 'initialize', it's because it's pointing to an old engine)


@sipsma Feedback addressed, thanks for the review!

RE: initialize output, the main thing that came to mind looking at verbose and middle ground options was actually just that I want slightly more higher-level/annotated vertexes. Like ModuleSource.asModule just really means nothing. At the very minimum just having the source metadata being displayed (path for local, git url/path for git) alongside would be better.

You could probably also debate whether it should only be human readable by default (e.g. Loading module from "/home/you/coolmod") and only show the api name in a debug mode, show both always, etc. etc.

Agree ModuleSource.asModule isn't exactly stellar, but I want to defer adding ad-hoc grouping and English steps until we're absolutely 100% sure we'll need it. I'd rather polish our APIs so they integrate nicely with our viz tooling and stay in the mindset of simply visualizing a call stack. If we give up on that too early we might end up with a mess of English steps intermixed with call traces at seemingly arbitrary points, especially if users see that the ability exists and want to use it themselves, implementing by hand what they should be getting from a call trace visualizer for free. (e.g. I want the pipeline and focus APIs to go away eventually)

@vito
vito force-pushed the collapse-internal branch from 67d6341 to c89d0dd Compare February 26, 2024 18:16
@vito
vito merged commit 4bcb7b4 into dagger:main Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants