#Dagger Cloud full trace URL command?

1 messages ยท Page 1 of 1 (latest)

ebon grove
#

Hi guys,
is there a way to retrieve Dagger Cloud last trace URL directly from Dagger CLI?
We are looking for ways to provide a more direct access to this URL than opening pipeline log panels in CI

orchid hatch
#

or you need / prefer to get it from the CLI stdout?

ebon grove
#

@orchid hatch we were hoping maybe to be able to display the link to dagger cloud inside a GitHub Actions job summary
Do you suggest we should try and extract the URL from the stdout by following a given pattern?

orchid hatch
ebon grove
#

exactly, the only thing is that it can be buried at the end of lots of logs, and it can be tedious to go and fetch it way down the workflow logs
I was wondering if there was a dedicated way of retrieving this info and then expose it differently

orchid hatch
#

both work

ebon grove
#

Hmm, is the first option corresponding to the actual situation, where Dagger prints the URL automatically as soon as the token is set?
Or is there another way to have it printed? ๐Ÿ™‚

orchid hatch
#

you can print it within your pipeline

#

so it gets printed at the end of the function

#

what SDK are you currently using?

ebon grove
#

we are currently using Python SDK

ebon grove
#

Hello @orchid hatch, sorry to bother you, I'm really curious to know about this other way to retrieve the URL ๐Ÿ˜ƒ

orchid hatch
orchid hatch
#

here's a way you can achieve it:

    def container_echo(self, string_arg: str) -> dagger.Container:
        with get_tracer().start_as_current_span("test") as span:
            trace = span.get_span_context().trace_id
            print(
                f"the url is https://dagger.cloud/$org/traces/{trace:x}",
            )
#

^ with that you get the trace_id and then you should be able to construct the URL to navigate to it

#

having said that, in v0.16.2 at least, the call trace URL gets printed at the very end of the pipeline so I'm wondering if you're being able to see it at the end of the pipeline in your case

#

here's my output for example:

122 : Pytest.containerEcho CACHED [1.5s] | CPU Pressure (some): 319ยตs | CPU Pressure (full): 319ยตs | Memory Bytes (current): 5.4 MB | Memory Bytes (peak): 61 MB

1   : stdout
130 : โ”‚ Container.stdout: String!
130 : โ”‚ Container.stdout DONE [0.0s]
1   : stdout
1   : [3.4s] | obye
1   : [3.4s] |
1   : stdout DONE [3.6s]


Full trace at https://dagger.cloud/marcos-test/traces/3ae36445d077a2f4505e5365dd706d5e
ebon grove
#

Thank you Marcos for your detailed answer!
Regarding the code sample, I would have hoped for a more direct access to the full URL (including the org value which is retrieved from the token), maybe something like a getter on the engine object or something like this ๐Ÿ™‚
I agree that the full trace URL is printed at the end of the pipeline, my concern is that we haven't found the right log level to set on our CI, and as I said before this URL can be buried under tons of logs. I wished I could find a way to easily print the cloud URL in GitHub actions job summary for instance.
Thanks again for the time taken! ๐Ÿ™

lone shadow
orchid hatch
#

PR for :bikeshed: on its way @lone shadow

#

this allows getting the cloud trace URL from the engine and any SDK