-
Notifications
You must be signed in to change notification settings - Fork 56
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
ScheduledReporter with console, csv and graphite implementations. #29
Conversation
console.log(' count = %d', meter.count); | ||
console.log(' mean rate = %s events/%s', ff(meter.meanRate()), 'second'); | ||
console.log(' 1-minute rate = %s events/%s', ff(meter.oneMinuteRate()), 'second'); | ||
console.log(' 1-minute rate = %s events/%s', ff(meter.fiveMinuteRate()), 'second'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a little typo here and on L80
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
d'oh! Looks like I made the same mistake in printTimer too, will fix.
Otherwise I think this looks great. Tests for it would definitely be appreciated |
Thanks for the review! I'll add some tests tonight and a brief section to the README. |
Added some tests (naturally, found a bug :P) and an entry to the README (once merged I'll provide some more details on the wiki page w/r/t creating your own custom reporter and using the existing ones). I noticed that |
That would definitely be great. Let's make that a separate PR. On Mon, Mar 14, 2016 at 8:07 PM, Andrew Tolbert notifications@github.com
Mike Ihbe mike@mustwin.com |
ScheduledReporter with console, csv and graphite implementations.
Sounds good, I'll start working on that and will create a PR sometime within the next few days. Thanks for merging 👍 |
For #16, this introduces a
ScheduledReporter
interface that those wanting to create their own custom reporters can implement. It also includes reporters for console, csv, and graphite reporting. All reporters strive to represent the same behavior as the dropwizard metrics libraries reporters. One thing missing is the ability to choose the resolution of rates and durations, which currently resolve to seconds and milliseconds respectively (might be a nice future enhancement, or is that important enough to include here?).ScheduledReporter
has astart(intervalInMs)
function for beginning reporting, which calls areport
function based on the configured interval. It is up to the implementer to override thereport
method to perform the behavior they wish. To stop reporting, simply callstop
.ScheduledReporter
is also anEventEmitter
so implementers may choose to emit custom events that can be used for logging and such (as is done inGraphiteReporter
).ConsoleReporter
A custom reporter that prints all metrics on console.log at a defined interval.
Example usage:
Example output:
CsvReporter
A custom reporter that will create a csv file for each metric that is appended to on the defined reporting interval.
Example usage:
Example csv contents:
GraphiteReporter
A custom reporter that sends metrics to a graphite server on the carbon tcp interface.
Example usage:
What is left is to add a basic test suite (I've validated it all with my application, but would be nice to have a repeatable suite of tests) and to update readme/docs where applicable. But before I do that, would like to get some feedback on the design/approach. My goal here was to introduce something extensible so others can add more reporters (either in this library proper, or in their own modules).