[Exporter.Prometheus] Fix concurrency issue
Merged
MA
3mo ago+266+266+012345678901234567890123456789-94-94-01234567890123456789
Changes
Fix concurrency issue introduced by the fix in #7524. Now, instead of retrying under failed scrapes under contention, instead return an error.
A first attempt at fixing the issue made things work by introducing a deadlock, and the original fix that created this secondary issue was for a stack overflow, so at this point it's probably safer to fail faster if under high contention (which realistically shouldn't happen to a scrape endpoint?) and let the client itself retry.
Detected by test flakiness in #6899. This job took 6 attempts to pass - for some reason the bug is more apparent only when running under .NET 11.
Merge requirement checklist
- CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
- Unit tests added/updated
- Appropriate
CHANGELOG.mdfiles updated for non-trivial changes - Changes in public API reviewed (if applicable)