fix: adicionando logs
All checks were successful
BCards Deployment Pipeline / Run Tests (push) Successful in 3s
BCards Deployment Pipeline / PR Validation (push) Has been skipped
BCards Deployment Pipeline / Build and Push Image (push) Successful in 15m50s
BCards Deployment Pipeline / Deploy to Production (ARM - OCI) (push) Successful in 2m26s
BCards Deployment Pipeline / Deploy to Staging (x86 - Local) (push) Has been skipped
BCards Deployment Pipeline / Cleanup Old Resources (push) Has been skipped
BCards Deployment Pipeline / Deployment Summary (push) Successful in 0s

This commit is contained in:
Ricardo Carneiro 2025-09-10 09:53:29 -03:00
parent 77a20d3f37
commit 0387df1994

View File

@ -164,6 +164,18 @@ public class HealthController : ControllerBase
_logger.LogInformation("Uptime Kuma health check: {Status} in {Duration}ms",
response.status, stopwatch.ElapsedMilliseconds);
var memoryMB = Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0, 2);
var uptimeMinutes = (DateTime.UtcNow - Process.GetCurrentProcess().StartTime).TotalMinutes;
_logger.LogInformation("[HEALTH] Memory: {memoryBytes} MemoryMB: {memoryMB} ThreadPool: {threadPool} ProcessId: {processId} ActiveConnections: {activeConnections} UptimeMinutes: {uptimeMinutes}",
GC.GetTotalMemory(false),
memoryMB,
ThreadPool.ThreadCount,
Process.GetCurrentProcess().Id,
HttpContext.Connection?.Id ?? "null",
Math.Round(uptimeMinutes, 1));
return Ok(response);
}
catch (Exception ex)
@ -229,7 +241,22 @@ public class HealthController : ControllerBase
}
var entry = healthReport.Entries.First().Value;
_logger.LogInformation("[HEALTH_CHECK] Service: {serviceName} Status: {status} Duration: {duration} ResponseTime: {responseTime} Timestamp: {timestamp} Data: {data}",
serviceName,
entry.Status.ToString().ToLower(),
entry.Duration.TotalMilliseconds,
stopwatch.ElapsedMilliseconds,
DateTime.UtcNow,
entry.Data != null ? string.Join(", ", entry.Data.Select(d => $"{d.Key}:{d.Value}")) : "none");
if (entry.Exception != null)
{
_logger.LogError("[HEALTH_CHECK] Service: {serviceName} Status: {status} Duration: {duration} Error: {error} Exception: {exception}",
serviceName, entry.Status.ToString().ToLower(), stopwatch.ElapsedMilliseconds,
entry.Exception.Message, entry.Exception.ToString());
}
var response = new
{
service = serviceName,