Skip to content

[8.19](backport #44442) metricbeat: ensure event.duration field is not discarded on Windows #44454

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

Merged
merged 2 commits into from
May 23, 2025

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented May 23, 2025

Proposed commit message

Windows, starting with Go 1.23+, provides high-resolution timers, but the effective clock resolution remains around 0.5 ms. When event processing is very fast, the elapsed time between start and end timestamps may be less than this resolution, resulting in a diff of zero.

A zero event duration is interpreted as absence of value and discarded when setting event fields.

This commit ensures a minimum duration is set to preserve event.duration in the ingested event.

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.

How to test this PR locally

Related issues

…44442)

* metricbeat: ensure event.duration field is not discarded on Windows

Windows, starting with Go 1.23+, provides high-resolution timers, but the
effective clock resolution remains around 0.5 ms. When event processing is
very fast, the elapsed time between start and end may be below this
resolution, resulting in a zero duration.

A zero event duration is interpreted as absence of value and discarded when
setting event fields. This commit ensures a minimum duration is always set.

* linter fixes

* use rand.N

* add changelog

(cherry picked from commit 7839c6b)
@mergify mergify bot added the backport label May 23, 2025
@mergify mergify bot requested a review from a team as a code owner May 23, 2025 14:11
@mergify mergify bot requested review from rdner and mauri870 and removed request for a team May 23, 2025 14:11
@mergify mergify bot added the backport label May 23, 2025
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label May 23, 2025
@github-actions github-actions bot added bug Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team labels May 23, 2025
@elasticmachine
Copy link
Collaborator

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 May 23, 2025
@mauri870 mauri870 enabled auto-merge (squash) May 23, 2025 14:15
@mauri870 mauri870 merged commit 4817abc into 8.19 May 23, 2025
44 checks passed
@mauri870 mauri870 deleted the mergify/bp/8.19/pr-44442 branch May 23, 2025 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport bug 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