When the daemon uses the containerd runtime (io.containerd.runhcs.v1),
the runhcs shim emits container metrics as the typeurl
`containerd.runhcs.stats.v1.Statistics`. moby never imported the package
that registers this type, so `typeurl.UnmarshalAny` failed with "type not
found" and `docker stats` reported all zeros for running Windows
containers.
Import the hcsshim runhcs stats package so its proto init registers the
typeurl, and handle `*wstats.Statistics` in `InterfaceToStats`, converting
the Windows container statistics (processor time is reported in
nanoseconds and converted to the 100ns units used by hcsshim.Statistics)
into the shape consumed by stats_windows.go. Also replace the bare type
assertion with a type switch so unexpected payloads no longer panic.
Un-skip TestStatsAllNoStream and TestStatsAllRunningNoStream, and add a
unit test for the conversion.
Signed-off-by: Dawei Wei <wei.dawei.cn@gmail.com>
- all changes here are attributed to difference in behaviour between,
namely:
- resolution of secondary test dependencies
- prunning of non-Go files
Signed-off-by: Ilya Dmitrichenko <errordeveloper@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This switches the hcsshim dependency back to tagged releases, instead of the special
"moby" branch. This makes the dependency align with both BuildKit and containerd,
which use these versions.
The switch to the "moby" branch was done in 2865478487,
to bring in a fix for image import, without having to bring in additional changes;
> We changed to the moby branch for a couple of reasons:
>
> - Allows us to take this important change without needing to also pull in all
> of the other work that has been going on in the repo.
> - moby uses an older set of APIs exposed from hcsshim, based on the HCS v1
> functionality. Going forwards, we have discussed deprecating/removing these
> APIs from the mainline branch in hcsshim, so our thinking was we could keep
> this moby branch around to ensure we don't break compatibility there.
>
> (...) Long term, the best path here is to get moby using containerd as the
> backend on Windows, which should alleviate these issues.
full diff: 9dcb42f100..v0.8.10
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>