Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,13 @@ private static void addValue(AttributesBuilder builder, String key, AnyValue val
} else if (value.array_value != null) {
addArray(builder, key, value.array_value);
} else {
throw new UnsupportedOperationException();
// Until we have complex attribute types that could potentially yield
// empty objects, we MUST assume here that the writer put an empty string
// into the value of the attribute. This will need to change later, when complex
// types arrive and the spec issue is resolved.
//
// See spec issue: https://github.com/open-telemetry/opentelemetry-specification/issues/4660
builder.put(AttributeKey.stringKey(key), "");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ void verifyMapping() {
Attributes attributes =
Attributes.builder()
.put(AttributeKey.stringKey("someString"), "someValue")
.put(AttributeKey.stringKey("emptyString"), "")
.put(AttributeKey.booleanKey("someBool"), true)
.put(AttributeKey.longKey("someLong"), 10L)
.put(AttributeKey.doubleKey("someDouble"), 10.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public final class TestData {
.put("conditions", false, true)
.put("scores", 0L, 1L)
.put("coins", 0.01, 0.05, 0.1)
.put("empty", "")
.put("blank", " ")
.build();

public static final Resource RESOURCE_FULL =
Expand Down
Loading