Skip to content

Commit 167bbfb

Browse files
author
rhamlett_microsoft
committed
Added Azure SKU to title bar
1 parent 2f086e0 commit 167bbfb

3 files changed

Lines changed: 55 additions & 19 deletions

File tree

src/PerfProblemSimulator/Controllers/AdminController.cs

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ public IActionResult GetStats()
141141
{
142142
ProcessorCount = Environment.ProcessorCount,
143143
WorkingSetBytes = Environment.WorkingSet,
144-
ManagedHeapBytes = GC.GetTotalMemory(forceFullCollection: false)
144+
ManagedHeapBytes = GC.GetTotalMemory(forceFullCollection: false),
145+
AzureSku = Environment.GetEnvironmentVariable("WEBSITE_SKU") ?? "Local",
146+
ComputeMode = Environment.GetEnvironmentVariable("WEBSITE_COMPUTE_MODE")
145147
}
146148
});
147149
}
@@ -276,23 +278,33 @@ public class ThreadPoolStats
276278
public long PendingWorkItems { get; init; }
277279
}
278280

279-
/// <summary>
280-
/// Process information statistics.
281-
/// </summary>
282-
public class ProcessStats
283-
{
284-
/// <summary>
285-
/// Number of processors available.
286-
/// </summary>
287-
public int ProcessorCount { get; init; }
288-
289281
/// <summary>
290-
/// Process working set in bytes.
282+
/// Process information statistics.
291283
/// </summary>
292-
public long WorkingSetBytes { get; init; }
293-
294-
/// <summary>
295-
/// Managed heap size in bytes.
296-
/// </summary>
297-
public long ManagedHeapBytes { get; init; }
298-
}
284+
public class ProcessStats
285+
{
286+
/// <summary>
287+
/// Number of processors available.
288+
/// </summary>
289+
public int ProcessorCount { get; init; }
290+
291+
/// <summary>
292+
/// Process working set in bytes.
293+
/// </summary>
294+
public long WorkingSetBytes { get; init; }
295+
296+
/// <summary>
297+
/// Managed heap size in bytes.
298+
/// </summary>
299+
public long ManagedHeapBytes { get; init; }
300+
301+
/// <summary>
302+
/// The Azure SKU (Pricing Tier) if running in Azure App Service (e.g., P0V3, Standard, Basic).
303+
/// </summary>
304+
public string? AzureSku { get; init; }
305+
306+
/// <summary>
307+
/// The compute mode (e.g., Dedicated, Shared).
308+
/// </summary>
309+
public string? ComputeMode { get; init; }
310+
}

src/PerfProblemSimulator/wwwroot/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<body>
1515
<header class="header">
1616
<h1>🔥 Performance Problem Simulator - .NET 10 on Windows</h1>
17+
<div id="skuDisplay" style="font-weight: bold; background: rgba(255,255,255,0.2); padding: 0.25rem 0.75rem; border-radius: 12px; font-size: 0.9em; display: none;">SKU: Loading...</div>
1718
<div style="display: flex; align-items: center; gap: 1.5rem;">
1819
<a href="https://github.com/rhamlett/PerfProblemSimulator-NETCore" target="_blank" style="color: white; text-decoration: none; padding: 0.5rem 1rem; background: rgba(255,255,255,0.1); border-radius: 4px; transition: background 0.15s ease;">🐙 GitHub</a>
1920
<a href="/azure-monitoring-guide.html" style="color: white; text-decoration: none; padding: 0.5rem 1rem; background: rgba(255,255,255,0.1); border-radius: 4px; transition: background 0.15s ease;">☁️ Azure Monitoring</a>

src/PerfProblemSimulator/wwwroot/js/dashboard.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,12 +1176,35 @@ function logEvent(level, message) {
11761176
// Initialization
11771177
// ==========================================================================
11781178

1179+
/**
1180+
* Fetches and displays the Azure SKU info.
1181+
*/
1182+
async function fetchAzureSku() {
1183+
try {
1184+
const response = await fetch(`${CONFIG.apiBaseUrl}/admin/stats`);
1185+
if (response.ok) {
1186+
const data = await response.json();
1187+
const skuElement = document.getElementById('skuDisplay');
1188+
if (skuElement && data.processInfo && data.processInfo.azureSku) {
1189+
skuElement.textContent = `SKU: ${data.processInfo.azureSku}`;
1190+
skuElement.style.display = 'block';
1191+
}
1192+
}
1193+
} catch (error) {
1194+
console.error('Failed to fetch Azure SKU', error);
1195+
}
1196+
}
1197+
11791198
document.addEventListener('DOMContentLoaded', () => {
11801199
// Initialize charts first
11811200
initializeCharts();
11821201

1202+
// Fetch SKU info
1203+
fetchAzureSku();
1204+
11831205
// Start SignalR connection
11841206
initializeSignalR();
1207+
11851208

11861209
// Wire up button handlers
11871210
document.getElementById('btnTriggerCpu').addEventListener('click', triggerCpuStress);

0 commit comments

Comments
 (0)