Module: SimplePerformer
- Defined in:
- lib/data_array.rb,
lib/base.rb,
lib/config.rb,
lib/sp_rack.rb,
lib/api_auth.rb,
lib/simple_performer.rb,
lib/simple_performr_rufus.rb
Overview
for Now data array would simply be a queue
Defined Under Namespace
Classes: Agger, Aggregator, ApiAuth, Base, Config, DataArray, Performr, PerformrRufus, Rack, TimeBlock
Constant Summary collapse
- @@metrics_path =
'/api/metrics'
- @@base_url =
'http://incoming.simpleperformr.com' + @@metrics_path
Class Attribute Summary collapse
-
.config ⇒ Object
Returns the value of attribute config.
-
.service ⇒ Object
Returns the value of attribute service.
Class Method Summary collapse
- .base_url ⇒ Object
- .base_url=(url) ⇒ Object
-
.benchmark(name, &block) ⇒ Object
name is what this chunk of code will be referred to in the UI.
- .configure {|config| ... } ⇒ Object
-
.puts_duration(name, &block) ⇒ Object
Simple function that simply spits out the duration of the block - name is for reference.
- .shutdown ⇒ Object
Class Attribute Details
.config ⇒ Object
Returns the value of attribute config.
19 20 21 |
# File 'lib/simple_performer.rb', line 19 def config @config end |
.service ⇒ Object
Returns the value of attribute service.
19 20 21 |
# File 'lib/simple_performer.rb', line 19 def service @service end |
Class Method Details
.base_url ⇒ Object
44 45 46 |
# File 'lib/simple_performer.rb', line 44 def self.base_url @@base_url end |
.base_url=(url) ⇒ Object
40 41 42 |
# File 'lib/simple_performer.rb', line 40 def self.base_url=(url) @@base_url = url + @@metrics_path end |
.benchmark(name, &block) ⇒ Object
name is what this chunk of code will be referred to in the UI.
32 33 34 |
# File 'lib/simple_performer.rb', line 32 def self.benchmark(name, &block) Performr.benchmark(name, &block) end |
.configure {|config| ... } ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/simple_performer.rb', line 22 def configure() SimplePerformer.config ||= SimplePerformer::Config.new yield(config) # SimplePerformer.service = Performr.new(config.access_key, config.secret_key, :config=>config) # todo: should delay start until used? Performr.start end |
.puts_duration(name, &block) ⇒ Object
Simple function that simply spits out the duration of the block
-
name is for reference.
50 51 52 53 54 55 56 57 |
# File 'lib/simple_performer.rb', line 50 def self.puts_duration(name, &block) start_time = Time.now yield end_time = Time.now duration = end_time-start_time puts "#{name} duration: #{duration} seconds." duration end |
.shutdown ⇒ Object
36 37 38 |
# File 'lib/simple_performer.rb', line 36 def self.shutdown # EventMachine.stop end |