Skip to content
This repository was archived by the owner on Oct 19, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,21 @@ class MyClass
end
```

Also Rubik can track inline block execution times.

```ruby
class MyClass
include Rubik

def run
track_as 'myclass#run_method' do
# do some stuff
sleep 1
end
end
end
```

### Custom Metrics
Just use the Rubik.push_metric method to push your custom metric.

Expand Down
7 changes: 7 additions & 0 deletions lib/rubik.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
module Rubik
extend ActiveSupport::Concern

def track_as key
start = Time.now.to_f
yield
delta = ((Time.now.to_f - start) * 1000).ceil
Rubik.push key, delta
end

class << self
SAMPLE_SIZE = 500
attr_accessor :redis
Expand Down