You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Present a warning to the user when using a deprecated API field or argument.
Motivation
Logging a warning makes it more visible whenever you're actually running a pipeline, no matter if you use a smart IDE or consult the reference docs during development. Removing the warning acts as encouragement to migrate to the new behavior.
Rationale
There's two sides to this:
In each SDK, so it's shown when using the IDE and when browsing the reference documentation.
By the API server while running the pipeline, so it's shown in the TUI and Dagger Cloud.
For the SDKs it depends on each language and is based on codegen. For the API it probably means using OpenTelemetry logs and presenting them.
@helderco I think instead of doing the job on the SDK side, we should log warning in our core API using progrock, this would be a generic and durable solution :)
@vito@helderco Any thought on this so we can make progress?
I think instead of doing the job on the SDK side, we should log warning in our core API using progrock, this would be a generic and durable solution :)
The intent was for the warning to show for the user when this API is used, both in the TUI and hopefully in cloud traces as well. Nothing was shown last time I ran this.
I defer to @vito to help point out what needs to be done to make this happen. Maybe we just need to hook the OpenTelemetry logs in the TUI and Cloud (from using a logger, not from the stdout/stderr we see today).
@helderco Yeah, I think it's time to start integrating with OpenTelemetry logging properly, which I take to mean integrating slog with ctx and setting OpenTelemetry's severity levels etc. instead of mimicking stdout/stderr.
I had an idea for a "global logger" that we could use sort of like Progrock's previous logging system:
...but it's half-baked at the moment. I wanted to have the TUI and Cloud look for that special dagger.io/global value (GlobalLogs) and use that to bubble up those logs to the top level, but that's currently not implemented. The nice thing is we can also keep the logs associated to a particular span (via ctx), so theoretically we can have some sort of "jump to relevant span" mechanic while still showing the logs globally.
@helderco I'm not sure I understand how to implement that, if I just log deprecation warning in the function I'm not sure it's going to be enough, for example
func (s*socketSchema) Install() {
dagql.Fields[*core.Query]{
dagql.Func("socket", s.socket).
Doc("Loads a socket by its ID.").
Deprecated("Use `loadSocketFromID` instead."),
}.Install(s.srv)
dagql.Fields[*core.Socket]{}.Install(s.srv)
}
typesocketArgsstruct {
ID core.SocketID
}
func (s*socketSchema) socket(ctx context.Context, parent*core.Query, argssocketArgs) (dagql.Instance[*core.Socket], error) {
slog.Warn("socket is deprecated, use loadSocketFromID instead")
returnargs.ID.Load(ctx, s.srv)
}
But I do not understand how I could create a static view at the top of the logging, like a permanent span or an extra global logger like you mentionned in #4855 (comment)
I have an idea but I'm not sure it's the right one, I would like to create a 2nd span window, that only display messages of our choices (selected by dagger.io/global for example) and these message would not disapears + will stay at the top of the execution.
I have an idea but I'm not sure it's the right one, I would like to create a 2nd span window, that only display messages of our choices (selected by dagger.io/global for example) and these message would not disapears + will stay at the top of the execution.
Yeah this sounds good. I actually just got done consolidating various forms of 'log panels' (we had 3!) to save screen real estate, so I'm hesitant to add another, but this feels warranted because a) it should be for "unusual" logs that we want to keep onscreen in any context, and b) we also want to let you jump to the log's originating span, which is a special mechanic not applied to other logs since they're already in the context of a span.
So as long as the TUI overhead is small, sgtm.
As far as implementation, would prefer to wait until #7671 is merged since it changes a ton of things. I figure we can intercept the logs in the frontend LogExporter and build up a list of log records that have the dagger.io/logs.global attribute, and then render them in Render() and finalRender(). That's probably a good enough start. The cherry on top would be the ability to somehow jump to their originating span, but that increases the difficulty a bit.
Activity
TomChv commentedon Aug 10, 2023
@helderco Is it a priority? I can work on this ASAP
helderco commentedon Aug 10, 2023
Not a priority, but may be easy to do. We no longer have any deprecated apis for now though. Python has this, only missing in Go and Node.js.
TomChv commentedon Aug 28, 2023
@helderco I think instead of doing the job on the SDK side, we should log warning in our core API using progrock, this would be a generic and durable solution :)
WDYT @vito ?
TomChv commentedon May 7, 2024
@vito @helderco Any thought on this so we can make progress?
helderco commentedon May 7, 2024
Yeah, been thinking about this because we have pending deprecations. For example:
withExec#7136I added this warning:
https://github.com/dagger/dagger/blob/fc6a74297956c41801d36081d841c7410ac9651e/core/schema/container.go#L582
The intent was for the warning to show for the user when this API is used, both in the TUI and hopefully in cloud traces as well. Nothing was shown last time I ran this.
I defer to @vito to help point out what needs to be done to make this happen. Maybe we just need to hook the OpenTelemetry logs in the TUI and Cloud (from using a logger, not from the stdout/stderr we see today).
vito commentedon May 7, 2024
@helderco Yeah, I think it's time to start integrating with OpenTelemetry logging properly, which I take to mean integrating
slogwithctxand setting OpenTelemetry's severity levels etc. instead of mimicking stdout/stderr.I had an idea for a "global logger" that we could use sort of like Progrock's previous logging system:
dagger/telemetry/logging.go
Lines 40 to 47 in 4ec5818
...but it's half-baked at the moment. I wanted to have the TUI and Cloud look for that special
dagger.io/globalvalue (GlobalLogs) and use that to bubble up those logs to the top level, but that's currently not implemented. The nice thing is we can also keep the logs associated to a particular span (viactx), so theoretically we can have some sort of "jump to relevant span" mechanic while still showing the logs globally.TomChv commentedon May 21, 2024
I unassigned myself from the issue since it should be done in the core engine.
TomChv commentedon Jun 19, 2024
@helderco I'm not sure I understand how to implement that, if I just log deprecation warning in the function I'm not sure it's going to be enough, for example
helderco commentedon Jun 19, 2024
Yes, that's the current state of things. The goal is to make it work. See #4855 (comment).
TomChv commentedon Jun 20, 2024
@vito Do you have any hints on where I could add this kind of logic, I see that we configure the TUI in the
dagger/main.godagger/cmd/dagger/main.go
Lines 277 to 312 in 7e99ef6
But I do not understand how I could create a static view at the top of the logging, like a permanent span or an extra global logger like you mentionned in #4855 (comment)
I have an idea but I'm not sure it's the right one, I would like to create a 2nd span window, that only display messages of our choices (selected by
dagger.io/globalfor example) and these message would not disapears + will stay at the top of the execution.How could I achieve such result?
vito commentedon Jun 20, 2024
@TomChv
Yeah this sounds good. I actually just got done consolidating various forms of 'log panels' (we had 3!) to save screen real estate, so I'm hesitant to add another, but this feels warranted because a) it should be for "unusual" logs that we want to keep onscreen in any context, and b) we also want to let you jump to the log's originating span, which is a special mechanic not applied to other logs since they're already in the context of a span.
So as long as the TUI overhead is small, sgtm.
As far as implementation, would prefer to wait until #7671 is merged since it changes a ton of things. I figure we can intercept the logs in the frontend
LogExporterand build up a list of log records that have thedagger.io/logs.globalattribute, and then render them inRender()andfinalRender(). That's probably a good enough start. The cherry on top would be the ability to somehow jump to their originating span, but that increases the difficulty a bit.