Fix/race condition cel metrics#48321
Merged
StacieClark-Elastic merged 10 commits intoelastic:mainfrom Jan 14, 2026
Merged
Conversation
…tory.go GetExporter. Wrote a test to catch race condition then fixed the condition
Contributor
🤖 GitHub commentsJust comment with:
|
Contributor
|
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
Contributor
|
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
Contributor
|
@StacieClark-Elastic should we backport this bug fix? |
mauri870
reviewed
Jan 8, 2026
changelog/fragments/1764199697-fix-race-condition-exporter-factory.yaml
Outdated
Show resolved
Hide resolved
mauri870
reviewed
Jan 8, 2026
andrewkroh
reviewed
Jan 8, 2026
Member
andrewkroh
left a comment
There was a problem hiding this comment.
Thanks for circling back and fixing the race.
…ch race condition without the -race flag. Changed the way defer is called in GetExporter
mauri870
approved these changes
Jan 13, 2026
andrewkroh
reviewed
Jan 13, 2026
andrewkroh
approved these changes
Jan 13, 2026
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)
6 tasks
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
stresstest.shscript to run them under stress conditions and race detector to verify their stability../changelog/fragmentsusing 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