From 603d3964123f5b07dab10952b0c714712a152b26 Mon Sep 17 00:00:00 2001 From: yellow chicks Date: Wed, 9 Feb 2022 10:45:19 +0800 Subject: [PATCH 1/2] optimize(attribute): use Key's Defined method --- attribute/kv.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/attribute/kv.go b/attribute/kv.go index 8f579338554..7666f0662ea 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 n kv.Key.Defined() && kv.Value.Type() != INVALID } // Bool creates a KeyValue with a BOOL Value type. From e3b45c56b26fff30b494da0ead2aa8b3244352e8 Mon Sep 17 00:00:00 2001 From: yellow chicks Date: Wed, 9 Feb 2022 10:46:06 +0800 Subject: [PATCH 2/2] 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 7666f0662ea..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 n kv.Key.Defined() && kv.Value.Type() != INVALID + return kv.Key.Defined() && kv.Value.Type() != INVALID } // Bool creates a KeyValue with a BOOL Value type.