Fix build and code structure improvements. New but essential UI functionality. CI improvements. Documentation improvements. AI module improvements.
This commit is contained in:
@@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using StellaOps.TestKit;
|
||||
using Xunit;
|
||||
|
||||
namespace StellaOps.Telemetry.Core.Tests;
|
||||
@@ -218,8 +219,7 @@ public sealed class AsyncResumeTestHarness
|
||||
using (accessor.CreateScope(new TelemetryContext { TenantId = "await-test" }))
|
||||
{
|
||||
capturedBefore = accessor.Context?.TenantId;
|
||||
using StellaOps.TestKit;
|
||||
await Task.Delay(10).ConfigureAwait(false);
|
||||
await Task.Delay(10);
|
||||
capturedAfter = accessor.Context?.TenantId;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using StellaOps.TestKit;
|
||||
using Xunit;
|
||||
|
||||
namespace StellaOps.Telemetry.Core.Tests;
|
||||
@@ -223,7 +224,6 @@ public sealed class CliTelemetryContextTests
|
||||
using (CliTelemetryContext.Initialize(accessor, tenantId: "explicit-tenant"))
|
||||
{
|
||||
var context = accessor.Context;
|
||||
using StellaOps.TestKit;
|
||||
Assert.NotNull(context);
|
||||
Assert.Equal("explicit-tenant", context.TenantId);
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<!-- Override repo defaults to keep telemetry tests self-contained -->
|
||||
<UseConcelierTestInfra>false</UseConcelierTestInfra>
|
||||
<ConcelierTestingPath></ConcelierTestingPath>
|
||||
<ConcelierSharedTestsPath></ConcelierSharedTestsPath>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1,27 +0,0 @@
|
||||
<Project>
|
||||
<!-- Prevent global plugin/test copy targets from firing for telemetry tests -->
|
||||
<Target Name="DisablePluginCopyTargets" BeforeTargets="ConcelierCopyPluginArtifacts;AuthorityCopyPluginArtifacts;NotifyCopyPluginArtifacts;ScannerCopyBuildxPluginArtifacts;ScannerCopyOsAnalyzerPluginArtifacts;ScannerCopyLangAnalyzerPluginArtifacts">
|
||||
<PropertyGroup>
|
||||
<ConcelierPluginOutputRoot></ConcelierPluginOutputRoot>
|
||||
<AuthorityPluginOutputRoot></AuthorityPluginOutputRoot>
|
||||
<NotifyPluginOutputRoot></NotifyPluginOutputRoot>
|
||||
<ScannerBuildxPluginOutputRoot></ScannerBuildxPluginOutputRoot>
|
||||
<ScannerOsAnalyzerPluginOutputRoot></ScannerOsAnalyzerPluginOutputRoot>
|
||||
<ScannerLangAnalyzerPluginOutputRoot></ScannerLangAnalyzerPluginOutputRoot>
|
||||
<IsConcelierPlugin>false</IsConcelierPlugin>
|
||||
<IsAuthorityPlugin>false</IsAuthorityPlugin>
|
||||
<IsNotifyPlugin>false</IsNotifyPlugin>
|
||||
<IsScannerBuildxPlugin>false</IsScannerBuildxPlugin>
|
||||
<IsScannerOsAnalyzerPlugin>false</IsScannerOsAnalyzerPlugin>
|
||||
<IsScannerLangAnalyzerPlugin>false</IsScannerLangAnalyzerPlugin>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ConcelierPluginArtifacts Remove="@(ConcelierPluginArtifacts)" />
|
||||
<AuthorityPluginArtifacts Remove="@(AuthorityPluginArtifacts)" />
|
||||
<NotifyPluginArtifacts Remove="@(NotifyPluginArtifacts)" />
|
||||
<ScannerBuildxPluginArtifacts Remove="@(ScannerBuildxPluginArtifacts)" />
|
||||
<ScannerOsAnalyzerPluginArtifacts Remove="@(ScannerOsAnalyzerPluginArtifacts)" />
|
||||
<ScannerLangAnalyzerPluginArtifacts Remove="@(ScannerLangAnalyzerPluginArtifacts)" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.Metrics;
|
||||
@@ -179,7 +179,6 @@ public sealed class GoldenSignalMetricsTests : IDisposable
|
||||
};
|
||||
using var metrics = new GoldenSignalMetrics(options);
|
||||
|
||||
using StellaOps.TestKit;
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
metrics.IncrementRequests(1, GoldenSignalMetrics.Tag("unique_id", $"id-{i}"));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -480,7 +480,6 @@ public sealed class IncidentModeServiceTests : IDisposable
|
||||
using var service = CreateService(opt =>
|
||||
{
|
||||
opt.Enabled = false;
|
||||
using StellaOps.TestKit;
|
||||
});
|
||||
|
||||
var result = await service.ActivateFromConfigAsync();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Diagnostics.Metrics;
|
||||
using Microsoft.Extensions.Options;
|
||||
using StellaOps.Telemetry.Core;
|
||||
using StellaOps.TestKit;
|
||||
|
||||
public class MetricLabelGuardTests
|
||||
{
|
||||
@@ -43,7 +44,6 @@ public class MetricLabelGuardTests
|
||||
|
||||
var guard = new MetricLabelGuard(options);
|
||||
using var meter = new Meter("test");
|
||||
using StellaOps.TestKit;
|
||||
var histogram = meter.CreateHistogram<double>("request.duration");
|
||||
|
||||
histogram.RecordRequestDuration(guard, 42, "verylongroute", "GET", "200", "ok");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Xunit;
|
||||
using Xunit;
|
||||
|
||||
|
||||
using StellaOps.TestKit;
|
||||
@@ -25,7 +25,6 @@ public sealed class ProofCoverageMetricsTests
|
||||
{
|
||||
using var metrics = new ProofCoverageMetrics();
|
||||
|
||||
using StellaOps.TestKit;
|
||||
metrics.RecordScanCoverage(
|
||||
tenantId: "tenant-1",
|
||||
surfaceId: "surface-1",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@@ -253,7 +253,6 @@ public sealed class SealedModeFileExporterTests : IDisposable
|
||||
using var exporter = CreateExporter(opt =>
|
||||
{
|
||||
opt.MaxBytes = 50;
|
||||
using StellaOps.TestKit;
|
||||
opt.MaxRotatedFiles = 2;
|
||||
});
|
||||
exporter.Initialize();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
@@ -347,7 +347,6 @@ public sealed class SealedModeTelemetryServiceTests : IDisposable
|
||||
public void RecordDriftEvent_DoesNotThrow()
|
||||
{
|
||||
using var service = CreateService(opt => opt.Enabled = true);
|
||||
using StellaOps.TestKit;
|
||||
var endpoint = new Uri("https://collector.example.com");
|
||||
|
||||
// Should not throw
|
||||
|
||||
@@ -5,8 +5,11 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<IsPackable>false</IsPackable>
|
||||
<IsTestProject>true</IsTestProject>
|
||||
<!-- Opt out of Concelier test infra to avoid pulling large cross-module graph -->
|
||||
<UseConcelierTestInfra>false</UseConcelierTestInfra>
|
||||
<ConcelierTestingPath></ConcelierTestingPath>
|
||||
<ConcelierSharedTestsPath></ConcelierSharedTestsPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -17,11 +20,11 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.0" />
|
||||
<PackageReference Include="Moq" Version="4.20.70" />
|
||||
<PackageReference Include="xunit" Version="2.9.2" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
||||
<PackageReference Include="Moq" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" >
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -31,7 +34,6 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Using Include="Xunit" />
|
||||
<Using Include="StellaOps.TestKit" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Threading.Tasks;
|
||||
using StellaOps.TestKit;
|
||||
using Xunit;
|
||||
|
||||
namespace StellaOps.Telemetry.Core.Tests;
|
||||
@@ -78,7 +79,6 @@ public sealed class TelemetryContextAccessorTests
|
||||
using (accessor.CreateScope(scopeContext))
|
||||
{
|
||||
Assert.Same(scopeContext, accessor.Context);
|
||||
using StellaOps.TestKit;
|
||||
}
|
||||
|
||||
Assert.Null(accessor.Context);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics;
|
||||
using Xunit;
|
||||
|
||||
|
||||
@@ -80,7 +80,6 @@ public sealed class TelemetryContextTests
|
||||
public void TraceId_ReturnsActivityTraceId_WhenActivityExists()
|
||||
{
|
||||
using var activity = new Activity("test-operation");
|
||||
using StellaOps.TestKit;
|
||||
activity.Start();
|
||||
|
||||
var context = new TelemetryContext();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using StellaOps.AirGap.Policy;
|
||||
@@ -49,7 +49,6 @@ public sealed class TelemetryExporterGuardTests
|
||||
var provider = new CollectingLoggerProvider();
|
||||
using var loggerFactory = LoggerFactory.Create(builder => builder.AddProvider(provider));
|
||||
|
||||
using StellaOps.TestKit;
|
||||
var guard = new TelemetryExporterGuard(loggerFactory.CreateLogger<TelemetryExporterGuard>(), policy);
|
||||
var descriptor = new TelemetryServiceDescriptor("PolicyEngine", "1.2.3");
|
||||
var collectorOptions = new StellaOpsTelemetryOptions.CollectorOptions
|
||||
@@ -92,7 +91,7 @@ using StellaOps.TestKit;
|
||||
_entries = entries;
|
||||
}
|
||||
|
||||
public IDisposable BeginScope<TState>(TState state) => NullScope.Instance;
|
||||
public IDisposable BeginScope<TState>(TState state) where TState : notnull => NullScope.Instance;
|
||||
|
||||
public bool IsEnabled(LogLevel logLevel) => true;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Net;
|
||||
using System.Net.Http;
|
||||
using Microsoft.Extensions.Options;
|
||||
using StellaOps.Telemetry.Core;
|
||||
using StellaOps.TestKit;
|
||||
|
||||
public class TelemetryPropagationHandlerTests
|
||||
{
|
||||
@@ -46,7 +47,6 @@ public class TelemetryPropagationHandlerTests
|
||||
|
||||
using var activity = new Activity("test-trace").Start();
|
||||
|
||||
using StellaOps.TestKit;
|
||||
var terminal = new RecordingHandler();
|
||||
var handler = new TelemetryPropagationHandler(accessor, options)
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using Microsoft.Extensions.Options;
|
||||
using StellaOps.Telemetry.Core;
|
||||
using StellaOps.TestKit;
|
||||
|
||||
public class TelemetryPropagationMiddlewareTests
|
||||
{
|
||||
@@ -18,7 +19,6 @@ public class TelemetryPropagationMiddlewareTests
|
||||
// Assert using HttpContext.Items (source of truth for propagation in tests)
|
||||
var ctx = context.Items[typeof(TelemetryContext)] as TelemetryContext
|
||||
?? context.Items["TelemetryContext"] as TelemetryContext;
|
||||
using StellaOps.TestKit;
|
||||
Assert.NotNull(ctx);
|
||||
Assert.Equal("tenant-a", ctx!.TenantId);
|
||||
Assert.Equal("service-x", ctx.Actor);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Diagnostics.Metrics;
|
||||
using StellaOps.Telemetry.Core;
|
||||
using StellaOps.TestKit;
|
||||
|
||||
namespace StellaOps.Telemetry.Core.Tests;
|
||||
|
||||
@@ -146,7 +147,6 @@ public sealed class TimeToFirstSignalMetricsTests : IDisposable
|
||||
phase: TtfsPhase.Unknown))
|
||||
{
|
||||
throw new InvalidOperationException("boom");
|
||||
using StellaOps.TestKit;
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Diagnostics.Metrics;
|
||||
using System.Diagnostics.Metrics;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using StellaOps.Telemetry.Core.Triage;
|
||||
|
||||
@@ -140,7 +140,6 @@ public sealed class TtfsIngestionServiceTests : IDisposable
|
||||
public void IngestEvent_DecisionRecorded_RecordsDecisionMetricsAndClickBudgetViolation()
|
||||
{
|
||||
using var loggerFactory = LoggerFactory.Create(_ => { });
|
||||
using StellaOps.TestKit;
|
||||
var service = new TtfsIngestionService(loggerFactory.CreateLogger<TtfsIngestionService>());
|
||||
|
||||
service.IngestEvent(new TtfsEvent
|
||||
|
||||
@@ -49,7 +49,9 @@ public sealed class RedactingLogProcessor : BaseProcessor<LogRecord>
|
||||
try
|
||||
{
|
||||
// Redact state (structured log properties)
|
||||
#pragma warning disable CS0618 // State is obsolete but needed for compatibility
|
||||
if (data.State is IReadOnlyList<KeyValuePair<string, object?>> stateList)
|
||||
#pragma warning restore CS0618
|
||||
{
|
||||
RedactStateList(stateList, tenantId);
|
||||
}
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Grpc.AspNetCore" Version="2.70.0" />
|
||||
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.12.0" />
|
||||
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.12.0" />
|
||||
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.12.0" />
|
||||
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.12.0" />
|
||||
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.12.0" />
|
||||
<PackageReference Include="Grpc.AspNetCore" />
|
||||
<PackageReference Include="OpenTelemetry.Extensions.Hosting" />
|
||||
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" />
|
||||
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" />
|
||||
<PackageReference Include="OpenTelemetry.Instrumentation.Http" />
|
||||
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -13,7 +13,7 @@ public sealed class TelemetryContextAccessor : ITelemetryContextAccessor
|
||||
public TelemetryContextAccessor()
|
||||
{
|
||||
// Ensure clean state per accessor instantiation (important for tests)
|
||||
CurrentHolder.Value = null;
|
||||
CurrentHolder.Value = null!;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
@@ -22,7 +22,7 @@ public sealed class TelemetryContextAccessor : ITelemetryContextAccessor
|
||||
get => CurrentHolder.Value?.Context;
|
||||
set
|
||||
{
|
||||
CurrentHolder.Value = value is null ? null : new TelemetryContextHolder { Context = value };
|
||||
CurrentHolder.Value = value is null ? null! : new TelemetryContextHolder { Context = value };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public sealed class TelemetryContextAccessor : ITelemetryContextAccessor
|
||||
_accessor.Context = _previous;
|
||||
if (_previous is null)
|
||||
{
|
||||
CurrentHolder.Value = null;
|
||||
CurrentHolder.Value = null!;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user