Add tests and implement StubBearer authentication for Signer endpoints
- Created SignerEndpointsTests to validate the SignDsse and VerifyReferrers endpoints. - Implemented StubBearerAuthenticationDefaults and StubBearerAuthenticationHandler for token-based authentication. - Developed ConcelierExporterClient for managing Trivy DB settings and export operations. - Added TrivyDbSettingsPageComponent for UI interactions with Trivy DB settings, including form handling and export triggering. - Implemented styles and HTML structure for Trivy DB settings page. - Created NotifySmokeCheck tool for validating Redis event streams and Notify deliveries.
This commit is contained in:
		@@ -7,14 +7,16 @@ internal static class CliMetrics
 | 
			
		||||
{
 | 
			
		||||
    private static readonly Meter Meter = new("StellaOps.Cli", "1.0.0");
 | 
			
		||||
 | 
			
		||||
    private static readonly Counter<long> ScannerDownloadCounter = Meter.CreateCounter<long>("stellaops.cli.scanner.download.count");
 | 
			
		||||
    private static readonly Counter<long> ScannerInstallCounter = Meter.CreateCounter<long>("stellaops.cli.scanner.install.count");
 | 
			
		||||
    private static readonly Counter<long> ScanRunCounter = Meter.CreateCounter<long>("stellaops.cli.scan.run.count");
 | 
			
		||||
    private static readonly Histogram<double> CommandDurationHistogram = Meter.CreateHistogram<double>("stellaops.cli.command.duration.ms");
 | 
			
		||||
 | 
			
		||||
    public static void RecordScannerDownload(string channel, bool fromCache)
 | 
			
		||||
        => ScannerDownloadCounter.Add(1, new KeyValuePair<string, object?>[]
 | 
			
		||||
        {
 | 
			
		||||
    private static readonly Counter<long> ScannerDownloadCounter = Meter.CreateCounter<long>("stellaops.cli.scanner.download.count");
 | 
			
		||||
    private static readonly Counter<long> ScannerInstallCounter = Meter.CreateCounter<long>("stellaops.cli.scanner.install.count");
 | 
			
		||||
    private static readonly Counter<long> ScanRunCounter = Meter.CreateCounter<long>("stellaops.cli.scan.run.count");
 | 
			
		||||
    private static readonly Counter<long> OfflineKitDownloadCounter = Meter.CreateCounter<long>("stellaops.cli.offline.kit.download.count");
 | 
			
		||||
    private static readonly Counter<long> OfflineKitImportCounter = Meter.CreateCounter<long>("stellaops.cli.offline.kit.import.count");
 | 
			
		||||
    private static readonly Histogram<double> CommandDurationHistogram = Meter.CreateHistogram<double>("stellaops.cli.command.duration.ms");
 | 
			
		||||
 | 
			
		||||
    public static void RecordScannerDownload(string channel, bool fromCache)
 | 
			
		||||
        => ScannerDownloadCounter.Add(1, new KeyValuePair<string, object?>[]
 | 
			
		||||
        {
 | 
			
		||||
            new("channel", channel),
 | 
			
		||||
            new("cache", fromCache ? "hit" : "miss")
 | 
			
		||||
        });
 | 
			
		||||
@@ -23,16 +25,29 @@ internal static class CliMetrics
 | 
			
		||||
        => ScannerInstallCounter.Add(1, new KeyValuePair<string, object?>[] { new("channel", channel) });
 | 
			
		||||
 | 
			
		||||
    public static void RecordScanRun(string runner, int exitCode)
 | 
			
		||||
        => ScanRunCounter.Add(1, new KeyValuePair<string, object?>[]
 | 
			
		||||
        {
 | 
			
		||||
            new("runner", runner),
 | 
			
		||||
            new("exit_code", exitCode)
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
    public static IDisposable MeasureCommandDuration(string command)
 | 
			
		||||
    {
 | 
			
		||||
        var start = DateTime.UtcNow;
 | 
			
		||||
        return new DurationScope(command, start);
 | 
			
		||||
        => ScanRunCounter.Add(1, new KeyValuePair<string, object?>[]
 | 
			
		||||
        {
 | 
			
		||||
            new("runner", runner),
 | 
			
		||||
            new("exit_code", exitCode)
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
    public static void RecordOfflineKitDownload(string kind, bool fromCache)
 | 
			
		||||
        => OfflineKitDownloadCounter.Add(1, new KeyValuePair<string, object?>[]
 | 
			
		||||
        {
 | 
			
		||||
            new("kind", string.IsNullOrWhiteSpace(kind) ? "unknown" : kind),
 | 
			
		||||
            new("cache", fromCache ? "hit" : "miss")
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
    public static void RecordOfflineKitImport(string? status)
 | 
			
		||||
        => OfflineKitImportCounter.Add(1, new KeyValuePair<string, object?>[]
 | 
			
		||||
        {
 | 
			
		||||
            new("status", string.IsNullOrWhiteSpace(status) ? "queued" : status)
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
    public static IDisposable MeasureCommandDuration(string command)
 | 
			
		||||
    {
 | 
			
		||||
        var start = DateTime.UtcNow;
 | 
			
		||||
        return new DurationScope(command, start);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private sealed class DurationScope : IDisposable
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user