Steve
Steve
The race condition is still present and need more work. I'm converting it to draft for now.
Now it's ready for review. /cc: @reyang @robertcoltheart @vishweshbankwar @CodeBlanch
Done.
I pushed a new commit to simplify the code, and resolved another race condition due to the bad exchange of `this.collectionTcs`. The test `PrometheusExporterMiddlewareIntegration_MultipleRequestsOfDifferentFormatsInParallel` now passed with even 100,000,000 requests...
> @hez2010 - Could you elaborate what was the race condition? We are neither using `lock (obj)` nor inserting a memory barrier around `this.collectionTcs = ...`, so it can sometimes...
Seems that I accidentally broke the cache. Working on a fix.
It turns out to be an invalid assert in the test.
> This issue would surface even without any of these changes? Meaning, if we just run the test with single value passed [here](https://github.com/open-telemetry/opentelemetry-dotnet/blob/3ee60675d2e01d94c056514bd728877aacaaf564/test/OpenTelemetry.Exporter.Prometheus.AspNetCore.Tests/PrometheusExporterMiddlewareTests.cs#L271) Yes. My newly added test sometimes never...
All things should work expected now. PTAL.
I can separate this PR into two parts as you mentioned, but the tests will gonna fail without the fix for the concurrency issue (I think you may have noticed...