dynamo-autoscale 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +5 -0
- data/config/environment/common.rb +1 -1
- data/config/services/logger.rb +1 -1
- data/lib/dynamo-autoscale/actioner.rb +14 -3
- data/lib/dynamo-autoscale/dynamo_actioner.rb +1 -1
- data/lib/dynamo-autoscale/standard_formatter.rb +14 -0
- data/lib/dynamo-autoscale/version.rb +1 -1
- metadata +2 -1
data/CHANGELOG
CHANGED
data/config/services/logger.rb
CHANGED
@@ -15,7 +15,7 @@ DynamoAutoscale::Logger.logger = ::Logger.new(STDOUT)
|
|
15
15
|
if config[:style] == "pretty"
|
16
16
|
DynamoAutoscale::Logger.logger.formatter = DynamoAutoscale::PrettyFormatter.new
|
17
17
|
else
|
18
|
-
DynamoAutoscale::Logger.logger.formatter =
|
18
|
+
DynamoAutoscale::Logger.logger.formatter = DynamoAutoscale::StandardFormatter.new
|
19
19
|
end
|
20
20
|
|
21
21
|
if ENV['DEBUG']
|
@@ -203,26 +203,37 @@ module DynamoAutoscale
|
|
203
203
|
|
204
204
|
@pending[:writes] = nil
|
205
205
|
@pending[:reads] = nil
|
206
|
+
|
207
|
+
logger.info "[flush] Flushed a read and a write event."
|
208
|
+
else
|
209
|
+
logger.error "[flush] Failed to flush a read and write event."
|
206
210
|
end
|
207
211
|
elsif @pending[:writes]
|
208
212
|
value = @pending[:writes]
|
209
213
|
|
210
214
|
if result = scale(:writes, value)
|
211
|
-
@provisioned[:writes][
|
215
|
+
@provisioned[:writes][now] = value
|
212
216
|
table.scale_events[now] = { writes: value }
|
213
217
|
@pending[:writes] = nil
|
218
|
+
|
219
|
+
logger.info "[flush] Flushed a write event."
|
220
|
+
else
|
221
|
+
logger.error "[flush] Failed to flush a write event."
|
214
222
|
end
|
215
223
|
elsif @pending[:reads]
|
216
224
|
value = @pending[:reads]
|
217
225
|
|
218
226
|
if result = scale(:reads, value)
|
219
|
-
@provisioned[:reads][
|
227
|
+
@provisioned[:reads][now] = value
|
220
228
|
table.scale_events[now] = { reads: value }
|
221
229
|
@pending[:reads] = nil
|
230
|
+
|
231
|
+
logger.info "[flush] Flushed a read event."
|
232
|
+
else
|
233
|
+
logger.error "[flush] Failed to flush a read event."
|
222
234
|
end
|
223
235
|
end
|
224
236
|
|
225
|
-
logger.info "[flush] All pending downscales have been flushed."
|
226
237
|
return result
|
227
238
|
end
|
228
239
|
|
@@ -43,7 +43,7 @@ module DynamoAutoscale
|
|
43
43
|
# When you try to increase throughput greater than 2x or you try to
|
44
44
|
# decrease more than 4 times per day you get this.
|
45
45
|
|
46
|
-
aws_description = self.describe_table(table)
|
46
|
+
aws_description = self.class.describe_table(table)
|
47
47
|
decreases_today = aws_description[:provisioned_throughput][:number_of_decreases_today]
|
48
48
|
|
49
49
|
downscales(table, decreases_today)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module DynamoAutoscale
|
2
|
+
class StandardFormatter
|
3
|
+
def initialize
|
4
|
+
@formatter = ::Logger::Formatter.new
|
5
|
+
end
|
6
|
+
|
7
|
+
def call(severity, time, progname, msg)
|
8
|
+
table = DynamoAutoscale.current_table
|
9
|
+
msg = "[#{table.name}] #{msg}" if table
|
10
|
+
|
11
|
+
@formatter.call(severity, time, progname, msg)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
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.
|
4
|
+
version: 0.2.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -149,6 +149,7 @@ files:
|
|
149
149
|
- lib/dynamo-autoscale/rule.rb
|
150
150
|
- lib/dynamo-autoscale/rule_set.rb
|
151
151
|
- lib/dynamo-autoscale/scale_report.rb
|
152
|
+
- lib/dynamo-autoscale/standard_formatter.rb
|
152
153
|
- lib/dynamo-autoscale/table_tracker.rb
|
153
154
|
- lib/dynamo-autoscale/unit_cost.rb
|
154
155
|
- lib/dynamo-autoscale/version.rb
|