#What I'm proposing is:

1 messages · Page 1 of 1 (latest)

hidden herald
#

I'm trying to figure out how to show meaningful status messages in the TUI, and adding some description to Container.withExec sounds like it might help a little.
The tracer api seems to cover query building, but not execution.
I saw this but not entirely sure if it's related.
Is tracing query execution possible currently as of 0.15.1?
If yes, are there examples?

GitHub

Problem When Container.withExec is called, it emits an otel span. When it returns a (lazy) container ID, that span ends. Later, this may cause an actual exec, with a separate span These two operati...

tacit berry
# hidden herald I'm trying to figure out how to show meaningful status messages in the TUI, and ...

you could do something like this:

func (m *Lolo) Test(ctx context.Context) *dagger.Container {

    return dag.Container().From("alpine").
        With(Span(ctx, "mycustomspan", func(c *dagger.Container) *dagger.Container {
            return c.WithExec([]string{"echo", "hello bar"})

        }))

}

func Span(ctx context.Context, name string, fn func(*dagger.Container) *dagger.Container) func(*dagger.Container) *dagger.Container {
    ctx, span := dagger.Tracer().Start(ctx, name)
    return func(c *dagger.Container) *dagger.Container {
        c, _ = fn(c).Sync(ctx)
        defer span.End()
        return c
    }
}

and this is how it'd get displayed in Dagger Cloud: