mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-10-22 20:39:41 +00:00
tracing: Create trace function
Simplify code slightly be creating a `trace()` function. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
This commit is contained in:
@@ -76,3 +76,14 @@ func stopTracing(ctx context.Context) {
|
||||
// report all possible spans to the collector
|
||||
tracerCloser.Close()
|
||||
}
|
||||
|
||||
// trace creates a new tracing span based on the specified name and parent
|
||||
// context.
|
||||
func trace(parent context.Context, name string) (opentracing.Span, context.Context) {
|
||||
span, ctx := opentracing.StartSpanFromContext(parent, name)
|
||||
|
||||
span.SetTag("source", "runtime")
|
||||
span.SetTag("component", "cli")
|
||||
|
||||
return span, ctx
|
||||
}
|
||||
|
Reference in New Issue
Block a user