Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revise support for UTF-8-valid string truncation #3160

Closed
jmacd opened this issue Sep 9, 2022 · 1 comment
Closed

Revise support for UTF-8-valid string truncation #3160

jmacd opened this issue Sep 9, 2022 · 1 comment
Labels
enhancement New feature or request pkg:attribute Related to the attribute package
Milestone

Comments

@jmacd
Copy link
Contributor

jmacd commented Sep 9, 2022

Problem Statement

As discussed in open-telemetry/opentelemetry-specification#3421, we currently do not have clarity from the specification for how to implement correct truncation when string-valued attributes exceed the specified limits, and yet the OTLP protobuf encoding requires valid UTF-8.

While #3156 offered a quick fix meant to alleviate the pain for users, this deserves careful consideration. It is possible to implement an O(1) truncation, if that is desired, although even with UTF-8-correct truncation, users can still enter invalid UTF-8 that we have not specified how to handle.

Proposed Solution

In the next release cycle (after 1.10.x), consider either faster support with less validation (i.e., an O(1) truncation approach) or a more-comprehensive approach to validation (i.e., ensure valid UTF-8 for all strings, not only truncated attribute values).

Alternatives

Discussed in open-telemetry/opentelemetry-specification#3421

@jmacd jmacd added the enhancement New feature or request label Sep 9, 2022
@jmacd
Copy link
Contributor Author

jmacd commented Sep 14, 2022

I asked the OTel-Java group how this is handled. Because the Java String.substring() method counts UTF-8 characters, I believe it matches the behavior introduced in #3156.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pkg:attribute Related to the attribute package
Projects
None yet
Development

No branches or pull requests

3 participants