mikejihbe / metrics

A metrics library for Node.js
574 stars 58 forks source link

Export exponentially weighted moving average module in the main file #46

Closed sarslanhan closed 6 years ago

sarslanhan commented 6 years ago

We have a use case that needs the last 60 minute rate. To do this, we would like to extend the meter implementation and add another field (although we are also open to suggestions). To do this without any duplication we need the EWMA module exported in the main file.

We are happy to submit a PR if you are on board.

tolbertam commented 6 years ago

That sounds good to me. Since we don't export anything in the stats directory, what do you think about adding an index.js to there, exporting the EWMA code there, and then updating index.js to export EWMA from stats to the root level? We could also do that for the other code in stats as well, since the sample implementations could be useful as well. On the other hand, I would also be 👍 on a tactical approach of simply exposing EWMA for now.

One small reminder for myself is that we'll want to update the typescript definitions (which were just added by #44) as well, I can do that your PR if you like, otherwise i'm 👍 if you'd like to take care of that as well.

sarslanhan commented 6 years ago

@tolbertam please see the pull request I just submitted.

I did not include the type definitions for BinaryHeap as it is not yet exported.

tolbertam commented 6 years ago

Fixed by #47, thanks for your contribution @sarslanhan !