Skip to content

Commit 0eb807f

Browse files
committed
chore: fix indentation issues
1 parent 9dbd02e commit 0eb807f

File tree

2 files changed

+115
-114
lines changed

2 files changed

+115
-114
lines changed

lib/slowlog_check.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,15 @@ def slowlogs_by_flush_interval
150150
}
151151
elsif result[bucket][command].nil?
152152
result[bucket][command] = {
153-
values: [value],
154-
avg: value,
155-
count: 1,
156-
median: value,
157-
_95percentile: value,
158-
min: value,
159-
max: value,
160-
sum: value
161-
}
153+
values: [value],
154+
avg: value,
155+
count: 1,
156+
median: value,
157+
_95percentile: value,
158+
min: value,
159+
max: value,
160+
sum: value
161+
}
162162
else
163163
result[bucket][command] = add_metric_to_bucket(result[bucket][command], value)
164164
end
@@ -297,7 +297,7 @@ def update_metadatas
297297
name,
298298
metadata.transform_keys { |key| key.to_sym }
299299
)
300-
LOGGER.info "Updating metadata for #{name} #{status_or_error(resp)}"
300+
LOGGER.info "Updating metadata for #{name} #{status_or_error(resp)}"
301301
end
302302
end
303303

spec/slowlog_check_spec.rb

Lines changed: 105 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ def redis_slowlog(index, time, microseconds, command='eval')
3838
allow(redis).to receive(:connection) { {host: 'master.replicationgroup.abcde.use2.cache.amazonaws.com' } }
3939
allow(redis).to receive(:slowlog).with('get', 128) {
4040
[
41-
redis_slowlog( 3, Time.utc(2020,4,20,4,19,45), 400000 ),
42-
redis_slowlog( 2, Time.utc(2020,4,20,4,19,15), 100000 ),
43-
redis_slowlog( 1, Time.utc(2020,4,20,4,18,45), 100000 ),
44-
redis_slowlog( 0, Time.utc(2020,4,20,4,18,15), 200000 ),
41+
redis_slowlog( 3, Time.utc(2020,4,20,4,19,45), 400000 ),
42+
redis_slowlog( 2, Time.utc(2020,4,20,4,19,15), 100000 ),
43+
redis_slowlog( 1, Time.utc(2020,4,20,4,18,45), 100000 ),
44+
redis_slowlog( 0, Time.utc(2020,4,20,4,18,15), 200000 ),
4545
]
4646
}
4747

@@ -52,37 +52,37 @@ def redis_slowlog(index, time, microseconds, command='eval')
5252
Time.now - 7200,
5353
Time.now
5454
) {
55-
[
56-
"200",
57-
{
58-
"status"=>"ok",
59-
"res_type"=>"time_series",
60-
"series"=>
61-
[
62-
{
63-
"end"=>1587684599000,
64-
"attributes"=>{},
65-
"metric"=>"rspec.redis.slowlog.micros.95percentile",
66-
"interval"=>300,
67-
"tag_set"=>[],
68-
"start"=>1587602100000,
69-
"length"=>3,
70-
"query_index"=>0,
71-
"aggr"=>nil,
72-
"scope"=>"replication_group:replicationgroup",
73-
"pointlist"=>[[four_minutes_ago, 99994.0], [four_minutes_ago - 5000, 99378.0]],
74-
"expression"=>"rspec.redis.slowlog.micros.95percentile{replication_group:infraeng-dev-redis}",
75-
"unit"=>nil,
76-
"display_name"=>"rspec.redis.slowlog.micros.95percentile"
77-
}
78-
],
79-
"resp_version"=>1,
80-
"query"=>"rspec.redis.slowlog.micros.95percentile{replication_group:replicationgroup}",
81-
"message"=>"",
82-
"group_by"=>[]
83-
}
84-
]
85-
}
55+
[
56+
"200",
57+
{
58+
"status"=>"ok",
59+
"res_type"=>"time_series",
60+
"series"=>
61+
[
62+
{
63+
"end"=>1587684599000,
64+
"attributes"=>{},
65+
"metric"=>"rspec.redis.slowlog.micros.95percentile",
66+
"interval"=>300,
67+
"tag_set"=>[],
68+
"start"=>1587602100000,
69+
"length"=>3,
70+
"query_index"=>0,
71+
"aggr"=>nil,
72+
"scope"=>"replication_group:replicationgroup",
73+
"pointlist"=>[[four_minutes_ago, 99994.0], [four_minutes_ago - 5000, 99378.0]],
74+
"expression"=>"rspec.redis.slowlog.micros.95percentile{replication_group:infraeng-dev-redis}",
75+
"unit"=>nil,
76+
"display_name"=>"rspec.redis.slowlog.micros.95percentile"
77+
}
78+
],
79+
"resp_version"=>1,
80+
"query"=>"rspec.redis.slowlog.micros.95percentile{replication_group:replicationgroup}",
81+
"message"=>"",
82+
"group_by"=>[]
83+
}
84+
]
85+
}
8686

