Skip to content

Commit

Permalink
Whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
bartelink committed Jan 24, 2022
1 parent 6ed0e78 commit 85a18f6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion samples/Store/Integration/Integration.fsproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<IsPackable>false</IsPackable>
<WarningLevel>5</WarningLevel>
<DisableImplicitSystemValueTupleReference>true</DisableImplicitSystemValueTupleReference>
Expand Down
16 changes: 8 additions & 8 deletions src/Equinox.CosmosStore/CosmosStore.fs
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,9 @@ module Log =
let internal event (value : Metric) (log : ILogger) =
let enrich (e : Serilog.Events.LogEvent) =
e.AddPropertyIfAbsent(Serilog.Events.LogEventProperty(PropertyTag, Serilog.Events.ScalarValue(value)))
log.ForContext({ new Serilog.Core.ILogEventEnricher with member _.Enrich(evt,_) = enrich evt })
log.ForContext({ new Serilog.Core.ILogEventEnricher with member _.Enrich(evt, _) = enrich evt })
let internal (|BlobLen|) (x : EventBody) = if x.ValueKind = JsonValueKind.Null then 0 else x.GetRawText().Length
let internal (|EventLen|) (x : #IEventData<_>) = let (BlobLen bytes), (BlobLen metaBytes) = x.Data, x.Meta in bytes + metaBytes + 80
let internal (|EventLen|) (x : #IEventData<_>) = let BlobLen bytes, BlobLen metaBytes = x.Data, x.Meta in bytes + metaBytes + 80
let internal (|BatchLen|) = Seq.sumBy (|EventLen|)
let internal (|SerilogScalar|_|) : Serilog.Events.LogEventPropertyValue -> obj option = function
| :? Serilog.Events.ScalarValue as x -> Some x.Value
Expand Down Expand Up @@ -479,11 +479,11 @@ module internal Sync =
let private logged (container, stream) (maxEventsInTip, maxStringifyLen) (exp : SyncExp, req : Tip) (log : ILogger)
: Async<Result> = async {
let! t, (ru, result) = run (container, stream) (maxEventsInTip, maxStringifyLen) (exp, req) |> Stopwatch.Time
let verbose = log.IsEnabled Serilog.Events.LogEventLevel.Debug
let (Log.BatchLen bytes), count = Enum.Events req, req.e.Length
let Log.BatchLen bytes, count = Enum.Events req, req.e.Length
let log =
let inline mkMetric ru : Log.Measurement = { database = container.Database.Id; container = container.Id; stream = stream; interval = t; bytes = bytes; count = count; ru = ru }
let inline propConflict log = log |> Log.prop "conflict" true |> Log.prop "eventTypes" (Seq.truncate 5 (seq { for x in req.e -> x.c }))
let verbose = log.IsEnabled Events.LogEventLevel.Debug
if verbose then log |> Log.propEvents (Enum.Events req) |> Log.propDataUnfolds req.u else log
|> match exp with
| SyncExp.Etag et -> Log.prop "expectedEtag" et
Expand Down Expand Up @@ -612,7 +612,7 @@ module internal Tip =
(log 0 0 Log.Metric.TipNotFound).Information("EqxCosmos {action:l} {stream} {res} {ms}ms rc={ru}", "Tip", stream, 404, (let e = t.Elapsed in e.TotalMilliseconds), ru)
| ReadResult.Found tip ->
let log =
let (Log.BatchLen bytes), count = Enum.Unfolds tip.u, tip.u.Length
let Log.BatchLen bytes, count = Enum.Unfolds tip.u, tip.u.Length
log bytes count Log.Metric.Tip
let log = if verbose then log |> Log.propDataUnfolds tip.u else log
let log = match maybePos with Some p -> log |> Log.propStartPos p |> Log.propStartEtag p | None -> log
Expand Down Expand Up @@ -675,10 +675,10 @@ module internal Query =
Enum.Events(b, ?minIndex = minIndex, ?maxIndex = maxIndex)
|> if direction = Direction.Backward then System.Linq.Enumerable.Reverse else id
let events = batches |> Seq.collect unwrapBatch |> Array.ofSeq
let verbose = log.IsEnabled Events.LogEventLevel.Debug
let (Log.BatchLen bytes), count = events, events.Length
let Log.BatchLen bytes, count = events, events.Length
let reqMetric : Log.Measurement = { database = container.Database.Id; container = container.Id; stream = streamName; interval = t; bytes = bytes; count = count; ru = ru }
let log = let evt = Log.Metric.QueryResponse (direction, reqMetric) in log |> Log.event evt
let verbose = log.IsEnabled Events.LogEventLevel.Debug
let log = if verbose then log |> Log.propEvents events else log
let index = if count = 0 then Nullable () else Nullable <| Seq.min (seq { for x in batches -> x.i })
(log|> Log.prop "bytes" bytes
Expand All @@ -690,7 +690,7 @@ module internal Query =
events, maybePosition, ru

let private logQuery direction queryMaxItems (container : Container, streamName) interval (responsesCount, events : ITimelineEvent<EventBody>[]) n (ru : float) (log : ILogger) =
let (Log.BatchLen bytes), count = events, events.Length
let Log.BatchLen bytes, count = events, events.Length
let reqMetric : Log.Measurement = { database = container.Database.Id; container = container.Id; stream = streamName; interval = interval; bytes = bytes; count = count; ru = ru }
let evt = Log.Metric.Query (direction, responsesCount, reqMetric)
let action = match direction with Direction.Forward -> "QueryF" | Direction.Backward -> "QueryB"
Expand Down

0 comments on commit 85a18f6

Please sign in to comment.