Skip to content

Commit

Permalink
[Core] Protect Traces against null metadatas or tags
Browse files Browse the repository at this point in the history
  • Loading branch information
NPi2Loup committed Apr 30, 2024
1 parent 25d812e commit 6b7e1c0
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ public TraceSpanBuilder withMetadata(final String name, final String value) {
.isNotNull(name, "metadata name is required")
.isNotNull(value, "metadata value is required");
//---------------------------------------------------------------------
metadatas.put(name, value);
if (value.isBlank()) {
metadatas.remove(name);
} else {
metadatas.put(name, value);
}
return this;
}

Expand All @@ -142,7 +146,11 @@ public TraceSpanBuilder withTag(final String name, final String value) {
.isNotNull(name, "tag name is required")
.isNotNull(value, "tag value is required");
//---
tags.put(name, value);
if (value.isBlank()) {
tags.remove(name);
} else {
tags.put(name, value);
}
return this;
}

Expand Down

0 comments on commit 6b7e1c0

Please sign in to comment.