Make DCP container runtime logs in tests more accessible
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Is your feature request related to a problem? Please describe the problem.
Every time DCP starts a container using our default test template, you'll see the following two entries in the test output. (Or the same thing in the app host if bumping DCP log level to info)
```
info: Aspire.Hosting.Dcp.dcpctrl.ContainerOrchestrator[0]
runtime status {"ContainerRuntime": "", "runtime": "podman", "status": {"Installed":false,"Running":false,"Error":"exec: \"podman\": executable file not found in %PATH%\nfailed to start podman command 'Info'"}}
info: Aspire.Hosting.Dcp.dcpctrl.ContainerOrchestrator[0]
runtime status {"ContainerRuntime": "", "runtime": "docker", "status": {"Installed":true,"Running":true,"Error":""}}
```
The first log entry looks like an error (it even has the word `error` in the body), and so is easy for someone unfamiliar with DCP to fixate on it, even though it's not a problem. As we're exposing these logs to end users, can we put them in a format more usable by someone who doesn't know what DCP is.
### Describe the solution you'd like
- A single log entry to indicate which container runtime is being used (i.e. "using podman runtime" / "using docker runtime", "Found docker & podman, using docker")
- Only report the detailed status of each runtime if DCP found neither docker nor podman.
### Additional context
There is a wider issue around DCP logs being exposed through the app host - the dcp logs in general have a lot of internal information which I'm sure is useful to a Microsoft engineer working on DCP, but to someone unfamiliar with DCP, the details and presentation can be scary and overwhelming.
Some other examples:
```
fail: Aspire.Hosting.Dcp.dcpctrl.ContainerReconciler[0]
could not create the container {"Container": {"name":"nonexist0-dnueesrv"}, "Reconciliation": 9, "ContainerName": "nonexist0-dnueesrv", "error": "object not found\ncontainer not found\ndocker command 'CreateContainer' returned with non-zero exit code 1: command output: Stdout: '' Stderr: ''"}
fail: Aspire.Hosting.Dcp.dcpctrl.ContainerReconciler[0]
failed to start Container {"Container": {"name":"failure-uxasffqy"}, "Reconciliation": 7, "ContainerID": "f81b96b2a584facf8668015e8b4259f110235b76bf4e19cb6de0f3141574bb0b", "error": "container f81b96b2a584facf8668015e8b4259f110235b76bf4e19cb6de0f3141574bb0b start failed (exit code 210)\nobject not found\ncontainer not found"}
fail: Aspire.Hosting.Dcp.dcp.start-apiserver.api-server.container-logstreamer.LogDescriptorSet[0]
Error disposing log descriptor {"ResourceName": {"name":"prometheusMetricsAdapter-bsqbtjgs"}, "ResourceUID": "946ef89e-b34f-4e9a-8ee6-cd558b90a2f4", "error": "context deadline exceeded\ncontext deadline exceeded"}
```
Contributor guide
Assessment
This issue has not been assessed yet.