haskell-github-trust / ekg-core

Library for tracking system metrics
BSD 3-Clause "New" or "Revised" License
40 stars 39 forks source link

Dimensional counters #22

Closed lucasdicioccio closed 5 years ago

lucasdicioccio commented 6 years ago

This change breaks consumers of the API, and maybe some old GHC/Base versions. (Built with The Glorious Glasgow Haskell Compilation System, version 8.2.2).

I plan to wrap the new module with a type-fancy layer (either in this package or in another package) for a stronger guarantee that the dimensions passed to lookupOrCreate are correct (possibly saving a runtime check about dimension lengths).

Minimal compatibility patches to demonstrate the feature are provided for ekg-json and ekg.

The example works and displays individual curves flattening the dimensions as follows.

screen shot 2018-02-03 at 22 06 19

I'm more interested in providing support into ekg-core than ekg. Though, I don't mind doing a bit more. In particular, one annoying issue of my current design is the lack of "forced ordering" on the key/value pairs for the dimensions: thus preventing the ekg Snap layer to guess the HashMap key for retrieving a particular Sample value (but I'm not aware of users of this Snap route and I would suggest to drop the feature rather than complexifying the ekg-core logic for no users).

lucasdicioccio commented 6 years ago

@tibbe any comment about this MR?

I'm willing to provide a typeful layer above this one to enforce more type-safety between the construction and consuming sides, though it should probably go in another package where we can allow stricter GHC versions.

23Skidoo commented 5 years ago

Closing in favour of #32.

lucasdicioccio commented 5 years ago

Thanks @matth-