1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-03-29 21:47:00 +02:00

refactor: use Key's Defined method (#2593)

* optimize(attribute): use Key's Defined method

* Update kv.go
This commit is contained in:
yellow chicks 2022-02-11 08:41:34 +08:00 committed by GitHub
parent 010ca4f2b1
commit b01dc21f6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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.