diff --git a/cmd/containerd/command/main_windows.go b/cmd/containerd/command/main_windows.go index 68f5b933b..8ed4a028a 100644 --- a/cmd/containerd/command/main_windows.go +++ b/cmd/containerd/command/main_windows.go @@ -24,6 +24,7 @@ import ( "unsafe" winio "github.com/Microsoft/go-winio" + "github.com/Microsoft/go-winio/pkg/etwlogrus" "github.com/containerd/containerd/log" "github.com/containerd/containerd/services/server" "github.com/sirupsen/logrus" @@ -89,3 +90,12 @@ func setupDumpStacks() { } }() } + +func init() { + // Provider ID: {2acb92c0-eb9b-571a-69cf-8f3410f383ad} + // Hook isn't closed explicitly, as it will exist until process exit. + // GUID is generated based on name - see Microsoft/go-winio/tools/etw-provider-gen. + if hook, err := etwlogrus.NewHook("ContainerD"); err == nil { + logrus.AddHook(hook) + } +}