File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
common4j/src/main/com/microsoft/identity/common/java/opentelemetry Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -304,12 +304,17 @@ class DefaultBenchmarkSpanPrinter(
304304
305305 val result = mutableListOf<StatisticalStatusData >()
306306
307+ // Precompute the number of occurrences for each status name
308+ val occurrenceCountsByName = statusOccurrencesMap.keys
309+ .groupBy { it.statusName }
310+ .mapValues { it.value.size }
311+
307312 for ((occurrence, timingPairs) in statusOccurrencesMap) {
308313 val timeSincePreviousValues = timingPairs.map { it.first }
309314 val timeSinceStartValues = timingPairs.map { it.second }
310315
311316 // Create display name with occurrence number if there are multiple occurrences
312- val displayName = if (statusOccurrencesMap.keys.count { it.statusName == occurrence.statusName } > 1 ) {
317+ val displayName = if ((occurrenceCountsByName[ occurrence.statusName] ? : 1 ) > 1 ) {
313318 " ${occurrence.statusName} [${occurrence.occurrenceIndex} ]"
314319 } else {
315320 occurrence.statusName
You can’t perform that action at this time.
0 commit comments