Skip to content

Commit 732dd38

Browse files
committed
feat: make the worst case scenario an hour ago,
since Datadog discards anything that isn't [current](https://docs.datadoghq.com/api/?lang=ruby#post-timeseries-points)
1 parent ddbae62 commit 732dd38

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/slowlog_check.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def minute_precision(time)
5050
def last_datadog_metric
5151
series = last_datadog_metrics_submitted_by_me_in_the_last_day[1].fetch("series")
5252
if series == [] # First invocation
53-
return Time.at(0)
53+
return minute_precision(Time.now - 3600)
5454
else
5555
minute_precision(
5656
Time.at(

spec/slowlog_check_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@
133133
subject { slowlog_check.last_datadog_metric}
134134

135135
context 'first time' do
136-
it 'returns epoch time' do
136+
it 'returns time an hour ago' do
137137
allow(ddog).to receive(:get_points) { ["", {"status" => "ok", "series" => [] }] }
138-
expect(subject).to eq(Time.at(0))
138+
expect(subject).to eq(Time.new(2020,4,20,3,20))
139139
end
140140
end
141141

0 commit comments

Comments
 (0)