Skip to content

[OTel] Convert []any-nested mapstr.M#45076

Merged
pickypg merged 1 commit intomainfrom
otel/cast-with-assignment
Jun 26, 2025
Merged

[OTel] Convert []any-nested mapstr.M#45076
pickypg merged 1 commit intomainfrom
otel/cast-with-assignment

Conversation

@pickypg
Copy link
Copy Markdown
Member

@pickypg pickypg commented Jun 26, 2025

This adds the reflective capture of mapstr.M in addition to map[string]any for []any.

I noticed, at runtime, the cat_shards metricset produces mapstr.M in a nested array even though the autoops_es code does not produce it that way, libbeat does:

case reflect.Map, reflect.Struct:
var m mapstr.M
err := marshalUnmarshal(value, &m)
if err != nil {
return m, []error{fmt.Errorf("key=%v: error converting %T to mapstr.M: %w", joinKeys(keys...), value, err)}
}
return m, nil

Proposed commit message

Convert inner slice/array mapstr.M to map[string]any.

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.

Disruptive User Impact

None. This improves compatibility.

Author's Checklist

  • Validate tests.

How to test this PR locally

Run the Elastic Agent with autoops_es

Related issues

This adds the reflective capture of `mapstr.M` in addition to
`map[string]any` for `[]any`.
@pickypg pickypg self-assigned this Jun 26, 2025
@pickypg pickypg requested a review from a team as a code owner June 26, 2025 19:00
@pickypg pickypg added backport-skip Skip notification from the automated backport with mergify Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team backport-9.0 Automated backport to the 9.0 branch labels Jun 26, 2025
@pickypg pickypg added backport-8.19 Automated backport to the 8.19 branch backport-9.1 Automated backport to the 9.1 branch labels Jun 26, 2025
@botelastic botelastic Bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jun 26, 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 Jun 26, 2025
@github-actions
Copy link
Copy Markdown
Contributor

🤖 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!)

@pickypg pickypg enabled auto-merge (squash) June 26, 2025 19:00
@pickypg pickypg merged commit 8d191b7 into main Jun 26, 2025
204 checks passed
@pickypg pickypg deleted the otel/cast-with-assignment branch June 26, 2025 22:11
mergify Bot pushed a commit that referenced this pull request Jun 26, 2025
This adds the reflective capture of `mapstr.M` in addition to
`map[string]any` for `[]any`.

(cherry picked from commit 8d191b7)
mergify Bot pushed a commit that referenced this pull request Jun 26, 2025
This adds the reflective capture of `mapstr.M` in addition to
`map[string]any` for `[]any`.

(cherry picked from commit 8d191b7)

# Conflicts:
#	libbeat/otelbeat/otelmap/otelmap.go
#	libbeat/otelbeat/otelmap/otelmap_test.go
mergify Bot pushed a commit that referenced this pull request Jun 26, 2025
This adds the reflective capture of `mapstr.M` in addition to
`map[string]any` for `[]any`.

(cherry picked from commit 8d191b7)

# Conflicts:
#	libbeat/otelbeat/otelmap/otelmap.go
#	libbeat/otelbeat/otelmap/otelmap_test.go
pickypg added a commit that referenced this pull request Jun 27, 2025
This adds the reflective capture of `mapstr.M` in addition to
`map[string]any` for `[]any`.

(cherry picked from commit 8d191b7)

Co-authored-by: Chris Earle <pickypg@users.noreply.github.com>
pickypg added a commit that referenced this pull request Jun 27, 2025
This adds the reflective capture of `mapstr.M` in addition to
`map[string]any` for `[]any`.
pickypg added a commit that referenced this pull request Jun 27, 2025
This adds the reflective capture of `mapstr.M` in addition to
`map[string]any` for `[]any`.
pickypg added a commit that referenced this pull request Jun 27, 2025
This adds the reflective capture of `mapstr.M` in addition to
`map[string]any` for `[]any`.

Co-authored-by: Chris Earle <pickypg@users.noreply.github.com>
pickypg added a commit that referenced this pull request Jun 27, 2025
This adds the reflective capture of `mapstr.M` in addition to
`map[string]any` for `[]any`.

Co-authored-by: Chris Earle <pickypg@users.noreply.github.com>
@pickypg pickypg removed the backport-skip Skip notification from the automated backport with mergify label Jun 28, 2025
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-9.0 Automated backport to the 9.0 branch backport-9.1 Automated backport to the 9.1 branch release-note:skip The PR should be ignored when processing the changelog 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.

3 participants