< Summary - Kestrun — Combined Coverage

Information
Class: Kestrun.Health.VbScriptProbe
Assembly: Kestrun
File(s): /home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/Health/VbScriptProbe.cs
Tag: Kestrun/Kestrun@2d87023b37eb91155071c91dd3d6a2eeb3004705
Line coverage
0%
Covered lines: 0
Uncovered lines: 19
Coverable lines: 19
Total lines: 58
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 12
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 10/13/2025 - 16:52:37 Line coverage: 0% (0/19) Branch coverage: 0% (0/12) Total lines: 58 Tag: Kestrun/Kestrun@10d476bee71c71ad215bb8ab59f219887b5b4a5e 10/13/2025 - 16:52:37 Line coverage: 0% (0/19) Branch coverage: 0% (0/12) Total lines: 58 Tag: Kestrun/Kestrun@10d476bee71c71ad215bb8ab59f219887b5b4a5e

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)0%620%
CheckAsync()0%110100%

File(s)

/home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/Health/VbScriptProbe.cs

#LineLine coverage
 1using Kestrun.Languages;
 2using Kestrun.SharedState;
 3using SerilogLogger = Serilog.ILogger;
 4using Serilog.Events;
 5
 6namespace Kestrun.Health;
 7/// <summary>
 8/// A health probe implemented via a VB.NET script.
 9/// </summary>
 10/// <param name="name">The name of the probe.</param>
 11/// <param name="tags">The tags associated with the probe.</param>
 12/// <param name="runner">The script runner to execute the probe.</param>
 13/// <param name="locals">The local variables for the script.</param>
 14/// <param name="logger">The logger to use for logging.</param>
 15internal sealed class VbScriptProbe(
 16    string name,
 17    IEnumerable<string>? tags,
 18    Func<CsGlobals, Task<ProbeResult>> runner,
 19    IReadOnlyDictionary<string, object?>? locals,
 020    SerilogLogger logger) : Probe(name, tags, logger), IProbe
 21{
 22    /// <summary>
 23    /// The script runner to execute the probe.
 24    /// </summary>
 025    private readonly Func<CsGlobals, Task<ProbeResult>> _runner = runner ?? throw new ArgumentNullException(nameof(runne
 026    private readonly IReadOnlyDictionary<string, object?>? _locals = locals;
 27
 28    /// <inheritdoc/>
 29    public override async Task<ProbeResult> CheckAsync(CancellationToken ct = default)
 30    {
 031        var globals = _locals is { Count: > 0 }
 032            ? new CsGlobals(SharedStateStore.Snapshot(), _locals)
 033            : new CsGlobals(SharedStateStore.Snapshot());
 34        try
 35        {
 036            if (Logger.IsEnabled(LogEventLevel.Debug))
 37            {
 038                Logger.Debug("VbScriptProbe {Probe} executing", Name);
 39            }
 040            var result = await _runner(globals).WaitAsync(ct).ConfigureAwait(false)
 041                ?? new ProbeResult(ProbeStatus.Unhealthy, "Script returned null result");
 042            if (Logger.IsEnabled(LogEventLevel.Debug))
 43            {
 044                Logger.Debug("VbScriptProbe {Probe} completed status={Status}", Name, result.Status);
 45            }
 046            return result;
 47        }
 048        catch (OperationCanceledException) when (ct.IsCancellationRequested)
 49        {
 050            throw;
 51        }
 052        catch (Exception ex)
 53        {
 054            Logger.Error(ex, "VB.NET health probe {Probe} failed.", Name);
 055            return new ProbeResult(ProbeStatus.Unhealthy, $"Exception: {ex.Message}");
 56        }
 057    }
 58}