diff --git a/docs/guide/logging.md b/docs/guide/logging.md index f689635e1..133f5f9e7 100644 --- a/docs/guide/logging.md +++ b/docs/guide/logging.md @@ -77,44 +77,16 @@ Wolverine's node agent controller performs health checks periodically (every 10 You can control this tracing behavior through the `DurabilitySettings`: - - + + ```cs -public record QuietMessage; - -public record VerboseMessage; +// Disable the "wolverine_node_assignments" traces entirely +opts.Durability.NodeAssignmentHealthCheckTracingEnabled = false; -public class QuietAndVerboseMessageHandler -{ - [WolverineLogging( - telemetryEnabled:false, - successLogLevel: LogLevel.None, - executionLogLevel:LogLevel.Trace)] - public void Handle(QuietMessage message) - { - Console.WriteLine("Hush!"); - } - - [WolverineLogging( - // Enable Open Telemetry tracing - TelemetryEnabled = true, - - // Log on successful completion of this message - SuccessLogLevel = LogLevel.Information, - - // Log on execution being complete, but before Wolverine does its own book keeping - ExecutionLogLevel = LogLevel.Information, - - // Throw in yet another contextual logging statement - // at the beginning of message execution - MessageStartingLevel = LogLevel.Debug)] - public void Handle(VerboseMessage message) - { - Console.WriteLine("Tell me about it!"); - } -} +// Or, sample those traces to only once every 10 minutes +// opts.Durability.NodeAssignmentHealthCheckTraceSamplingPeriod = TimeSpan.FromMinutes(10); ``` -snippet source | anchor +snippet source | anchor ## Controlling Message Specific Logging and Tracing diff --git a/src/Testing/OpenTelemetry/OtelWebApiWolverineMarten/Program.cs b/src/Testing/OpenTelemetry/OtelWebApiWolverineMarten/Program.cs index bf230d738..279da0fe1 100644 --- a/src/Testing/OpenTelemetry/OtelWebApiWolverineMarten/Program.cs +++ b/src/Testing/OpenTelemetry/OtelWebApiWolverineMarten/Program.cs @@ -15,11 +15,13 @@ opts.Policies.AutoApplyTransactions(); opts.CodeGeneration.TypeLoadMode = !builder.Environment.IsDevelopment() ? TypeLoadMode.Static : TypeLoadMode.Auto; +#region sample_configuring_health_check_tracing // Disable the "wolverine_node_assignments" traces entirely opts.Durability.NodeAssignmentHealthCheckTracingEnabled = false; // Or, sample those traces to only once every 10 minutes // opts.Durability.NodeAssignmentHealthCheckTraceSamplingPeriod = TimeSpan.FromMinutes(10); +#endregion }); builder.Services.AddMarten(opts => { opts.Connection("host=localhost;Port=5433;Database=postgres;Username=postgres;password=postgres"); })