go.mod: Bump hcsshim to v0.10.0-rc.1

This contains quite a bit (also bumps google/uuid to 1.3.0). Some HostProcess
container improvements to get ready for whenever it goes to stable in
Kubernetes, Hyper-V (windows) container support for CRI, and a plethora of
other small additions and fixes.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
This commit is contained in:
Daniel Canter
2022-08-12 23:43:27 -07:00
parent a04268132e
commit 1f8db2467b
168 changed files with 3532 additions and 1131 deletions

View File

@@ -0,0 +1,45 @@
package log
import (
"github.com/Microsoft/hcsshim/internal/logfields"
"github.com/sirupsen/logrus"
"go.opencensus.io/trace"
)
// Hook serves to intercept and format `logrus.Entry`s before they are passed
// to the ETW hook.
//
// The containerd shim discards the (formatted) logrus output, and outputs only via ETW.
// The Linux GCS outputs logrus entries over stdout, which is consumed by the shim and
// then re-output via the ETW hook.
type Hook struct{}
var _ logrus.Hook = &Hook{}
func NewHook() *Hook {
return &Hook{}
}
func (h *Hook) Levels() []logrus.Level {
return logrus.AllLevels
}
func (h *Hook) Fire(e *logrus.Entry) (err error) {
h.addSpanContext(e)
return nil
}
func (h *Hook) addSpanContext(e *logrus.Entry) {
ctx := e.Context
if ctx == nil {
return
}
span := trace.FromContext(ctx)
if span == nil {
return
}
sctx := span.SpanContext()
e.Data[logfields.TraceID] = sctx.TraceID.String()
e.Data[logfields.SpanID] = sctx.SpanID.String()
}