GNMON-001 M3.5 Fix: Label-Values-Parsing und Circuit-Crash im Log-Browser
Lokis /label/<name>/values antwortet mit dem Array direkt unter data,
nicht als {data:{values:[...]}} — der Parser warf InvalidOperationException,
die den Live-Tail-Loop still toetete (0 Treffer ohne Fehlermeldung) und
ueber den verworfenen Task des Aktualisieren-Buttons den kompletten
Circuit abschoss. Parser korrigiert; Refresh-Button als echter async
Handler mit eigenem Catch; Loop-Tick mit breitem Catch und sichtbarer
Fehlernote statt dem stillen Tod.
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
value="@_search" @onchange="OnSearchChanged" />
|
||||
</div>
|
||||
<button class="@(_live ? "btn-active" : "")" @onclick="ToggleLive">@(_live ? "II Pause" : "▶ Live-Tail")</button>
|
||||
<button @onclick="() => _ = RefreshAsync(_cts?.Token ?? default)">↻ Aktualisieren</button>
|
||||
<button @onclick="OnManualRefreshAsync">↻ Aktualisieren</button>
|
||||
</div>
|
||||
|
||||
<div class="panel log-panel">
|
||||
@@ -89,10 +89,27 @@
|
||||
_live = !_live;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Manual refresh must never throw into the circuit: the discarded
|
||||
/// task in the onclick handler killed the circuit on errors (found
|
||||
/// 04.11.2026).
|
||||
/// </summary>
|
||||
private async Task OnManualRefreshAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
await RefreshAsync(_cts?.Token ?? default);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
catch (Exception ex) when (ex is not OperationCanceledException)
|
||||
{
|
||||
_error = $"{ex.GetType().Name}: {ex.Message}";
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task RunLoopAsync(CancellationToken ct)
|
||||
{
|
||||
// Der erste Lauf laedt Filter und Eintraege; danach fragt der
|
||||
// Live-Tail alle 3 Sekunden ab.
|
||||
try
|
||||
{
|
||||
await RefreshAsync(ct);
|
||||
@@ -106,7 +123,14 @@
|
||||
}
|
||||
if (_live)
|
||||
{
|
||||
await RefreshAsync(ct);
|
||||
try
|
||||
{
|
||||
await RefreshAsync(ct);
|
||||
}
|
||||
catch (Exception ex) when (ex is not OperationCanceledException)
|
||||
{
|
||||
_error = $"{ex.GetType().Name}: {ex.Message}";
|
||||
}
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,9 @@ public sealed class LokiClient
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the known values of a label (e.g. "unit") for filters.
|
||||
/// Returns the known values of a label (e.g. "syslog_identifier")
|
||||
/// for filters. The label values endpoint answers with the array
|
||||
/// directly under "data" (not nested in an object).
|
||||
/// </summary>
|
||||
public async Task<IReadOnlyList<string>> GetLabelValuesAsync(
|
||||
string label, CancellationToken ct)
|
||||
@@ -86,10 +88,12 @@ public sealed class LokiClient
|
||||
{
|
||||
return values;
|
||||
}
|
||||
foreach (var value in doc.RootElement
|
||||
.GetProperty("data")
|
||||
.GetProperty("values")
|
||||
.EnumerateArray())
|
||||
var data = doc.RootElement.GetProperty("data");
|
||||
if (data.ValueKind != JsonValueKind.Array)
|
||||
{
|
||||
return values;
|
||||
}
|
||||
foreach (var value in data.EnumerateArray())
|
||||
{
|
||||
values.Add(value.GetString() ?? "");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user