haskell-github-trust / ekg-core

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

Export `Stats(..)` #14

Open Fuuzetsu opened 7 years ago

Fuuzetsu commented 7 years ago

Having Stats exposed would be useful. Currently it can't be sent over the network unless it's rebuilt from scratch through its accessors, we can't write instances for it and so on.

tibbe commented 7 years ago

It's not exposed because I want to be able to change the implementation (e.g. to add support for quantiles). However, I am open to adding e.g. Binary instances or explicit decode/encode methods that could be used to transport stats over the network.

Fuuzetsu commented 7 years ago

That would work too. I didn't see binary dependency (though it's probably a transitive one) so I assumed exposing constructor would be less of a change.

Generic and Typeable would be nice too while you're changing it (from base).

tibbe commented 7 years ago

I think depending on binary is OK. If we don't want to commit to a specific library we could instead just offer:

encodeStats :: Stats -> ByteString
decodeStats :: ByteString -> Maybe Stats

This would allow us to change to use cereal or whatever in the future.