From b01dc21f6c118216bc62bdcd40086b5bc45ebdc3 Mon Sep 17 00:00:00 2001 From: yellow chicks Date: Fri, 11 Feb 2022 08:41:34 +0800 Subject: [PATCH] refactor: use Key's Defined method (#2593) * optimize(attribute): use Key's Defined method * Update kv.go --- attribute/kv.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/attribute/kv.go b/attribute/kv.go index 8f579338554..1ddf3ce0580 100644 --- a/attribute/kv.go +++ b/attribute/kv.go @@ -26,7 +26,7 @@ type KeyValue struct { // Valid returns if kv is a valid OpenTelemetry attribute. func (kv KeyValue) Valid() bool { - return kv.Key != "" && kv.Value.Type() != INVALID + return kv.Key.Defined() && kv.Value.Type() != INVALID } // Bool creates a KeyValue with a BOOL Value type.