From 3273e374cc51a542628bacf5f3054ca5792702ea Mon Sep 17 00:00:00 2001 From: itn3000 Date: Thu, 4 Nov 2021 18:24:56 +0900 Subject: [PATCH 1/2] fix unexpected TimeSeriesLimitReached after HistogramLimitReached(#60752) --- .../src/System/Diagnostics/Metrics/AggregationManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/AggregationManager.cs b/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/AggregationManager.cs index d181fbdf9a666..d38e6b6c8eefb 100644 --- a/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/AggregationManager.cs +++ b/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/AggregationManager.cs @@ -302,7 +302,7 @@ private void RemoveInstrumentState(Instrument instrument, InstrumentState state) { lock (this) { - return (!CheckTimeSeriesAllowed() || !CheckHistogramAllowed()) ? + return (!CheckHistogramAllowed() || !CheckTimeSeriesAllowed()) ? null : new ExponentialHistogramAggregator(s_defaultHistogramConfig); } From 473b717150ab745f2b806446577126205f83e115 Mon Sep 17 00:00:00 2001 From: itn3000 Date: Fri, 5 Nov 2021 13:33:05 +0900 Subject: [PATCH 2/2] add comment abount fix(#60752) --- .../src/System/Diagnostics/Metrics/AggregationManager.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/AggregationManager.cs b/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/AggregationManager.cs index d38e6b6c8eefb..aaf6cb6a20fe5 100644 --- a/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/AggregationManager.cs +++ b/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/AggregationManager.cs @@ -302,6 +302,7 @@ private void RemoveInstrumentState(Instrument instrument, InstrumentState state) { lock (this) { + // checking currentHistograms first because avoiding unexpected increment of TimeSeries count. return (!CheckHistogramAllowed() || !CheckTimeSeriesAllowed()) ? null : new ExponentialHistogramAggregator(s_defaultHistogramConfig);