README.md in tabs-0.7.0 vs README.md in tabs-0.7.1

- old
+ new

@@ -7,11 +7,11 @@ ## Installation Add this line to your application's Gemfile: - gem 'tabs', '~> 0.6.2' + gem 'tabs', '~> 0.7.0' And then execute: $ bundle @@ -46,10 +46,17 @@ ```ruby Tabs.increment_counter("website-visits") ``` +If you need to retroactively increment the counter for a specific +timestamp, just pass it in. + +```ruby +Tabs.increment_counter("wibsite-visits", Time.now - 2.days) +``` + To retrieve the counts for a given time period just call `Tabs#get_stats` with the name of the metric, a range of times defining the period for which you want stats, and the resolution at which the data should be aggregated. ```ruby Tabs.get_stats("website-visits", 10.days.ago..Time.now, :hour) ``` @@ -82,10 +89,17 @@ ```ruby Tabs.record_value("new-user-age", 32) ``` +If you need to retroactively record a value for a specific +timestamp, just pass it in. + +```ruby +Tabs.increment_counter("new-user-age", 19, Time.now - 2.days) +``` + This will also create a value metric the first time, you can manually create a metric as well: ```ruby Tabs.create_metric("new-user-age", "value") @@ -99,13 +113,13 @@ This will return a familiar value, but with an expanded set of values. ```ruby [ - { 2000-01-01 00:00:00 UTC => { min: 19, max: 54, sum: 226, avg: 38 } }, - { 2000-02-01 01:00:00 UTC => { min: 0, max: 0, sum: 0, avg: 0 } }, - { 2000-03-01 02:00:00 UTC => { min: 22, max: 34, sum: 180, avg: 26 } }, + { 2000-01-01 00:00:00 UTC => { count: 9, min: 19, max: 54, sum: 226, avg: 38 } }, + { 2000-02-01 01:00:00 UTC => { count: 0, min: 0, max: 0, sum: 0, avg: 0 } }, + { 2000-03-01 02:00:00 UTC => { count: 2, min: 22, max: 34, sum: 180, avg: 26 } }, ... ] ``` ### Task Metrics @@ -123,9 +137,17 @@ token but it needs to be unique. Use the `complete_task` method to finish the task: ```ruby Tabs.complete_task("mobile-to-purchase", "2g4hj17787s") +``` + +If you need to retroactively start/complete a task at a specific +timestamp, just pass it in. + +```ruby +Tabs.start_task("mobile-to-purchase", "2g4hj17787s", Time.now - 2.days) +Tabs.complete_task("mobile-to-purchase", "2g4hj17787s", Time.now - 1.days) ``` Retrieving stats for a task metric is just like the other types: ```ruby