opentelemetry-go icon indicating copy to clipboard operation
opentelemetry-go copied to clipboard

Support for attribute.ByteSlice to avoid invalid-UTF-8 issues in instrumentation

Open vmihailenco opened this issue 4 years ago • 4 comments

AFAIK there are multiple issues here:

  1. exporter is disconnected on marshaling errors which may hurt performance and cause data loss
  2. protobuf rejects strings with invalid UTF-8
  3. OpenTelemetry does not validate strings
  4. OpenTelemetry does not support []byte and using attribute.String("foo", string(bytes)) looks harmless enough, but it very likely produces an invalid UTF-8 string

Assuming protobuf is not going to change current behavior, OpenTelemetry probably should have some answer to this. At least, dropping the problematic span instead of disconnecting.

PS go2sky seem to have this problem too.

vmihailenco avatar Oct 21 '21 12:10 vmihailenco

The otlp supports a byte value:

https://github.com/open-telemetry/opentelemetry-proto-go/blob/139c123be3af14819da93c7c5225d4a56afd1f2f/otlp/common/v1/common.pb.go#L37-L57

A possible solution could be to add a ByteSlice value to the attributes package. The compatibility of this would need be investigated further though.

MrAlias avatar May 03 '22 17:05 MrAlias

This is a near-duplicate of #3021. Adjusting the title.

jmacd avatar Sep 09 '22 17:09 jmacd

Would anyone be opposed to me picking up this issue?

brendenehlers avatar Mar 19 '24 17:03 brendenehlers