Skip to content

Support type bytes for OTLP AnyValue encoding #4118

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

Closed
lzchen opened this issue Aug 12, 2024 · 6 comments · Fixed by #4128
Closed

Support type bytes for OTLP AnyValue encoding #4118

lzchen opened this issue Aug 12, 2024 · 6 comments · Fixed by #4128
Assignees
Labels

Comments

@lzchen
Copy link
Contributor

lzchen commented Aug 12, 2024

Is your feature request related to a problem?

Proto definition of AnyValue supports bytes values. Our current encoding logic doesn't support this yet.

Describe the solution you'd like

Add support in encoding logic for bytes type.

Describe alternatives you've considered

No response

Additional Context

No response

Would you like to implement a fix?

None

@lzchen lzchen mentioned this issue Aug 12, 2024
10 tasks
@wasup-yash
Copy link
Contributor

wasup-yash commented Aug 14, 2024

we just need a check right in OTLP as we have for other types in proto ?

@lzchen
Copy link
Contributor Author

lzchen commented Aug 15, 2024

@wasup-yash

Yeah should be the only thing that is needed.

@wasup-yash
Copy link
Contributor

@wasup-yash

Yeah should be the only thing that is needed.

ok creating a PR for it as a draft first

@dimaqq
Copy link
Contributor

dimaqq commented Mar 4, 2025

Unfortunately, the #4218 alone is not enough.

The bytes-valued attributes are coerced to strings way before they reach the exporter.

It happens here:

def _clean_attribute_value(
value: types.AttributeValue, limit: Optional[int]
) -> Optional[types.AttributeValue]:
if value is None:
return None
if isinstance(value, bytes):
try:
value = value.decode()
except UnicodeDecodeError:
_logger.warning("Byte attribute could not be decoded.")
return None

What would be better to reopen this issue or create a new one?

dimaqq added a commit to dimaqq/otlp-json that referenced this issue Mar 4, 2025
@xrmx
Copy link
Contributor

xrmx commented Mar 4, 2025

@dimaqq please open a new one, referencing this

@dimaqq
Copy link
Contributor

dimaqq commented Mar 5, 2025

Sure, #4460

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants