Skip to content

Commit b49ec4f

Browse files
authored
Merge pull request #11 from asteurer/bytes
doc: documenting how byte arrays are handled when converted to JSON
2 parents 64f871f + 4bb03a5 commit b49ec4f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

wit/types.wit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ interface types {
1414
///
1515
/// This corresponds with the `AnyValue` type defined in the [attribute spec](https://opentelemetry.io/docs/specs/otel/common/#anyvalue).
1616
/// Because WIT doesn't support recursive types, the data needs to be serialized. JSON is used as the encoding format.
17+
///
18+
/// Byte arrays require special encoding since JSON cannot distinguish them from number arrays.
19+
/// They are base64-encoded with a prefix that follows the Data URI RFC 2397 convention:
20+
/// `data:application/octet-stream;base64,<BASE64_ENCODED_BYTES>`
1721
type value = string;
1822

1923
/// An immutable representation of the entity producing telemetry as attributes.

0 commit comments

Comments
 (0)