dynamo-autoscale 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ v0.2.7
2
+
3
+ - Some improvements around table tracking and scale reports.
4
+
1
5
  v0.2.6
2
6
 
3
7
  - Fixed a bug where we crash out when CloudWatch returns nil for a consumed
data/README.md CHANGED
@@ -225,15 +225,15 @@ The `table` argument is a `TableTracker` object. For a run down of what
225
225
  information is available to you I advise checking out the source code in
226
226
  `lib/dynamo-autoscale/table_tracker.rb`.
227
227
 
228
- ### The :count option
228
+ ### The :times option
229
229
 
230
- The `:count` option allows you to specify that a rule must be triggered a set
230
+ The `:times` option allows you to specify that a rule must be triggered a set
231
231
  number of times in a row before its action is executed.
232
232
 
233
233
  Example:
234
234
 
235
235
  ``` ruby
236
- writes for: 10.minutes, greater_than: "90%", count: 3, scale: { on: :consumed, by: 1.5 }
236
+ writes for: 10.minutes, greater_than: "90%", times: 3, scale: { on: :consumed, by: 1.5 }
237
237
  ```
238
238
 
239
239
  This says that is writes are greater than 90% for 10 minutes three checks in a
@@ -130,10 +130,13 @@ module DynamoAutoscale
130
130
  logger.info "[#{metric}][scaling up] " +
131
131
  "#{from ? from.round(2) : "Unknown"} -> #{to.round(2)}"
132
132
 
133
+ now = Time.now.utc
133
134
 
134
135
  # Because upscales are not limited, we don't need to queue this operation.
135
136
  if result = scale(metric, to)
136
- @provisioned[metric][Time.now.utc] = to
137
+ table.scale_events[now] = { metric => to }
138
+
139
+ @provisioned[metric][now] = to
137
140
  @upscales += 1
138
141
  ScaleReport.new(table).send
139
142
  end
@@ -118,7 +118,7 @@ module DynamoAutoscale
118
118
  if @opts[:times].nil? or @count[table.name] == @opts[:times]
119
119
  @count[table.name] = 0
120
120
  logger.info "[rule] Triggered rule: #{self.to_english}"
121
- table.triggered_rules[Time.now.utc] = self
121
+ table.triggered_rules[table.latest_data_time] = self
122
122
 
123
123
  if scale = @opts[:scale]
124
124
  new_val = table.send("last_#{scale[:on]}_for", @metric) * scale[:by]
@@ -1,3 +1,3 @@
1
1
  module DynamoAutoscale
2
- VERSION = '0.2.6'
2
+ VERSION = '0.2.7'
3
3
  end
@@ -7,7 +7,7 @@ Last 5 triggered rules:
7
7
  Last 20 data points:
8
8
 
9
9
  <% @table.data.reverse_each.take(20).each do |time, datum| %>
10
- <% time.iso8601 %>: <%= datum %>
10
+ <%= time.iso8601 %>: <%= datum %>
11
11
  <% end %>
12
12
 
13
13
  Last 5 scale events:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynamo-autoscale
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: