Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add eqx dump cosmos #177

Merged
merged 12 commits into from
Nov 8, 2019
Next Next commit
Fix logging field swaps
  • Loading branch information
bartelink committed Nov 7, 2019
commit 3e6abe8bed57f66183699f3823575c5365f0b5bf
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ The `Unreleased` section name is replaced by the expected version of next releas

### Fixed

- `Cosmos`: fixed swapped `count` and `bytes` metrics fields

<a name="2.0.0"></a>
<a name="2.0.0-rc7"></a>
## [2.0.0-rc7] - 2019-10-17
Expand Down
6 changes: 3 additions & 3 deletions src/Equinox.Cosmos/Cosmos.fs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Equinox.Cosmos.Store
namespace Equinox.Cosmos.Store

open Equinox.Core
open FsCodec
Expand Down Expand Up @@ -583,7 +583,7 @@ module internal Tip =
let private loggedGet (get : Container * string -> Position option -> Async<_>) (container,stream) (maybePos: Position option) (log: ILogger) = async {
let log = log |> Log.prop "stream" stream
let! t, (ru, res : ReadResult<Tip>) = get (container,stream) maybePos |> Stopwatch.Time
let log count bytes (f : Log.Measurement -> _) = log |> Log.event (f { stream = stream; interval = t; bytes = bytes; count = count; ru = ru })
let log bytes count (f : Log.Measurement -> _) = log |> Log.event (f { stream = stream; interval = t; bytes = bytes; count = count; ru = ru })
match res with
| ReadResult.NotModified ->
(log 0 0 Log.TipNotModified).Information("EqxCosmos {action:l} {res} {ms}ms rc={ru}", "Tip", 302, (let e = t.Elapsed in e.TotalMilliseconds), ru)
Expand Down Expand Up @@ -1014,7 +1014,7 @@ type Resolver<'event, 'state, 'context>(context : Context, codec, fold, initial,
| Some (AccessStrategy.Unfolded (isOrigin, unfold)) -> isOrigin, Choice2Of3 (fun _ state -> unfold state)
| Some (AccessStrategy.Snapshot (isValid,generate)) -> isValid, Choice2Of3 (fun _ state -> generate state |> Seq.singleton)
| Some (AccessStrategy.AnyKnownEventType) -> (fun _ -> true), Choice2Of3 (fun events _ -> Seq.last events |> Seq.singleton)
| Some (AccessStrategy.RollingUnfolds (isOrigin,transmute)) -> isOrigin, Choice3Of3 transmute
| Some (AccessStrategy.RollingUnfolds (isOrigin,transmute)) -> isOrigin, Choice3Of3 transmute
let cosmosCat = Category<'event, 'state, 'context>(context.Gateway, codec)
let folder = Folder<'event, 'state, 'context>(cosmosCat, fold, initial, isOrigin, mapUnfolds, ?readCache = readCacheOption)
let category : ICategory<_, _, Container*string, 'context> =
Expand Down