Skip to content

🐞 New --plain=progress implementation swallows prints and logs from modules #7510

Closed

Description

@skycaptain

What is the issue?

The new --plain=progress implementation shiped with v0.11.5 seems to swallow print statements and logs from modules among a lot of helpful debugging information (i.e. the command called).

Dagger version

dagger v0.11.5 (registry.dagger.io/engine) darwin/arm64

Steps to reproduce

Take the following example:

import logging

from dagger import function, object_type
from dagger.log import configure_logging

configure_logging(logging.DEBUG)
logger = logging.getLogger("dagger")


@object_type
class Test:
    @function
    def test(self):
        logger.warning("This is a warning using the logger")
        print("This is a print statement")

Running the above with v0.11.4 resulted in the following on stderr:

1: in exec docker start dagger-engine-835668aa455cbb8f
1: dagger-engine-835668aa455cbb8f

Connected to engine 08d250bad272 (version v0.11.4)
2: in starting session
2: OK!

3: in starting session
3: OK!

4: in starting session
4: OK!

5: in Query.test
5: [DEBUG] dagger.client._session: Configuring shared connection to GraphQL server
5: [DEBUG] dagger.client._session: Establishing client session to GraphQL server
5: [DEBUG] dagger.telemetry: Found TRACEPARENT
5: [DEBUG] dagger.telemetry: Initializing telemetry
5: [DEBUG] dagger.telemetry: Initializing traces telemetry with exporters: otlp_proto_grpc
5: [DEBUG] dagger.telemetry: Initializing metrics telemetry with exporters: none
5: [DEBUG] dagger.telemetry: Initializing logs telemetry with exporters: none
5: [DEBUG] dagger.telemetry: Telemetry initialized
5: [DEBUG] dagger.mod._module: invoke => {'parent_name': 'Test', 'parent_json': 'null', 'name': '', 'input_args': '{}'}
5: [DEBUG] dagger.mod._module: resolver => Test()
5: [DEBUG] dagger.mod._resolver: func => <Signature () -> None>
5: [DEBUG] dagger.mod._resolver: input args => {}
5: [DEBUG] dagger.mod._resolver: structured args => {}
5: [DEBUG] dagger.mod._module: result => Test()
5: [DEBUG] dagger.mod._module: output => '{}'
5: [DEBUG] dagger.client._session: Closing client session to GraphQL server

6: in starting session
6: OK!

7: in Test.test
7: [DEBUG] dagger.client._session: Configuring shared connection to GraphQL server
7: [DEBUG] dagger.client._session: Establishing client session to GraphQL server
7: [DEBUG] dagger.telemetry: Found TRACEPARENT
7: [DEBUG] dagger.telemetry: Initializing telemetry
7: [DEBUG] dagger.telemetry: Initializing traces telemetry with exporters: otlp_proto_grpc
7: [DEBUG] dagger.telemetry: Initializing metrics telemetry with exporters: none
7: [DEBUG] dagger.telemetry: Initializing logs telemetry with exporters: none
7: [DEBUG] dagger.telemetry: Telemetry initialized
7: [DEBUG] dagger.mod._module: invoke => {'parent_name': 'Test', 'parent_json': '{}', 'name': 'test', 'input_args': '{}'}
7: [DEBUG] dagger.mod._module: resolver => Test.test
7: [DEBUG] dagger.mod._resolver: func => <Signature ()>
7: [DEBUG] dagger.mod._resolver: input args => {}
7: [DEBUG] dagger.mod._resolver: structured args => {}
7: [WARNING] dagger: This is a warning using the logger
7: This is a print statement
7: [DEBUG] dagger.mod._module: result => None
7: [DEBUG] dagger.mod._module: output => 'null'
7: [DEBUG] dagger.client._session: Closing client session to GraphQL server

8: in /Users/[redacted]/Downloads/dagger_v0.11.4_darwin_arm64/dagger --progress=plain call test
8: <nil>

