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

Need validation/debug logs for protobuf setters

Open VivekSubr opened this issue 6 months ago • 5 comments

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.

VivekSubr avatar Jun 20 '25 09:06 VivekSubr

Accepting this bug to improve logging.

Not sure if we can validate every UTF-8 strings, to investigate.

marcalff avatar Jun 30 '25 17:06 marcalff

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:

github-actions[bot] avatar Jun 30 '25 17:06 github-actions[bot]

This issue was marked as stale due to lack of activity.

github-actions[bot] avatar Aug 30 '25 02:08 github-actions[bot]

@open-telemetry/cpp-approvers This can be resolved by #3512, still waiting to be re reviewed.

owent avatar Aug 30 '25 05:08 owent

This issue was marked as stale due to lack of activity.

github-actions[bot] avatar Oct 30 '25 02:10 github-actions[bot]