mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-10-23 05:04:07 +00:00
tracing: Make runtime span attributes more consistent
Span attributes (tags) are not consistent in runtime tracing, so designate and use core attributes such source, package, subsystem, and type as span metadata for more understandable output. Use WithAttributes() during span creation to reduce calls to SetAttributes(). Modify Trace() in katautils to accept slice of attributes so multiple functions using different attributes can use it. Fixes #1852 Signed-off-by: Chelsea Mafrica <chelsea.e.mafrica@intel.com>
This commit is contained in:
@@ -30,11 +30,7 @@ var virtLog = logrus.WithField("source", "virtcontainers")
|
||||
// context.
|
||||
func trace(parent context.Context, name string) (otelTrace.Span, context.Context) {
|
||||
tracer := otel.Tracer("kata")
|
||||
ctx, span := tracer.Start(parent, name)
|
||||
span.SetAttributes([]label.KeyValue{
|
||||
label.Key("source").String("virtcontainers"),
|
||||
label.Key("component").String("virtcontainers"),
|
||||
label.Key("subsystem").String("api")}...)
|
||||
ctx, span := tracer.Start(parent, name, otelTrace.WithAttributes(label.String("source", "runtime"), label.String("packages", "virtcontainers"), label.String("subsystem", "api")))
|
||||
|
||||
return span, ctx
|
||||
}
|
||||
|
Reference in New Issue
Block a user