mirror of
https://github.com/okieselbach/AutopilotMonitor.git
synced 2026-10-24 12:42:38 +00:00
better debug logging
This commit is contained in:
@@ -9,7 +9,10 @@
|
||||
"Bash(.claude/commands/scripts/query-appinsights.sh \"traces | where timestamp between \\(datetime\\(2026-03-28T03:53:45Z\\) .. datetime\\(2026-03-28T03:53:55Z\\)\\) | project timestamp, message, severityLevel | order by timestamp asc | take 50\" PT1H)",
|
||||
"Bash(.claude/commands/scripts/query-appinsights.sh \"traces | where timestamp > datetime\\(2026-03-28T03:53:00Z\\) | where message startswith ''Executed'' | extend status = iif\\(message contains ''Succeeded'', ''Succeeded'', ''Failed''\\) | summarize total=count\\(\\), failed=countif\\(status == ''Failed''\\) by operation_Name | where failed > 0 | order by failed desc\" PT1H)",
|
||||
"Bash(echo \"exit: $?\")",
|
||||
"mcp__autopilot-monitor__list_blocked_devices"
|
||||
"mcp__autopilot-monitor__list_blocked_devices",
|
||||
"mcp__autopilot-monitor__query_backend_logs",
|
||||
"mcp__autopilot-monitor__query_table",
|
||||
"mcp__autopilot-monitor__list_tables"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
688
|
||||
690
|
||||
|
||||
@@ -241,7 +241,23 @@ public class AuthenticationMiddleware : IFunctionsWorkerMiddleware
|
||||
if (!string.IsNullOrEmpty(oid))
|
||||
{
|
||||
var normalizedEndpoint = EndpointNormalizer.Normalize(requestPath);
|
||||
_ = Task.Run(() => RecordUserUsageAsync(oid, upn ?? "unknown", tid ?? "", normalizedEndpoint));
|
||||
// Capture references for fire-and-forget closure (repo + logger are singletons, safe to capture)
|
||||
var repo = _userUsageRepo;
|
||||
var logger = _logger;
|
||||
var capturedOid = oid;
|
||||
var capturedUpn = upn ?? "unknown";
|
||||
var capturedTid = tid ?? "";
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
await repo.IncrementUsageAsync(capturedOid, capturedUpn, capturedTid, normalizedEndpoint);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogWarning(ex, "[Auth Middleware] Failed to record usage: user={UserId}, endpoint={Endpoint}", capturedOid, normalizedEndpoint);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user