feat: improve admin observability and translation-first summaries

This commit is contained in:
cesnimda
2026-03-22 21:37:30 +01:00
parent 8014c1e890
commit 4c49ffb0d6
8 changed files with 585 additions and 261 deletions
@@ -16,6 +16,9 @@ namespace JobTrackerApi.Services
public sealed record SummarizerMetrics(
bool Healthy,
string? Model,
string? Device,
bool? GpuAvailable,
string? GpuName,
double? HealthLatencyMs,
double? ProbeLatencyMs,
DateTimeOffset? LastProbeAt,
@@ -216,6 +219,9 @@ namespace JobTrackerApi.Services
{
var client = _httpFactory.CreateClient("summarizer");
string? model = null;
string? device = null;
bool? gpuAvailable = null;
string? gpuName = null;
double? healthLatencyMs = null;
var healthy = false;
string? healthError = null;
@@ -236,6 +242,21 @@ namespace JobTrackerApi.Services
{
model = modelEl.GetString();
}
if (doc.RootElement.TryGetProperty("device", out var deviceEl))
{
device = deviceEl.GetString();
}
if (doc.RootElement.TryGetProperty("gpu_available", out var gpuAvailableEl) && gpuAvailableEl.ValueKind is JsonValueKind.True or JsonValueKind.False)
{
gpuAvailable = gpuAvailableEl.GetBoolean();
}
if (doc.RootElement.TryGetProperty("gpu_name", out var gpuNameEl))
{
gpuName = gpuNameEl.GetString();
}
}
else
{
@@ -283,6 +304,9 @@ namespace JobTrackerApi.Services
return new SummarizerMetrics(
Healthy: healthy,
Model: model,
Device: device,
GpuAvailable: gpuAvailable,
GpuName: gpuName,
HealthLatencyMs: healthLatencyMs,
ProbeLatencyMs: probeLatencyMs,
LastProbeAt: lastProbeAt,