summaryrefslogtreecommitdiff
path: root/vendor/github.com/Microsoft/hcsshim/internal/oc
diff options
context:
space:
mode:
authorTomSweeneyRedHat <tsweeney@redhat.com>2019-11-13 10:30:08 -0500
committerTomSweeneyRedHat <tsweeney@redhat.com>2019-11-13 10:57:19 -0500
commit6003033adae775f1d725b05231a246a4462ae669 (patch)
treec570c523df92c3c0fb4b704c5c45b0de6603b7d6 /vendor/github.com/Microsoft/hcsshim/internal/oc
parentde32b89eff0928abdef9d85a420b65d8865e737e (diff)
downloadpodman-6003033adae775f1d725b05231a246a4462ae669.tar.gz
podman-6003033adae775f1d725b05231a246a4462ae669.tar.bz2
podman-6003033adae775f1d725b05231a246a4462ae669.zip
Bump to Buildah v1.11.5
Bump to Buildah v1.11.5. Most notably changes to the podman build `--pull` functionality. `--pull=true` and `--pull=false` now work as Docker does, `--pull-never` added to supply the functionality of the old `--pull=false`. Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
Diffstat (limited to 'vendor/github.com/Microsoft/hcsshim/internal/oc')
-rw-r--r--vendor/github.com/Microsoft/hcsshim/internal/oc/exporter.go43
-rw-r--r--vendor/github.com/Microsoft/hcsshim/internal/oc/span.go17
2 files changed, 60 insertions, 0 deletions
diff --git a/vendor/github.com/Microsoft/hcsshim/internal/oc/exporter.go b/vendor/github.com/Microsoft/hcsshim/internal/oc/exporter.go
new file mode 100644
index 000000000..f428bdaf7
--- /dev/null
+++ b/vendor/github.com/Microsoft/hcsshim/internal/oc/exporter.go
@@ -0,0 +1,43 @@
+package oc
+
+import (
+ "github.com/sirupsen/logrus"
+ "go.opencensus.io/trace"
+)
+
+var _ = (trace.Exporter)(&LogrusExporter{})
+
+// LogrusExporter is an OpenCensus `trace.Exporter` that exports
+// `trace.SpanData` to logrus output.
+type LogrusExporter struct {
+}
+
+// ExportSpan exports `s` based on the the following rules:
+//
+// 1. All output will contain `s.Attributes`, `s.TraceID`, `s.SpanID`,
+// `s.ParentSpanID` for correlation
+//
+// 2. Any calls to .Annotate will not be supported.
+//
+// 3. The span itself will be written at `logrus.InfoLevel` unless
+// `s.Status.Code != 0` in which case it will be written at `logrus.ErrorLevel`
+// providing `s.Status.Message` as the error value.
+func (le *LogrusExporter) ExportSpan(s *trace.SpanData) {
+ // Combine all span annotations with traceID, spanID, parentSpanID
+ baseEntry := logrus.WithFields(logrus.Fields(s.Attributes))
+ baseEntry.Data["traceID"] = s.TraceID.String()
+ baseEntry.Data["spanID"] = s.SpanID.String()
+ baseEntry.Data["parentSpanID"] = s.ParentSpanID.String()
+ baseEntry.Data["startTime"] = s.StartTime
+ baseEntry.Data["endTime"] = s.EndTime
+ baseEntry.Data["duration"] = s.EndTime.Sub(s.StartTime).String()
+ baseEntry.Data["name"] = s.Name
+ baseEntry.Time = s.StartTime
+
+ level := logrus.InfoLevel
+ if s.Status.Code != 0 {
+ level = logrus.ErrorLevel
+ baseEntry.Data[logrus.ErrorKey] = s.Status.Message
+ }
+ baseEntry.Log(level, "Span")
+}
diff --git a/vendor/github.com/Microsoft/hcsshim/internal/oc/span.go b/vendor/github.com/Microsoft/hcsshim/internal/oc/span.go
new file mode 100644
index 000000000..fee4765cb
--- /dev/null
+++ b/vendor/github.com/Microsoft/hcsshim/internal/oc/span.go
@@ -0,0 +1,17 @@
+package oc
+
+import (
+ "go.opencensus.io/trace"
+)
+
+// SetSpanStatus sets `span.SetStatus` to the proper status depending on `err`. If
+// `err` is `nil` assumes `trace.StatusCodeOk`.
+func SetSpanStatus(span *trace.Span, err error) {
+ status := trace.Status{}
+ if err != nil {
+ // TODO: JTERRY75 - Handle errors in a non-generic way
+ status.Code = trace.StatusCodeUnknown
+ status.Message = err.Error()
+ }
+ span.SetStatus(status)
+}