refactor(telemetry.serilog): review fixes (thread-safe redactor, bootstrap logger, minlevel ordering, test coverage)
This commit is contained in:
+7
-2
@@ -42,11 +42,16 @@ public sealed class TraceContextEnricherTests
|
||||
Assert.NotNull(activity);
|
||||
Assert.NotNull(Activity.Current);
|
||||
|
||||
// Capture IDs before the log call so assertions are not sensitive to activity
|
||||
// lifecycle — Activity.Current may differ after the log call returns.
|
||||
var expectedTraceId = activity.TraceId.ToString();
|
||||
var expectedSpanId = activity.SpanId.ToString();
|
||||
|
||||
logger.Information("traced");
|
||||
|
||||
var logEvent = Assert.Single(sink.LogEvents);
|
||||
Assert.Equal(Activity.Current!.TraceId.ToString(), ScalarOrNull(logEvent, "trace_id"));
|
||||
Assert.Equal(Activity.Current!.SpanId.ToString(), ScalarOrNull(logEvent, "span_id"));
|
||||
Assert.Equal(expectedTraceId, ScalarOrNull(logEvent, "trace_id"));
|
||||
Assert.Equal(expectedSpanId, ScalarOrNull(logEvent, "span_id"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user