runtime: tracing: Change method for adding tags

In later versions of OpenTelemetry label.Any() is deprecated. Create
addTag() to handle type assertions of values. Change AddTag() to
variadic function that accepts multiple keys and values.

Fixes #2547

Signed-off-by: Chelsea Mafrica <chelsea.e.mafrica@intel.com>
This commit is contained in:
Chelsea Mafrica
2021-09-10 15:01:31 -07:00
parent f611785fdc
commit 09d5d8836b
7 changed files with 93 additions and 26 deletions

View File

@@ -35,8 +35,7 @@ func hookLogger() *logrus.Entry {
func runHook(ctx context.Context, hook specs.Hook, cid, bundlePath string) error {
span, _ := katatrace.Trace(ctx, hookLogger(), "runHook", hookTracingTags)
defer span.End()
katatrace.AddTag(span, "path", hook.Path)
katatrace.AddTag(span, "args", hook.Args)
katatrace.AddTags(span, "path", hook.Path, "args", hook.Args)
state := specs.State{
Pid: syscall.Gettid(),
@@ -93,7 +92,7 @@ func runHook(ctx context.Context, hook specs.Hook, cid, bundlePath string) error
func runHooks(ctx context.Context, hooks []specs.Hook, cid, bundlePath, hookType string) error {
span, ctx := katatrace.Trace(ctx, hookLogger(), "runHooks", hookTracingTags)
katatrace.AddTag(span, "type", hookType)
katatrace.AddTags(span, "type", hookType)
defer span.End()
for _, hook := range hooks {