feat: Add initial implementation of Vulnerability Resolver Jobs
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled

- Created project for StellaOps.Scanner.Analyzers.Native.Tests with necessary dependencies.
- Documented roles and guidelines in AGENTS.md for Scheduler module.
- Implemented IResolverJobService interface and InMemoryResolverJobService for handling resolver jobs.
- Added ResolverBacklogNotifier and ResolverBacklogService for monitoring job metrics.
- Developed API endpoints for managing resolver jobs and retrieving metrics.
- Defined models for resolver job requests and responses.
- Integrated dependency injection for resolver job services.
- Implemented ImpactIndexSnapshot for persisting impact index data.
- Introduced SignalsScoringOptions for configurable scoring weights in reachability scoring.
- Added unit tests for ReachabilityScoringService and RuntimeFactsIngestionService.
- Created dotnet-filter.sh script to handle command-line arguments for dotnet.
- Established nuget-prime project for managing package downloads.
This commit is contained in:
master
2025-11-18 07:52:15 +02:00
parent e69b57d467
commit 8355e2ff75
299 changed files with 13293 additions and 2444 deletions

View File

@@ -0,0 +1,63 @@
using System.Diagnostics.Metrics;
using System.Linq;
using FluentAssertions;
using StellaOps.Findings.Ledger.Observability;
using Xunit;
namespace StellaOps.Findings.Ledger.Tests.Observability;
public class LedgerMetricsTests
{
[Fact]
public void RecordProjectionApply_emits_histogram_and_counter_with_tags()
{
var histogramValues = new List<Measurement<double>>();
var counterValues = new List<Measurement<long>>();
using var listener = new MeterListener
{
InstrumentPublished = (instrument, l) =>
{
if (instrument.Meter.Name == "StellaOps.Findings.Ledger")
{
l.EnableMeasurementEvents(instrument);
}
}
};
listener.SetMeasurementEventCallback<double>((instrument, measurement, _) =>
{
if (instrument.Name is "ledger_projection_apply_seconds" or "ledger_projection_lag_seconds")
{
histogramValues.Add(measurement);
}
});
listener.SetMeasurementEventCallback<long>((instrument, measurement, _) =>
{
if (instrument.Name == "ledger_projection_events_total")
{
counterValues.Add(measurement);
}
});
listener.Start();
LedgerMetrics.RecordProjectionApply(
TimeSpan.FromMilliseconds(40),
1.2,
"tenant-x",
"finding.status.changed",
"v1.0",
"affected");
histogramValues.Should().NotBeEmpty();
counterValues.Should().NotBeEmpty();
var tags = histogramValues.First().Tags.ToDictionary(kv => kv.Key, kv => kv.Value?.ToString());
tags["tenant"].Should().Be("tenant-x");
tags["event_type"].Should().Be("finding.status.changed");
tags["policy_version"].Should().Be("v1.0");
tags["evaluation_status"].Should().Be("affected");
}
}