You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-11-29 23:07:45 +02:00
Add non-empty string check for attribute keys (#1659)
* Fixes #1657 Add non-empty string check for attribute keys * Update PR number in changelog * Update CHANGELOG.md Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com> * Update sdk/trace/span.go Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com> Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
This commit is contained in:
@@ -491,7 +491,9 @@ func (s *span) copyToCappedAttributes(attributes ...attribute.KeyValue) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
for _, a := range attributes {
|
||||
if a.Value.Type() != attribute.INVALID {
|
||||
// Ensure attributes conform to the specification:
|
||||
// https://github.com/open-telemetry/opentelemetry-specification/blob/v1.0.1/specification/common/common.md#attributes
|
||||
if a.Value.Type() != attribute.INVALID && a.Key != "" {
|
||||
s.attributes.add(a)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user