Skip to content

otel: fix conversion for []time.Duration fields#50486

Merged
mauri870 merged 4 commits into
mainfrom
fix-50474-otel-duration-slice-940bef7fbb62ac5b
May 6, 2026
Merged

otel: fix conversion for []time.Duration fields#50486
mauri870 merged 4 commits into
mainfrom
fix-50474-otel-duration-slice-940bef7fbb62ac5b

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented May 4, 2026

Summary

  • add explicit []time.Duration handling in libbeat/otel/otelmap/otelmap.go so each element is converted to int64
  • add TestFromMapstrSliceDuration to verify converted output and successful pcommon.Map.FromRaw conversion
  • add a changelog fragment under changelog/fragments/1777914810-fix-otel-duration-slice-conversion.yaml

Validation

  • go test ./libbeat/otel/otelmap

Related: #50474


What is this? | From workflow: Mention in Issue

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

Handle []time.Duration explicitly in otelmap.ConvertNonPrimitive by converting each element to int64, matching scalar time.Duration behavior and preventing dropped fields during pcommon.Map conversion. Add a unit test that validates both the converted value and successful pcommon.Map.FromRaw conversion, plus a changelog fragment.

Assisted-By: GitHub Copilot

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added the ai label May 4, 2026
@botelastic botelastic Bot added the needs_team Indicates that the issue/PR needs a Team:* label label May 4, 2026
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 4, 2026

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @github-actions[bot]? 🙏.
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 changed the title Fix OTel conversion for []time.Duration fields otel: fix conversion for []time.Duration fields May 4, 2026
@mauri870 mauri870 added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label May 4, 2026
@mauri870 mauri870 self-assigned this May 4, 2026
@botelastic botelastic Bot removed the needs_team Indicates that the issue/PR needs a Team:* label label May 4, 2026
@mauri870 mauri870 added backport-active-all Automated backport with mergify to all the active branches skip-changelog labels May 4, 2026
@mauri870 mauri870 marked this pull request as ready for review May 4, 2026 17:37
@mauri870 mauri870 requested a review from a team as a code owner May 4, 2026 17:37
@mauri870 mauri870 requested review from khushijain21 and mauri870 May 4, 2026 17:37
@infra-vault-gh-plugin-prod
Copy link
Copy Markdown

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

@mauri870
Copy link
Copy Markdown
Member

mauri870 commented May 4, 2026

/test

@github-actions
Copy link
Copy Markdown
Contributor Author

github-actions Bot commented May 4, 2026

TL;DR

The failed Buildkite step is an infrastructure/dependency failure during Docker image build, not a failure in the otelmap code change. mage goIntegTest stops while building the Kerberos test image when /scripts/installkdc.sh && /scripts/addprincs.sh exits with code 100.

Remediation

  • Re-run CI (/test) first; this failure is in package installation during image build and is often transient.
  • If it fails again, run docker compose -p libbeat_... build elasticsearch_kerberos.elastic and capture full apt output (remove -qq in the script for diagnostics) to identify the exact package/mirror error.
Investigation details

Root Cause

Build fails before tests run while building the Kerberos integration image used by libbeat integration tests:

  • libbeat/docker-compose.yml:62-64 builds testing/environments/docker/elasticsearch_kerberos
  • testing/environments/docker/elasticsearch_kerberos/Dockerfile:14 runs /scripts/installkdc.sh && /scripts/addprincs.sh
  • testing/environments/docker/elasticsearch_kerberos/scripts/installkdc.sh:48-49 executes apt update -qq and apt install -y krb5-kdc krb5-admin-server krb5-user sudo

The failing command in logs is exactly that Dockerfile RUN step, which indicates failure in that image provisioning path rather than in PR logic.

Evidence

failed to solve: process "/bin/sh -c /scripts/installkdc.sh && /scripts/addprincs.sh" did not complete successfully: exit code: 100
Error: running "docker compose -p libbeat_9_5_0_28ca915fb4-snapshot build" failed with exit code 17

The PR itself modifies libbeat/otel/otelmap/otelmap.go and libbeat/otel/otelmap/otelmap_test.go; these paths are not part of the failing Docker build path above.

Verification

  • Not run locally: this environment does not support Docker-in-Docker, so I could only perform log/code-path analysis.

Follow-up

If reruns keep failing on the same step, collect full apt error output from installkdc.sh and then pin or adjust the failing package/source in testing/environments/docker/elasticsearch_kerberos/scripts/installkdc.sh.


What is this? | From workflow: PR Buildkite Detective

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

@pierrehilbert
Copy link
Copy Markdown
Contributor

/test

@mauri870 mauri870 enabled auto-merge (squash) May 5, 2026 13:40
@mauri870 mauri870 merged commit ca37473 into main May 6, 2026
200 checks passed
@mauri870 mauri870 deleted the fix-50474-otel-duration-slice-940bef7fbb62ac5b branch May 6, 2026 14:24
@github-actions
Copy link
Copy Markdown
Contributor Author

github-actions Bot commented May 6, 2026

@Mergifyio backport 8.19 9.3 9.4

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 6, 2026

backport 8.19 9.3 9.4

✅ Backports have been created

Details

mauri870 added a commit that referenced this pull request May 6, 2026
Handle []time.Duration explicitly in otelmap.ConvertNonPrimitive by converting each element to int64, matching scalar time.Duration behavior and preventing dropped fields during pcommon.Map conversion. Add a unit test that validates both the converted value and successful pcommon.Map.FromRaw conversion, plus a changelog fragment.

Assisted-By: GitHub Copilot




(cherry picked from commit ca37473)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
mauri870 added a commit that referenced this pull request May 6, 2026
Handle []time.Duration explicitly in otelmap.ConvertNonPrimitive by converting each element to int64, matching scalar time.Duration behavior and preventing dropped fields during pcommon.Map conversion. Add a unit test that validates both the converted value and successful pcommon.Map.FromRaw conversion, plus a changelog fragment.

Assisted-By: GitHub Copilot




(cherry picked from commit ca37473)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
mauri870 added a commit that referenced this pull request May 6, 2026
Handle []time.Duration explicitly in otelmap.ConvertNonPrimitive by converting each element to int64, matching scalar time.Duration behavior and preventing dropped fields during pcommon.Map conversion. Add a unit test that validates both the converted value and successful pcommon.Map.FromRaw conversion, plus a changelog fragment.

Assisted-By: GitHub Copilot




(cherry picked from commit ca37473)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai backport-active-all Automated backport with mergify to all the active branches skip-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.

[bug-hunter] OTel conversion drops []time.Duration fields due unsupported element type

3 participants