From 24545ec117b16c5a002bd0c1a3e6aa0b9418a61f Mon Sep 17 00:00:00 2001 From: Ruben Bartelink Date: Mon, 26 Feb 2024 23:02:07 +0000 Subject: [PATCH] fix(Tool): Restore logging --- src/Propulsion/StreamFilter.fs | 6 +++--- tools/Propulsion.Tool/Sync.fs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Propulsion/StreamFilter.fs b/src/Propulsion/StreamFilter.fs index a466433f..b07bdafc 100644 --- a/src/Propulsion/StreamFilter.fs +++ b/src/Propulsion/StreamFilter.fs @@ -7,7 +7,7 @@ type StreamFilter([] allowCats, [] denyCats, [] al [] allowEts, [] denyEts, [] ?incIndexes, [] ?log) = - let log = defaultArg log Serilog.Log.Logger + let log = lazy defaultArg log Serilog.Log.Logger let defA x = match x with null -> Array.empty | xs -> Seq.toArray xs let allowCats, denyCats, incIndexes = defA allowCats, defA denyCats, defaultArg incIndexes false @@ -35,8 +35,8 @@ type StreamFilter([] allowCats, [] denyCats, [] al let denyCats = if incIndexes then denyCats else Array.append denyCats [| "^\$" |] let allowSns, denySns = match allowSns, denySns with [||], [||] -> [|".*"|], [||] | x -> x let allowEts, denyEts = match allowEts, denyEts with [||], [||] -> [|".*"|], [||] | x -> x - log.Information("Categories ☑️ {@allowCats} 🚫{@denyCats} Streams ☑️ {@allowStreams} 🚫{denyStreams} Events ☑️ {allowEts} 🚫{@denyEts}", - asRe allowCats, asRe denyCats, asRe allowSns, asRe denySns, asRe allowEts, asRe denyEts) + log.Value.Information("Categories ☑️ {@allowCats} 🚫{@denyCats} Streams ☑️ {@allowStreams} 🚫{denyStreams} Events ☑️ {allowEts} 🚫{@denyEts}", + asRe allowCats, asRe denyCats, asRe allowSns, asRe denySns, asRe allowEts, asRe denyEts) fun sn -> validCat sn && validStream sn diff --git a/tools/Propulsion.Tool/Sync.fs b/tools/Propulsion.Tool/Sync.fs index 145d78a3..f1eefd22 100644 --- a/tools/Propulsion.Tool/Sync.fs +++ b/tools/Propulsion.Tool/Sync.fs @@ -59,7 +59,6 @@ and Arguments(c, p: ParseResults) = | x -> p.Raise $"unexpected subcommand %A{x}" member val StatsInterval = TimeSpan.minutes 1 member val StateInterval = TimeSpan.minutes 5 - member val IdleDelay = TimeSpan.ms 10. and [] SourceParameters = | [] Cosmos of ParseResults | [] Dynamo of ParseResults @@ -189,6 +188,7 @@ type Stats(log, statsInterval, stateInterval, verboseStore, logExternalStats) = handled <- 0; ignored <- 0 intervalLats.Dump(log, "EVENTS") intervalLats.Clear() + base.DumpStats() override _.DumpState purge = accEventTypeLats.Dump(log, "ΣEVENTS") for cat in Seq.append accHam.Categories accSpam.Categories |> Seq.distinct |> Seq.sort do @@ -243,7 +243,7 @@ let run appName (c: Args.Configuration, p: ParseResults) = async { let json = Propulsion.Codec.NewtonsoftJson.RenderedSpan.ofStreamSpan stream events |> Propulsion.Codec.NewtonsoftJson.Serdes.Serialize do! producer.ProduceAsync(FsCodec.StreamName.toString stream, json) |> Async.Ignore return Propulsion.Sinks.StreamResult.AllProcessed, Outcome.render_ stream ham spam 0 } - Propulsion.Sinks.Factory.StartConcurrent(Log.Logger, maxReadAhead, maxConcurrentProcessors, handle a.Filters.EventFilter, stats, idleDelay = a.IdleDelay) + Propulsion.Sinks.Factory.StartConcurrent(Log.Logger, maxReadAhead, maxConcurrentProcessors, handle a.Filters.EventFilter, stats) | SubCommand.Sync a -> let eventsContext = a.ConnectEvents() |> Async.RunSynchronously let stats = Propulsion.CosmosStore.CosmosStoreSinkStats(Log.Logger, statsInterval, stateInterval)