fix unexpected TimeSeriesLimitReached after HistogramLimitReached(#60752) (#61199)
authorYusuke Ito <itn3000@gmail.com>
Fri, 5 Nov 2021 22:06:52 +0000 (07:06 +0900)
committerGitHub <noreply@github.com>
Fri, 5 Nov 2021 22:06:52 +0000 (15:06 -0700)
src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/AggregationManager.cs

index d181fbd..aaf6cb6 100644 (file)
@@ -302,7 +302,8 @@ namespace System.Diagnostics.Metrics
                 {
                     lock (this)
                     {
-                        return (!CheckTimeSeriesAllowed() || !CheckHistogramAllowed()) ?
+                        // checking currentHistograms first because avoiding unexpected increment of TimeSeries count.
+                        return (!CheckHistogramAllowed() || !CheckTimeSeriesAllowed()) ?
                             null :
                             new ExponentialHistogramAggregator(s_defaultHistogramConfig);
                     }