8787
# Freeze time
8888
Timecop.freeze(frozen_time)
@@ -96,10 +96,10 @@ def redis_slowlog(index, time, microseconds, command='eval')
9696
before(:each) do
9797
allow(redis).to receive(:slowlog).with('get', 128) {
9898
[
99-
redis_slowlog( 3, Time.utc(2020,4,20,4,19,45), 400000 ),
100-
redis_slowlog( 2, Time.utc(2020,4,20,4,19,15), 100000 ),
101-
redis_slowlog( 1, Time.utc(2020,4,20,4,18,45), 100000 ),
102-
redis_slowlog( 0, Time.utc(2020,4,20,4,18,15), 200000 ),
99+
redis_slowlog( 3, Time.utc(2020,4,20,4,19,45), 400000 ),
100+
redis_slowlog( 2, Time.utc(2020,4,20,4,19,15), 100000 ),
101+
redis_slowlog( 1, Time.utc(2020,4,20,4,18,45), 100000 ),
102+
redis_slowlog( 0, Time.utc(2020,4,20,4,18,15), 200000 ),
103103
]
104104
}
105105
end
@@ -130,10 +130,10 @@ def redis_slowlog(index, time, microseconds, command='eval')
130130

131131
context 'redis has 1048576 * 2 + 1 entries and a zeroeth entry' do
132132
let(:sauce) {
133-
Array.new(1048576 * 2 + 1) { |x|
134-
redis_slowlog(x, 1587352800, x) #lettuce not create so many unnecessary Time objects
135-
}.reverse
136-
}
133+
Array.new(1048576 * 2 + 1) { |x|
134+
redis_slowlog(x, 1587352800, x) #lettuce not create so many unnecessary Time objects
135+
}.reverse
136+
}
137137
before(:each) do
138138
allow(redis).to receive(:slowlog) { |_,number|
139139
sauce[0..number-1]
@@ -146,10 +146,10 @@ def redis_slowlog(index, time, microseconds, command='eval')
146146

147147
context 'redis has 567 entries and no zeroeth entry' do
148148
let(:sauce) {
149-
Array.new(567) { |x|
150-
redis_slowlog(x + 1, Time.utc(2020,4,20,3,20,0) + x, x)
151-
}.reverse
152-
}
149+
Array.new(567) { |x|
150+
redis_slowlog(x + 1, Time.utc(2020,4,20,3,20,0) + x, x)
151+
}.reverse
152+
}
153153
before(:each) do
154154
allow(redis).to receive(:slowlog) { |_,number|
155155
sauce[0..number-1]
@@ -219,10 +219,10 @@ def redis_slowlog(index, time, microseconds, command='eval')
219219
subject { slowlog_check.reporting_interval }
220220
focus 'generates an array at minute intervals' do
221221
expect(subject).to eq(
222-
Time.utc(2020,4,20,4,19).localtime => {},
223-
Time.utc(2020,4,20,4,18).localtime => {},
224-
Time.utc(2020,4,20,4,17).localtime => {},
225-
)
222+
Time.utc(2020,4,20,4,19).localtime => {},
223+
Time.utc(2020,4,20,4,18).localtime => {},
224+
Time.utc(2020,4,20,4,17).localtime => {},
225+
)
226226
end
227227
end
228228

