Need validation/debug logs for protobuf setters
Describe your environment Not related to env, any new version of otel-cpp
Steps to reproduce Export span with non utf-8 attribute.
We have a large system with hundreds of traces per second, and see intermittent error logs due to non utf-8 attributes.
[libprotobuf ERROR google/protobuf/wire_format_lite.cc:577] String field 'opentelemetry.proto.trace.v1.Span.Event.name' contains invalid UTF-8 data when serializing a protocol buffer. Use the 'bytes' type if you intend to send raw bytes.
But it's very hard to root cause this, to help in these cases we believe otel-cpp should add validations/debug logs for at least set_string_value here: https://github.com/open-telemetry/opentelemetry-cpp/blob/9708acb694deb260beccb8578378bedcbbfbb1a8/exporters/otlp/src/otlp_populate_attribute_utils.cc#L41
Currently there are no checks for any of the setter functions return values and what otel-cpp does is just discard the attribute that errored and export the rest.
Accepting this bug to improve logging.
Not sure if we can validate every UTF-8 strings, to investigate.
This issue is available for anyone to work on. Make sure to reference this issue in your pull request. :sparkles: Thank you for your contribution! :sparkles:
This issue was marked as stale due to lack of activity.
@open-telemetry/cpp-approvers This can be resolved by #3512, still waiting to be re reviewed.
This issue was marked as stale due to lack of activity.