summaryrefslogtreecommitdiff
path: root/vendor/github.com/Microsoft/hcsshim/internal/oc/span.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/Microsoft/hcsshim/internal/oc/span.go')
-rw-r--r--vendor/github.com/Microsoft/hcsshim/internal/oc/span.go17
1 files changed, 17 insertions, 0 deletions
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)
+}