-
Notifications
You must be signed in to change notification settings - Fork 930
Description
Current spec / protocol allows the following types:
bool
int32_t
int64_t
uint32_t
uint64_t
double
string (UTF-8, no UTF-16)
and
array
of above primitive types.
Proposal is to add support for '8-bit byte array' event properties for Traces and Logs:
Practical reasons
-
existing / legacy telemetry flows could already allow support for byte arrays.
-
8-bit byte array
orbin
type is available in MsgPack protocol. -
same type known in protobuf as
bytes
-
Most IoT protocols usually operate on 8-bit byte arrays or octet streams, allowing fields be either
uint8_t
or array / sequence ofuint8_t
, or the entire payload be 8-bit / octet stream. -
UUID or GUID type is best represented on SDK API surface and on wire as 16-bytes rather than 36+-character string, resulting in at least x2 times better performance for native (C/C++) code, as well as more compact net-bytes on wire. Although it may be possible to represent it as array of
int32_t
- it'd be a bit unnatural to do it. -
although it may be possible to convert
byte array
to base64-encodedstring
representation, this results in an extra encoding/decoding in SDK, elevated memory and CPU pressure, as well as type information (such as it's a binary blob, not a string) - is inherently lost.
Is it possible to add an optional provision to the protocol, that Platform SDKs that may require bin or octet stream or 8-bit byte array - may implement it on API surface?
Use-cases
Examples of exporters that would benefit from having byte array
in the protocol spec:
- ETW - Event Tracing for Windows supports both GUID (16-bytes) and other arbitrary Byte arrays.
- Other telemetry systems previously using byte arrays flow for more compact binary data representation.
Not having this type natively supported by OpenTelemetry would impede the adoption of OT API / SDK by customers currently relying on octet / binary streams in their data flows. A reference implementation can be provided based on Open Telemetry C++ SDK to illustrate the use-cases, as well as perf implications of not having native support for byte arrays in API/SDK/proto/specification.