#`telemetry.Tracer(ctx).Start(ctx, "foo")
1 messages · Page 1 of 1 (latest)
@fierce sand it worked! But super buried, I'm wondering what are my options to show it more prominently to the user?
Context is the "local defaults" feature, where the engine finds matching values in your local .env, and applies them as default values for module constructor arg. It's pretty invasive, so tester asked to show a clear message telling you what's going on
got a trace link? there's telemetry.Reveal() but that might be too powerful, depending
since that one is intended for 'show this all the way from the top level, and hide any non-revealed parent spans along the way'
maybe we don't have the UI language for this yet - sounds sort of like a side hint
(ignore the printf fail, that's unrelated 🙂 )
And here's the parent span, representing the end user's session: https://dagger.cloud/dagger/traces/57a1f49014cb84953eafb5a7ce3c6e17?span=367488244a9e6724
At the moment my span is 3 levels of depth down
hmm - would it make sense as a log, somehow? like attached to load module:?
@fierce sand also it doesn't show up in the TUI at all, initializing module doesn't show as expandable, no matter the verbosity level
a very high verbosity should make it expandable - it's because it's marked encapsulate which has aged somewhat poorly, it's a bit redundant now that everything collapses by default anyway
Do we have the equivalent of a loglevel but for spans?
Ah you're right, it expands at verbosity 3
unfortunately no i don't think so - might be doable with otel plumbing but it'd be pretty sophisticated
actually... vague memory of at least propagating whether debug is enabled 
but that's one specific thing, decided at command invocation time, and these logs would be somewhat hidden regardless, not sure it helps much
it seems like the hardest part of this is figuring out what exactly we want to show and when, not the mechanics of how to do it
- this came from a user request? i guess the idea is to never be surprised by defaults?
will the default values not just show up automatically in the module constructor span? like daggerDev(token: Secret) - oh but that just says "Secret", maybe they'd want to see the address() equivalent, which feels like the more general problem (recognizeable high level representation of values)
yes and also being able to quickly see if you got the var name wrong
false negative, false positive
from my pov otel is an implementation detail, it's pure terminal Ux (but having it in the trace is nice too)
in the UI you can at least click the Secret to see its constructor, which would show that. but the TUI might show something less useful since it's not interactive at that level
I show the value as written in .env for example
(would be better to not need the interaction)
I guess I could pass the top level context as a special arg?
displayCtx or something
(in my core code)
I'll try that
maybe a helper callback userInfo
it would lie about the call trace though
there's a longstanding TODO to have a global logger - is that too big of a hammer here? (that's been the general reason for it never being TODOne despite being not hard to implement)
maybe on top that i make it a log, and the CLI treats top-level logs in a special way?
technically you'd just need to pass the root span ID down from the CLI, which could be through OTel baggage, and use it for constructing a slog.SpanLogger on the engine side. pretty sure that'd end up with the log showing up at the bottom of the TUI
i can try adding a commit for that since it's a few bespoke APIs, if that seems closest to the goal for now
I don't fully understand that last part, but it seems like the right direction yeah
(eg. "down from the CLI" not sure what that implies, since my code is not CLI-specific)
it'd show up in the same spot as the 'canceling... (interrupt again to quit immediately)` line
the CLI is what creates the root span, so that's all i mean there - it controls the TUI in the end
I guess it would respect dagger-in-dagger? ie. my whole example trace was wrapped in a dev build of dagger dagger -c 'dev | terminal', I wouldn't want the logs to appear in the top-level dagger
yeah that should all work i think
(the nested logs would go to the nested CLI)
nice. Yeah seems like exactly what I need then
@raven matrix here's this for now: https://github.com/dagger/dagger/commit/55139ea26a779ed3e96964d6a7845eb5b86accd0 - have to run out soon
nice, thanks!
Will try it out tonight
OK if I just cherry-pick for now? Branch won't be mergeable for a few days anyway