@@ -266,54 +266,55 @@ def redis_slowlog(index, time, microseconds, command='eval')
266266
let(:bucket18) {
267267
{
268268
"eval" =>
269-
{
270-
_95percentile: 100000,
271-
avg: 150000,
272-
count: 2,
273-
max: 200000,
274-
median: 100000,
275-
min: 100000,
276-
sum: 300000,
277-
values: [100000, 200000]
278-
}
269+
{
270+
_95percentile: 100000,
271+
avg: 150000,
272+
count: 2,
273+
max: 200000,
274+
median: 100000,
275+
min: 100000,
276+
sum: 300000,
277+
values: [100000, 200000]
278+
}
279279
}
280280
}
281281
let(:bucket19) {
282282
{
283283
"eval" =>
284-
{
285-
_95percentile: 100000,
286-
avg: 250000,
287-
count: 2,
288-
max: 400000,
289-
median: 100000,
290-
min: 100000,
291-
sum: 500000,
292-
values: [400000, 100000]
293-
}
284+
{
285+
_95percentile: 100000,
286+
avg: 250000,
287+
count: 2,
288+
max: 400000,
289+
median: 100000,
290+
min: 100000,
291+
sum: 500000,
292+
values: [400000, 100000]
293+
}
294294
}
295295
}
296+
296297
it { is_expected.to eq(
297-
{
298-
Time.utc(2020,4,20,4,17).localtime => {},
299-
Time.utc(2020,4,20,4,18).localtime => bucket18,
300-
Time.utc(2020,4,20,4,19).localtime => bucket19,
301-
}
302-
)
298+
{
299+
Time.utc(2020,4,20,4,17).localtime => {},
300+
Time.utc(2020,4,20,4,18).localtime => bucket18,
301+
Time.utc(2020,4,20,4,19).localtime => bucket19,
302+
}
303+
)
303304
}
304305
end
305306

306307
describe '#default_tags' do
307308
subject { slowlog_check.default_tags }
308309
it { is_expected.to eq(
309-
{
310-
aws: 'true',
311-
env: 'test',
312-
namespace: 'rspec',
313-
replication_group: 'replicationgroup',
314-
service: 'replicationgroup',
315-
}
316-
)
310+
{
311+
aws: 'true',
312+
env: 'test',
313+
namespace: 'rspec',
314+
replication_group: 'replicationgroup',
315+
service: 'replicationgroup',
316+
}
317+
)
317318
}
318319
end
319320

@@ -325,14 +326,14 @@ def redis_slowlog(index, time, microseconds, command='eval')
325326
:interval=>60,
326327
:type=>"gauge",
327328
:tags=>
328-
{
329-
:aws=>"true",
330-
:command=>"eval",
331-
:env=>"test",
332-
:namespace=>"rspec",
333-
:replication_group=>"replicationgroup",
334-
:service=>"replicationgroup"
335-
}
329+
{
330+
:aws=>"true",
331+
:command=>"eval",
332+
:env=>"test",
333+
:namespace=>"rspec",
334+
:replication_group=>"replicationgroup",
335+
:service=>"replicationgroup"
336+
}
336337
}
337338
}
338339

@@ -360,22 +361,22 @@ def redis_slowlog(index, time, microseconds, command='eval')
360361
metric = name.split('.').last
361362
["200",
362363
{
363-
"description"=>"slowlog duration #{metric} (µs)",
364-
"short_name"=>"#{metric} (µs)",
365-
"integration"=>nil,
366-
"statsd_interval"=>60,
367-
"per_unit"=>nil,
368-
"type"=>"gauge",
369-
"unit"=>"microsecond"
370-
}
364+
"description"=>"slowlog duration #{metric} (µs)",
365+
"short_name"=>"#{metric} (µs)",
366+
"integration"=>nil,
367+
"statsd_interval"=>60,
368+
"per_unit"=>nil,
369+
"type"=>"gauge",
370+
"unit"=>"microsecond"
371+
}
371372
]
372373
}
373374
}
374375

375376
describe '#diff_metadatas' do
376377
subject { slowlog_check.diff_metadatas }
377378
let(:diff) {
378-
{
379+
{
379380
"name"=>"rspec.redis.slowlog.micros.count",
380381
"description"=>"slowlog entries per minute",
381382
"short_name"=>"per minute",
@@ -407,8 +408,8 @@ def redis_slowlog(index, time, microseconds, command='eval')
407408
subject
408409

409410
expect(ddog).to have_received(:update_metadata).with(
410-
'rspec.redis.slowlog.micros.count',
411-
diff
411+
'rspec.redis.slowlog.micros.count',
412+
diff
412413
)
413414
end
414415
end

0 commit comments

Comments
 (0)