Skip to content

otelmap: handle conversion of struct types#45234

Merged
mauri870 merged 1 commit intoelastic:mainfrom
mauri870:otelmap-struct
Jul 8, 2025
Merged

otelmap: handle conversion of struct types#45234
mauri870 merged 1 commit intoelastic:mainfrom
mauri870:otelmap-struct

Conversation

@mauri870
Copy link
Copy Markdown
Member

@mauri870 mauri870 commented Jul 8, 2025

Proposed commit message

The otelmap package does not handle struct types properly, the convertion of a struct results in a string error.

To follow the libbeat behavior, handle struct types the same way, by serializing to json and back, resulting in a map of keys and values.

We have plans to try and extend otelmap to use the libbeat generic serializer, but that is part of a large refactor that should be done in a separate PR.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Related issues

@mauri870 mauri870 requested a review from a team as a code owner July 8, 2025 12:03
@botelastic botelastic Bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jul 8, 2025
@mauri870 mauri870 self-assigned this Jul 8, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jul 8, 2025

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@mauri870 mauri870 added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Jul 8, 2025
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@botelastic botelastic Bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jul 8, 2025
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Jul 8, 2025

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @mauri870? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-8./d is the label to automatically backport to the 8./d branch. /d is the digit
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.

@mauri870 mauri870 added backport-active-9 Automated backport with mergify to all the active 9.[0-9]+ branches backport-8.19 Automated backport to the 8.19 branch cleanup labels Jul 8, 2025
The otelmap package does not handle struct types properly, the
convertion of a struct results in a string error.

To follow the libbeat behavior, handle struct types the same way, by
serializing to json and back, resulting in a map of keys and values.
@mauri870 mauri870 merged commit 2685f9c into elastic:main Jul 8, 2025
204 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jul 8, 2025

@Mergifyio backport 9.0 9.1

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Jul 8, 2025

backport 9.0 9.1

✅ Backports have been created

Details

mergify Bot pushed a commit that referenced this pull request Jul 8, 2025
The otelmap package does not handle struct types properly, the
convertion of a struct results in a string error.

To follow the libbeat behavior, handle struct types the same way, by
serializing to json and back, resulting in a map of keys and values.

(cherry picked from commit 2685f9c)
mergify Bot pushed a commit that referenced this pull request Jul 8, 2025
The otelmap package does not handle struct types properly, the
convertion of a struct results in a string error.

To follow the libbeat behavior, handle struct types the same way, by
serializing to json and back, resulting in a map of keys and values.

(cherry picked from commit 2685f9c)
mergify Bot pushed a commit that referenced this pull request Jul 8, 2025
The otelmap package does not handle struct types properly, the
convertion of a struct results in a string error.

To follow the libbeat behavior, handle struct types the same way, by
serializing to json and back, resulting in a map of keys and values.

(cherry picked from commit 2685f9c)
mauri870 added a commit that referenced this pull request Jul 8, 2025
The otelmap package does not handle struct types properly, the
convertion of a struct results in a string error.

To follow the libbeat behavior, handle struct types the same way, by
serializing to json and back, resulting in a map of keys and values.

(cherry picked from commit 2685f9c)

Co-authored-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
mauri870 added a commit that referenced this pull request Jul 8, 2025
The otelmap package does not handle struct types properly, the
convertion of a struct results in a string error.

To follow the libbeat behavior, handle struct types the same way, by
serializing to json and back, resulting in a map of keys and values.

(cherry picked from commit 2685f9c)

Co-authored-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
mauri870 added a commit that referenced this pull request Jul 8, 2025
The otelmap package does not handle struct types properly, the
convertion of a struct results in a string error.

To follow the libbeat behavior, handle struct types the same way, by
serializing to json and back, resulting in a map of keys and values.

(cherry picked from commit 2685f9c)

Co-authored-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
@khushijain21
Copy link
Copy Markdown
Contributor

We have plans to try and extend otelmap to use the libbeat generic serializer, but that is part of a large refactor that should be done in a separate PR.

Should we have an issue tracking this?

@mauri870
Copy link
Copy Markdown
Member Author

Should we have an issue tracking this?

More likely, yes. I want to confirm if it is feasible first. When I did a first take on this I found lots of little discrepancies between the current otelmap and the libbeat generic serializer. If we are bound to change libbeat serializer to get the same behavior then it's not worth it, as we risk breaking standalone beats.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-8.19 Automated backport to the 8.19 branch backport-active-9 Automated backport with mergify to all the active 9.[0-9]+ branches cleanup Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[OTel] Data Serialization fails on struct types

4 participants