Repository navigation
Switch from Progrock to OpenTelemetry - #6835
Conversation
* All Progrock plumbing is now gone, though we may want to bring it back
for compatibility. Removing it was a useful exercise to find the many
places where we're relying on it.
* TUI now supports -v, -vv, -vvv (configurable verbosity). Global flags
like --debug, -v, --silent, etc. are processed anywhere in the command
string and respected.
* CLI forwards engine traces and logs to configured exporters, no need
to configure engine-side (we already need this flow for the TUI)
* "Live" spans are emitted to TUI and cloud, filtered out before sending
to a traditional (non-Live) otel stack
* Engine supports pub/sub for traces and logs, can be exposed in the
future as a GraphQL subscription
* Refactor context.Background usage to context.WithoutCancel. We usually
don't want a total reset, since that drops the span context and any
other telemetry related things (loggers etc). Go 1.21 added
context.WithoutCancel which is more precise.
* engine: don't include source in slogs. Added this prospectively and it
doesn't seem worth the noise.
* idtui: DB can record multiple traces, polish
* multi traces is mostly for dagviz, so i can run it with a single DB
* add 'passthrough' UI flag which tells the UI to ignore a span and
descend into its children
* add 'ignore' UI flag, to be used sparingly for things whose
signal:noise ratio is irredeemibly low (e.g. 'id' calls)
* make loadFooFromID calls passthrough
* make Buildkit gRPC calls passthrough
* Global Progrock rogs are theoretically replaced with
tracing.GlobalLogger, but it has yet to be integrated into anything.
* Module functions are pure after all. They're already cached
per-session, so this makes DagQL reflect that, avoiding duplicate
Buildkit work that would be deduped at the Buildkit layer. Cleans up
the telemetry since previously you'd see duplicate queries.
* TODO: ensure draining is airtight
* TODO: global logging to TUI
* TODO: batch forwarded engine spans instead of emitting them "live"
* TODO: fix dagger terminal
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
previously we would cancel all subscribers for a trace whenever a client/derver went away. but for modules/nesting this meant the inner call would cancel the whole trace early. * TODO: looks like services still don't drain completely? Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
previously service spans would be left incomplete on exit. now we'll detach from them on shutdown, which will only stop the service if we're the last depender on it. end result _should_ be that services are always completed through telemetry, but I've seen maybe 2 in 50 runs still leave it running. still troubleshooting, but without this change there is no hope at all. fixes dagger#6493 Signed-off-by: Alex Suraci <[email protected]>
Honestly not 100% confirmed, but seems right. I think the final solution might be to get traces/logs out without going through a session in the first place. Signed-off-by: Alex Suraci <[email protected]>
seeing a panic in ExportSpans/UploadTraces, this should help avoid bringing whole server down - I think - or at least give us hope. Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
fetching the logs/traces over a session is really annoying with draining because the session itself gets closed before things can be fully flushed. Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
More than a 10x efficiency increase. Frontend still super easy to implement. Test: # in ~/src/bass $ with-dev dagger call -m ./ --src https://github.com/vito/bass unit --packages ./pkg/cli stdout --debug &> out $ rg measuring out | cut -d= -f2 | xargs | tr ' ' '+' | sed -e 's/0m//g' -e 's/[^0-9\+]//g' | cat -v | bc Before: 8524838 (~8.1 MiB) After: 727039 (~0.7 MiB) Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
kinda hacky, but it makes sense that we need to handle this, cause loadFooFromID or generally anything can take an ID that's never been seen by the server before, and the loadFooFromID span will come first. Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
worth refactoring, but not now™ Signed-off-by: Alex Suraci <[email protected]>
|
I found an issue when I'm working on #6962. I create a file to Application.ensure_all_started(:inets)
Mix.install([{:dagger, path: "."}])
defmodule Test do
def run(dag \\ Dagger.connect!()) do
dag
|> Dagger.Client.container()
|> Dagger.Container.from("alpine")
|> Dagger.Container.with_exec(~w"echo hello")
|> Dagger.Sync.sync()
after
Dagger.close(dag)
end
end
Test.runThe script cannot compile because I'm accidentally make the sdk compilation error. When run with Let's ignore Elixir error for now. The issue is when error occurred, my shell display is now broken for some reason. :( |
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Helder Correia <[email protected]>
|
Thanks for the approval. 🙏 Integration tests were failing for the Python SDK, related to the new Will merge once checks are green. |
looks like there's more to figure out with module dependencies? either way, don't want this to block the current PR, they can be re-introduced in another PR like the other SDKs Revert "Pin python requirements" This reverts commit b40c411. Revert "Add Python support" This reverts commit 08aa92c. Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
|
Update: some Python related tests flaked due to a concurrent map write here: This is unrelated, but I've piled a quick fix onto my PR (just added a mutex), since it failed twice in a row. |
Out with Progrock, in with OpenTelemetry
Now that OpenTelemetry has support for streaming logs, we are able to switch from Progrock and embrace an open standard and ecosystem instead.
This change should be mostly invisible to the user, unless they want to integrate with OpenTelemetry. In that case, they can set the standard
OTEL_environment variables client-side, and all telemetry will be sent to the configured OTLP exporter, without requiring any engine-side configuration.How does it work?
OTEL_on the client side!callpbv1.Callas a span attribute. Not that this is a singleCalland not a fullDAG, which saves us ~10x (unpredictable) data sent over the wire, but implies the consumer needs to keep track of allCalls that it sees in order to grok inter-Callreferences.That covers tracing. What about logging?
io.Writers that send the logs to OpenTelemetry. This should maybe be upstreamed to Buildkit once 4955 lands.iotctx.Stdoutandioctx.Stderrto send to the resolver's span.Breaking changes
dagger runDAG TUI, and the ancient interactive tree view TUI. These were just not worth translating to the new world, so this was finally the time to GC them. Apologies to the handful of users that still used the tree view style UI.--focusflag is gone.pipeline()APIs are now no-ops.New features / improvements
curlstyle verbosity flags.-vkeeps things from disappearing-vvreveals internal/encapsulated spans-vvvreveals spans that evaluated very quicklydagger watchallows you to see all activity across the engine, which is pretty neat. I've already used it for troubleshooting integration tests. It works by just subscribing to "everything" via the pub/sub service mentioned above.telemetry.Encapsulate().Ctrl+\keybind andSIGQUITs itself, so if there's a hang for whatever reason, now we can more easily get a stack dump.OTEL_as appropriate in the shim.Regressions
CACHEDstatus for Buildkit cache hits. :( Instead you'll see separate spans likecache request: ...andload cache: ....Notable tweaks
dagger terminalno longer does the insane vterm emulation thing, which was originally done so we can support showing progress alongside your active terminal session.dagger watchin a separate terminal. Implementing a terminal emulator is not our core competency. It was fun, but also endless toil. The new implementation is much simpler.ctxpropagation, andcontext.Background()breaks that, so now we use the newcontext.WithoutCancel()API which is nearly always what we wanted instead, since it keeps all the juicy values but just drops the cancel-propagation aspect.-v/--debugand other global flags. We can't defer that to the usual flag parsing since that's tied to module loading and stuff (for e.g.dagger call).telemetry/envandtelemetry/sdklogwhich should be nuked as soon as the official SDK lands (Logs SDK prototype open-telemetry/opentelemetry-go#4955).cmd/that weren't worth maintaining.otel-collector(this is just native now)dagger-graph(this was coupled to Progrock/Buildkit progress stream)upload-journal(replaced by OTLP)