-
Couldn't load subscription status.
- Fork 33
fix: concurrency issues in Metrics #1001
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
Conversation
- Replace LINQ FirstOrDefault with thread-safe iteration in Metrics.cs and MetricDirective.cs - Change CustomMetadata from Dictionary to ConcurrentDictionary in Metadata.cs - Add comprehensive concurrency tests with proper cleanup - Fix IndexOutOfRangeException and InvalidOperationException in multi-threaded scenarios - Maintain backward compatibility and performance
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #1001 +/- ##
===========================================
- Coverage 77.89% 77.80% -0.09%
===========================================
Files 287 287
Lines 11444 11647 +203
Branches 1346 1391 +45
===========================================
+ Hits 8914 9062 +148
- Misses 2099 2133 +34
- Partials 431 452 +21 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…odification issues
|



Issue number: #1000
Summary
Fixes concurrency issues in the Metrics utility that were causing
IndexOutOfRangeExceptionandInvalidOperationExceptionin multi-threaded environments.Issues Fixed
FirstOrDefaultoperations were failing when collections were modified concurrentlyCustomMetadatadictionary was not thread-safe, causingIndexOutOfRangeExceptionduring concurrent accessChanges Made
Core Fixes
GetExistingMetrichelper methods inMetrics.csandMetricDirective.csthat use traditional for-loops instead ofFirstOrDefaultCustomMetadatafromDictionary<string, object>toConcurrentDictionary<string, object>inMetadata.csArgumentOutOfRangeExceptionduring concurrent collection modificationsUser experience
Checklist
Please leave checklist items unchecked if they do not apply to your change.
Is this a breaking change?
RFC issue number:
Checklist:
Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.