Skip to content

Fix/race condition cel metrics#48321

Merged
StacieClark-Elastic merged 10 commits intoelastic:mainfrom
StacieClark-Elastic:fix/race-condition-cel-metrics
Jan 14, 2026
Merged

Fix/race condition cel metrics#48321
StacieClark-Elastic merged 10 commits intoelastic:mainfrom
StacieClark-Elastic:fix/race-condition-cel-metrics

Conversation

@StacieClark-Elastic
Copy link
Member

@StacieClark-Elastic StacieClark-Elastic commented Jan 7, 2026

Proposed commit message

A race condition in MetricsExporterFactory.GetExporter was not caught in race testing. Fixed the race condition and added test to verify fix.

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. Where relevant, I have used the stresstest.sh script to run them under stress conditions and race detector to verify their stability.
  • I have added an entry in ./changelog/fragments using the changelog tool.

Disruptive User Impact

None

How to test this PR locally

cd into beats/x-pack/filebeat
run: RACE_DETECTOR=true mage goUnitTest
No failures related to tests in beats/x-pack/filebeat/otel

Related issues

@StacieClark-Elastic StacieClark-Elastic self-assigned this Jan 7, 2026
@StacieClark-Elastic StacieClark-Elastic requested a review from a team as a code owner January 7, 2026 19:21
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jan 7, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 7, 2026

🤖 GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)
@mergify
Copy link
Contributor

mergify bot commented Jan 7, 2026

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @StacieClark-Elastic? 🙏.
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.
@pierrehilbert pierrehilbert added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Jan 8, 2026
@elasticmachine
Copy link
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 Jan 8, 2026
@pierrehilbert
Copy link
Contributor

@StacieClark-Elastic should we backport this bug fix?

Copy link
Member

@andrewkroh andrewkroh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for circling back and fixing the race.

@andrewkroh andrewkroh added the backport-9.3 Automated backport to the 9.3 branch label Jan 8, 2026
@StacieClark-Elastic StacieClark-Elastic requested a review from a team as a code owner January 8, 2026 18:08
@StacieClark-Elastic StacieClark-Elastic merged commit 990735b into elastic:main Jan 14, 2026
16 of 17 checks passed
mergify bot pushed a commit that referenced this pull request Jan 14, 2026
* fix/race-condition-cel-metrics Fixed a race condition in exporter_factory.go GetExporter that could cause too many exporter connections to be created. New test to catch race condition.

(cherry picked from commit 990735b)
pierrehilbert pushed a commit that referenced this pull request Jan 19, 2026
* fix/race-condition-cel-metrics Fixed a race condition in exporter_factory.go GetExporter that could cause too many exporter connections to be created. New test to catch race condition.

(cherry picked from commit 990735b)

Co-authored-by: Stacie Clark at Elastic <stacie.clark@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-9.3 Automated backport to the 9.3 branch bugfix Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team

5 participants