Skip to content

Commit ee87f59

Browse files
author
rhamlett_microsoft
committed
Another fix for latency chart
1 parent 4e929d3 commit ee87f59

2 files changed

Lines changed: 17 additions & 10 deletions

File tree

src/PerfProblemSimulator/wwwroot/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ <h3>🧵 Thread Pool Activity</h3>
9191
<section class="latency-section">
9292
<h2>⏱️ Request Latency Monitor</h2>
9393
<p class="info-text">Measures response time to a lightweight probe endpoint. During thread pool starvation, latency increases dramatically.</p>
94-
<!--
94+
9595
<div class="latency-stats">
9696
<div class="latency-stat current">
9797
<div class="latency-label">Current</div>

src/PerfProblemSimulator/wwwroot/js/dashboard.js

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -466,30 +466,37 @@ function addLatencyToHistory(timestamp, latencyMs, isTimeout, isError) {
466466
}
467467

468468
/**
469-
* Update the latency stat displays.
469+
* Update the latency stat displays (if present).
470470
*/
471471
function updateLatencyDisplay(currentLatency, isTimeout, isError) {
472472
const history = state.latencyHistory;
473473

474-
// Current latency with color coding
474+
// Current latency with color coding (check if element exists)
475475
const currentEl = document.getElementById('latencyCurrent');
476-
currentEl.textContent = formatLatency(currentLatency);
477-
currentEl.className = `latency-value ${getLatencyClass(currentLatency, isTimeout)}`;
476+
if (currentEl) {
477+
currentEl.textContent = formatLatency(currentLatency);
478+
currentEl.className = `latency-value ${getLatencyClass(currentLatency, isTimeout)}`;
479+
}
478480

479481
// Calculate average
480-
if (history.values.length > 0) {
482+
const avgEl = document.getElementById('latencyAverage');
483+
if (avgEl && history.values.length > 0) {
481484
const avg = history.values.reduce((a, b) => a + b, 0) / history.values.length;
482-
document.getElementById('latencyAverage').textContent = formatLatency(avg);
485+
avgEl.textContent = formatLatency(avg);
483486
}
484487

485488
// Calculate max
486-
if (history.values.length > 0) {
489+
const maxEl = document.getElementById('latencyMax');
490+
if (maxEl && history.values.length > 0) {
487491
const max = Math.max(...history.values);
488-
document.getElementById('latencyMax').textContent = formatLatency(max);
492+
maxEl.textContent = formatLatency(max);
489493
}
490494

491495
// Update timeout count
492-
document.getElementById('latencyTimeouts').textContent = state.latencyStats.timeoutCount;
496+
const timeoutsEl = document.getElementById('latencyTimeouts');
497+
if (timeoutsEl) {
498+
timeoutsEl.textContent = state.latencyStats.timeoutCount;
499+
}
493500
}
494501

495502
/**

0 commit comments

Comments
 (0)