#Is it possible to emit custom logs/spans that can be shown in the streaming dagger logs?
1 messages ยท Page 1 of 1 (latest)
yes, the SDK's have helper functions to get the current tracer and generate new spans that will get displayed in Dagger Cloud
I don't think that's documented yet cc @nocturne rampart
Would it be something similar to this? https://github.com/dagger/dagger/blob/441ea1fa2a432a9c8d4ad63c202389f8cddd5803/core/llm_env.go#L140-L146
An open-source runtime for composable workflows. Great for AI agents and CI/CD. - dagger/dagger
yes, exactly
@nocturne knot thank you I'll take a look! ๐
I'd actually opened a PR some time ago with sample code: https://github.com/dagger/dagger/pull/9301
We decided not to merge it as there will soon be a higher level API for this task
But maybe that PR is still helpful?
Depends how soon the higher level API appear I guess. ๐
Is it ok to abuse the trace api for logging?
Just an off the cuff feature request would be to be able to add leveled + structured logs. ๐
we're already sending all your execs logs to cloud so it should be ok as long as you send a "reasonable" amount of logs
@nocturne knot sorry to continue this thread, using spans for logs doesn't seem to be working really well for some reason.
func Log(ctx context.Context, msg string, args ...interface{}) {
_, span := Tracer().Start(ctx, fmt.Sprintf(msg, args...))
span.End()
}
I think this works for the most part but the spans seem to be in wrong places?
Most of my code should be correctly nested and passing contexts around, EXCEPT the LLM stuff.
The dag.LLM() doesn't seem to be accepting a context, so I'm not sure how it emits traces to the right place.