mirror of
https://github.com/okieselbach/AutopilotMonitor.git
synced 2026-10-25 05:00:07 +00:00
Migrate GetAppMetrics, GetGlobalAppMetrics, TenantOffboard refinements
https://claude.ai/code/session_01NHWJfPaa8TQHuPzMD7gG63
This commit is contained in:
@@ -37,7 +37,7 @@ public class TenantOffboardFunction
|
||||
_logger = logger;
|
||||
_tenantAdminsService = tenantAdminsService;
|
||||
_globalAdminService = globalAdminService;
|
||||
_storageService = storageService;
|
||||
_maintenanceRepo = maintenanceRepo;
|
||||
var connectionString = configuration["AzureTableStorageConnectionString"];
|
||||
_tableServiceClient = new TableServiceClient(connectionString);
|
||||
}
|
||||
@@ -83,7 +83,7 @@ public class TenantOffboardFunction
|
||||
_logger.LogWarning($"TENANT OFFBOARD initiated for tenant {tenantId} by {upn}");
|
||||
|
||||
// Audit under Global TenantId so the entry survives tenant data deletion
|
||||
await _storageService.LogAuditEntryAsync(
|
||||
await _maintenanceRepo.LogAuditEntryAsync(
|
||||
Constants.AuditGlobalTenantId,
|
||||
"DELETE",
|
||||
"Tenant",
|
||||
@@ -150,7 +150,7 @@ public class TenantOffboardFunction
|
||||
details["Action"] = "Offboard";
|
||||
details["Phase"] = "Completed";
|
||||
details["TotalRowsDeleted"] = result.DeletedCounts.Values.Sum().ToString();
|
||||
await _storageService.LogAuditEntryAsync(
|
||||
await _maintenanceRepo.LogAuditEntryAsync(
|
||||
Constants.AuditGlobalTenantId,
|
||||
"DELETE",
|
||||
"Tenant",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Net;
|
||||
using AutopilotMonitor.Functions.Helpers;
|
||||
using AutopilotMonitor.Functions.Services;
|
||||
using AutopilotMonitor.Shared.DataAccess;
|
||||
using Microsoft.Azure.Functions.Worker;
|
||||
using Microsoft.Azure.Functions.Worker.Http;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@@ -10,12 +10,12 @@ namespace AutopilotMonitor.Functions.Functions.Metrics
|
||||
public class GetAppMetricsFunction
|
||||
{
|
||||
private readonly ILogger<GetAppMetricsFunction> _logger;
|
||||
private readonly TableStorageService _storageService;
|
||||
private readonly IMetricsRepository _metricsRepo;
|
||||
|
||||
public GetAppMetricsFunction(ILogger<GetAppMetricsFunction> logger, TableStorageService storageService)
|
||||
public GetAppMetricsFunction(ILogger<GetAppMetricsFunction> logger, IMetricsRepository metricsRepo)
|
||||
{
|
||||
_logger = logger;
|
||||
_storageService = storageService;
|
||||
_metricsRepo = metricsRepo;
|
||||
}
|
||||
|
||||
[Function("GetAppMetrics")]
|
||||
@@ -37,7 +37,7 @@ namespace AutopilotMonitor.Functions.Functions.Metrics
|
||||
|
||||
var cutoff = DateTime.UtcNow.AddDays(-days);
|
||||
|
||||
var allSummaries = await _storageService.GetAppInstallSummariesByTenantAsync(tenantId);
|
||||
var allSummaries = await _metricsRepo.GetAppInstallSummariesByTenantAsync(tenantId);
|
||||
var summaries = allSummaries.Where(s => s.StartedAt >= cutoff).ToList();
|
||||
|
||||
// Aggregate: slowest apps (avg duration) and top failing apps
|
||||
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
using System.Net;
|
||||
using AutopilotMonitor.Functions.Helpers;
|
||||
using AutopilotMonitor.Functions.Services;
|
||||
using AutopilotMonitor.Shared.DataAccess;
|
||||
using Microsoft.Azure.Functions.Worker;
|
||||
using Microsoft.Azure.Functions.Worker.Http;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@@ -10,14 +10,14 @@ namespace AutopilotMonitor.Functions.Functions.Metrics
|
||||
public class GetGlobalAppMetricsFunction
|
||||
{
|
||||
private readonly ILogger<GetGlobalAppMetricsFunction> _logger;
|
||||
private readonly TableStorageService _storageService;
|
||||
private readonly IMetricsRepository _metricsRepo;
|
||||
|
||||
public GetGlobalAppMetricsFunction(
|
||||
ILogger<GetGlobalAppMetricsFunction> logger,
|
||||
TableStorageService storageService)
|
||||
IMetricsRepository metricsRepo)
|
||||
{
|
||||
_logger = logger;
|
||||
_storageService = storageService;
|
||||
_metricsRepo = metricsRepo;
|
||||
}
|
||||
|
||||
[Function("GetGlobalAppMetrics")]
|
||||
@@ -39,7 +39,7 @@ namespace AutopilotMonitor.Functions.Functions.Metrics
|
||||
|
||||
var cutoff = DateTime.UtcNow.AddDays(-days);
|
||||
|
||||
var allSummaries = await _storageService.GetAllAppInstallSummariesAsync();
|
||||
var allSummaries = await _metricsRepo.GetAllAppInstallSummariesAsync();
|
||||
var summaries = allSummaries.Where(s => s.StartedAt >= cutoff).ToList();
|
||||
|
||||
var appGroups = summaries.GroupBy(s => s.AppName).Select(g =>
|
||||
|
||||
Reference in New Issue
Block a user