-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[pkg/ottl] Decode function for decoding []byte based on a configured text encoding #32493
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
We opted via #31543 to not make a generic |
The problem I am trying to solve starts with the Azure receiver outputting bytes. If you decode the output, you get human readable json that is perfectly usable. The problem is that OTEL does not offer the ability to decode []byte into anything useful. Previously I asked to have the Azure Event Hub receiver output something human readable #32382, however it was explained that any receiver could output bytes, therefore the decode ability should live somewhere else. |
Typically I'd agree on having targeted functions but I think in this case you're just basically moving a parameter into the function name and therefore causing bloat in the function set as well as friction while trying to add support for each encoding. In pkg/stanza, the decode functionality has been pretty straightforward and stable. I don't see any discussion on #31543 regarding how bloat or edge cases would be problematic. Can you elaborate on this? |
My fear was that we'd end up needing to decode something that would take more parameters than just the encoding name. Maybe that fear is unwarranted? I see that Stanza supports these options, all as single parameters, which makes me feel better about adding a general @djaglowski is there a reason stanza doesn't support base64 decoding in that list? If my fear of edge-case parameters is off-base I'd support deprecating Base64Decode in favor of a generic function. The Converter has not existed for very long, so now is the time to do it. /cc @evan-bradley |
Thanks for considering @TylerHelmuth.
Not that I know of, just seems to have never been requested. I'm surprised it isn't listed in the |
I see that Go's implementation for base64 encode includes We could also build that into a generic |
Yeah, exactly. It's just a matter of articulating the strings and corresponding
I can't promise there won't ever be edge cases but the |
If @evan-bradley agrees, I am ok moving forward with this direction. |
I was mostly worried about adding complexity through per-encoding optional parameters. If we're reasonably confident we can keep |
This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
hi, I would like to look into implementing this. CC @evan-bradley |
My ideal would be a filelog configuration that detects the Windows UTF16 header and converts it to UTF8 on the fly to "normalize" with other log file data. This header is detected by Emacs and displays in a human readable display: |
**Description:** This PR adds a `Decode` function that accepts a string or byte array, and a encoding name as an input and transforms it to UTF-8 **Link to tracking Issue:** #32493 **Testing:** Added unit and e2e tests **Documentation:** Added an entry in the readme to describe the new function --------- Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com> Co-authored-by: Daniel Jaglowski <jaglows3@gmail.com>
**Description:** This PR adds a `Decode` function that accepts a string or byte array, and a encoding name as an input and transforms it to UTF-8 **Link to tracking Issue:** open-telemetry#32493 **Testing:** Added unit and e2e tests **Documentation:** Added an entry in the readme to describe the new function --------- Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com> Co-authored-by: Daniel Jaglowski <jaglows3@gmail.com>
Component(s)
pkg/ottl
Is your feature request related to a problem? Please describe.
Log receivers can output raw bytes (See Azure Event Hub). OTTL does not have the ability to parse these bytes into something human readable.
Describe the solution you'd like
A functionality similar to pkg/stanza/decode, which can take string or []byte input, and output it in a human readable format using a configured encoding (ascii, utf-8, etc).
Describe alternatives you've considered
Additional context
No response
The text was updated successfully, but these errors were encountered: