Skip to content

bytes / Byte (uint8_t) arrays support #780

@maxgolov

Description

@maxgolov

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 or bin 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 of uint8_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-encoded string 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:apiCross language API specification issuerelease:after-gaNot required before GA release, and not going to work on before GAspec:protocolRelated to the specification/protocol directoryspec:resourceRelated to the specification/resource directoryspec:traceRelated to the specification/trace directorytriage:rejected:declined

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions