Skip to content

Commit b01dc21

Browse files
authored
refactor: use Key's Defined method (#2593)
* optimize(attribute): use Key's Defined method * Update kv.go
1 parent 010ca4f commit b01dc21

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

attribute/kv.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ type KeyValue struct {
2626

2727
// Valid returns if kv is a valid OpenTelemetry attribute.
2828
func (kv KeyValue) Valid() bool {
29-
return kv.Key != "" && kv.Value.Type() != INVALID
29+
return kv.Key.Defined() && kv.Value.Type() != INVALID
3030
}
3131

3232
// Bool creates a KeyValue with a BOOL Value type.

0 commit comments

Comments
 (0)