-
Notifications
You must be signed in to change notification settings - Fork 33
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
Added console reporter #15
base: master
Are you sure you want to change the base?
Conversation
Could we maybe refactor this so that the agent can have a modular output? i.e there's only one "agent" but it can export via HTTP, dump to IO stream, push data to some collection system, etc. |
Sounds like a good idea, the reporter is actually quite similar to the On Thu, Apr 21, 2011 at 1:20 PM, johnewart <
|
Exactly -- it seems like they should all just channel through one place to keep things tidy. Thanks for this! |
Hi John, Do you want to discuss more about the refactoring? I am not exactly sure how module Metrics
end module Metrics
logger.debug "Creating Metrics daemon thread." other output class...class ConsoleReporter end What do you think? On Thu, Apr 21, 2011 at 1:43 PM, johnewart <
|
Ian, Matt was working on some integration changes so I was waiting for those to be ready before I responded. Take a look at the new code in lib/ruby-metrics/integration/webrick.rb for how the webrick integration mechanism works and mimic that for your console output. Matt's changes are similar to the ones you proposed in that it generalizes the metrics output interface. I think that a console logger will be a great feature for dumping to the console and files easily! Thanks again! |
Sure, I will look into that. Ian On Tue, Apr 26, 2011 at 10:43 AM, johnewart <
|
So I had the idea that metrics would be either consumed or published. Consuming includes the webrick where outside agents (processes or humans) can query for them. Publishing include something like this, maybe publishing to an AMQP queue, log files, etc. `collectd' would consume the data from the processes, etc. I'd like something that is generic enough where whatever needs to be published to or consumed by it requires a consistent but simple interface to make happen. I can also see multiple of these producers being active: the middleware for visual checking but publishing to a backend for aggregation. The design I went with for the integration modules was that the agent was passed around since it contains the data and then it was queried for the data when needed. So the Rack endpoint just returned the JSON version of the metrics, and another module could publish to its own output channel with the same agent. So, this could easily just be another way to integrate the metrics into the application and could belong in the integration batch. But this may the an opportunity to take a step back and make a good design for this type of publishing/consuming model. What do you think? |
The console reporter is the counterpart of "metrics" projects' reporting tool. It generates metrics report to a IO stream and it can work together with agent.
Example code working together with agent would look like this,
@metrics = Metrics::Agent.new
@metrics.start
@reporter = Metrics::ConsoleReporter.new
@reporter.start
counter = @metrics.counter :my_counter
counter.incr
counter.incr
or it can be used individually as a reporting tool
out = File.new('metrics.report', 'w')
@reporter = Metrics::ConsoleReporter.new(out)
@reporter.start(20)
counter = @reporter.counter :my_counter
counter.incr
counter.incr
Hope this is helpful~