✔ connect 1.1s
✔ initialize 0.5s
✔ test: Test! 0.5s
┃ [DEBUG] dagger.client._session: Configuring shared connection to GraphQL server                                                                                                                                                                                                                           
┃ [DEBUG] dagger.client._session: Establishing client session to GraphQL server                                                                                                                                                                                                                             
┃ [DEBUG] dagger.telemetry: Found TRACEPARENT                                                                                                                                                                                                                                                               
┃ [DEBUG] dagger.telemetry: Initializing telemetry                                                                                                                                                                                                                                                          
┃ [DEBUG] dagger.telemetry: Initializing traces telemetry with exporters: otlp_proto_grpc                                                                                                                                                                                                                   
┃ [DEBUG] dagger.telemetry: Initializing metrics telemetry with exporters: none                                                                                                                                                                                                                             
┃ [DEBUG] dagger.telemetry: Initializing logs telemetry with exporters: none                                                                                                                                                                                                                                
┃ [DEBUG] dagger.telemetry: Telemetry initialized                                                                                                                                                                                                                                                           
┃ [DEBUG] dagger.mod._module: invoke => {'parent_name': 'Test', 'parent_json': 'null', 'name': '', 'input_args': '{}'}                                                                                                                                                                                      
┃ [DEBUG] dagger.mod._module: resolver => Test()                                                                                                                                                                                                                                                            
┃ [DEBUG] dagger.mod._resolver: func => <Signature () -> None>                                                                                                                                                                                                                                              
┃ [DEBUG] dagger.mod._resolver: input args => {}                                                                                                                                                                                                                                                            
┃ [DEBUG] dagger.mod._resolver: structured args => {}                                                                                                                                                                                                                                                       
┃ [DEBUG] dagger.mod._module: result => Test()                                                                                                                                                                                                                                                              
┃ [DEBUG] dagger.mod._module: output => '{}'                                                                                                                                                                                                                                                                
┃ [DEBUG] dagger.client._session: Closing client session to GraphQL server                                                                                                                                                                                                                                  
✔ Test.test: Void 0.6s
┃ [DEBUG] dagger.client._session: Configuring shared connection to GraphQL server                                                                                                                                                                                                                           
┃ [DEBUG] dagger.client._session: Establishing client session to GraphQL server                                                                                                                                                                                                                             
┃ [DEBUG] dagger.telemetry: Found TRACEPARENT                                                                                                                                                                                                                                                               
┃ [DEBUG] dagger.telemetry: Initializing telemetry                                                                                                                                                                                                                                                          
┃ [DEBUG] dagger.telemetry: Initializing traces telemetry with exporters: otlp_proto_grpc                                                                                                                                                                                                                   
┃ [DEBUG] dagger.telemetry: Initializing metrics telemetry with exporters: none                                                                                                                                                                                                                             
┃ [DEBUG] dagger.telemetry: Initializing logs telemetry with exporters: none                                                                                                                                                                                                                                
┃ [DEBUG] dagger.telemetry: Telemetry initialized                                                                                                                                                                                                                                                           
┃ [DEBUG] dagger.mod._module: invoke => {'parent_name': 'Test', 'parent_json': '{}', 'name': 'test', 'input_args': '{}'}                                                                                                                                                                                    
┃ [DEBUG] dagger.mod._module: resolver => Test.test                                                                                                                                                                                                                                                         
┃ [DEBUG] dagger.mod._resolver: func => <Signature ()>                                                                                                                                                                                                                                                      
┃ [DEBUG] dagger.mod._resolver: input args => {}                                                                                                                                                                                                                                                            
┃ [DEBUG] dagger.mod._resolver: structured args => {}                                                                                                                                                                                                                                                       
┃ [WARNING] dagger: This is a warning using the logger                                                                                                                                                                                                                                                      
┃ This is a print statement                                                                                                                                                                                                                                                                                 
┃ [DEBUG] dagger.mod._module: result => None                                                                                                                                                                                                                                                                
┃ [DEBUG] dagger.mod._module: output => 'null'                                                                                                                                                                                                                                                              
┃ [DEBUG] dagger.client._session: Closing client session to GraphQL server                                                                                                                                                                                                                                  

<nil>   

Please note that both, the print statement as well as the log message are printed to stderr.

The same code with v0.11.5 however results in:

1   : connect
2   :   starting engine
2   :   starting engine DONE [0.8s]
3   :   connecting to engine
18:51:09 INF Connected to engine name=d00ca9e72672 version=v0.11.5
3   :   connecting to engine DONE [0.1s]
4   :   starting session
4   :   starting session DONE [0.2s]
1   : connect DONE [1.1s]

5   : initialize
5   : initialize DONE [0.3s]

6   : test: Test!
7   :   exec /runtime
7   :   [0.3s] | [DEBUG] dagger.client._session: Configuring shared connection to GraphQL server
7   :   [0.3s] | [DEBUG] dagger.client._session: Establishing client session to GraphQL server
6   : test: Test! DONE [0.5s]

8   : Test.test: Void
9   :   exec /runtime
9   :   [0.3s] | [DEBUG] dagger.client._session: Configuring shared connection to GraphQL server
9   :   [0.3s] | [DEBUG] dagger.client._session: Establishing client session to GraphQL server
8   : Test.test: Void DONE [0.5s]

Neither the print statement nor the log message are printed.

Log output

No response

Activity

  1. jedevc commented on Jun 4, 2024

    @jedevc
    Contributor

    Hm, good point.

    This is because the new --progress=plain is now brought inline with --progress=tty which doesn't display this info either.

    I do think we should have a way of enabling this output - but, I don't think it should be the default, it should be behind one of the verbosity levels (-v/-vv/-vvv). The logic for this is that no module should rely on printing output - any critical information should be passed around as strings. Additionally, in a large network of module dependencies, having all the output for all the modules is noisy.

    cc @vito @shykes I know we've discussed how output from modules should appear.


    Technically speaking, this might be a little tricky. The reason no output appears is because of the Passthrough property on the exec /runtime span. One potential solution here is to propagate the stdout/stderr from a passed-through span into it's parent, but that's potentially confusing, since that parent might already have log output (although I don't think that's ever the case at the moment).

  2. vito commented on Jun 4, 2024

    @vito
    Contributor

    This actually used to work, and is unrelated to the new plain output - it broke for the TTY output at the same time. I think it broke when we removed the shim. We used to pass it a specific span ID/trace context which the shim would pick up and use to send logs to the span associated with the function call, instead of the regular /runtime process stdout/stderr.

  3. self-assigned this
    on Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions