updown 0.3.1 → 0.4.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +26 -0
- data/lib/updown/call.rb +6 -2
- data/lib/updown/check.rb +6 -1
- data/lib/updown/cli.rb +0 -1
- data/lib/updown/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11ad73d000351864816dc649ba37815d432f9dba
|
4
|
+
data.tar.gz: 4d38bdc654d9a62fc14d697811a579937afb2463
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5c7d7112b065d20fdaf5b626109bd4bf282f2ea833a1a75749ce6a0c4b2b735e8ef5bcb8dfef6df5f9d0bf535786e76daef73a182f945e1dbd83955b3ea8fa8
|
7
|
+
data.tar.gz: ce936d0df39b4cd0393bd702c4551b88bb7ca1d25358cc179430ec9efb8e09c37ac9df82648283ca3d14d45a06351bcc3084bb63372574f0cefacb01d826ce46
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -45,6 +45,11 @@ Retrieve a specific check:
|
|
45
45
|
```ruby
|
46
46
|
Updown::Check.get check_token
|
47
47
|
# => <Updown::Check>
|
48
|
+
|
49
|
+
# include performance metrics for the last hour
|
50
|
+
check = Updown::Check.get check_token, metrics: true
|
51
|
+
check.metrics
|
52
|
+
# => {"apdex": 0.98, "requests": { … }, "timings": { … }}
|
48
53
|
```
|
49
54
|
|
50
55
|
List downtimes for a specific check (paginated, 100 per call):
|
@@ -57,6 +62,27 @@ check.downtimes page: 2
|
|
57
62
|
# => [<Updown::Downtime>]
|
58
63
|
```
|
59
64
|
|
65
|
+
Get detailed performance metrics for a specific check:
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
# Default is for last month
|
69
|
+
check.get_metrics
|
70
|
+
# => {"apdex": 0.98, "requests": { … }, "timings": { … }}
|
71
|
+
|
72
|
+
# Specify time span
|
73
|
+
check.get_metrics from: 4.hours.ago, to: 2.hours.ago
|
74
|
+
# => {"apdex": 1, "requests": { … }, "timings": { … }}
|
75
|
+
|
76
|
+
# Specify grouping per location (:host) or hour (:time)
|
77
|
+
check.get_metrics group: :host
|
78
|
+
# => {
|
79
|
+
# "sgp" => {"apdex": 0.82, "host": { city: "Singapore", … }, … },
|
80
|
+
# "sfo" => {"apdex": 0.98, "host": { city: "San Francisco", … }, … },
|
81
|
+
# "alpha" => {"apdex": 0.98, "host": { city: "Montreal", … }, … },
|
82
|
+
# "gra" => {"apdex": 0.92, "host": { city: "Gravelines", … }, … }
|
83
|
+
# }
|
84
|
+
```
|
85
|
+
|
60
86
|
Create a new check:
|
61
87
|
|
62
88
|
```ruby
|
data/lib/updown/call.rb
CHANGED
@@ -17,12 +17,16 @@ module Updown
|
|
17
17
|
process { Call.resource["checks/#{token}/downtimes"].get(params: filters) }
|
18
18
|
end
|
19
19
|
|
20
|
+
def self.metrics(token, filters={})
|
21
|
+
process { Call.resource["checks/#{token}/metrics"].get(params: filters) }
|
22
|
+
end
|
23
|
+
|
20
24
|
def self.create_check(attributes={})
|
21
25
|
process { Call.resource['checks'].post(attributes) }
|
22
26
|
end
|
23
27
|
|
24
28
|
def self.get_check(token, attributes={})
|
25
|
-
process { Call.resource["checks/#{token}"].get(attributes) }
|
29
|
+
process { Call.resource["checks/#{token}"].get(params: attributes) }
|
26
30
|
end
|
27
31
|
|
28
32
|
def self.update_check(token, attributes={})
|
@@ -37,7 +41,7 @@ module Updown
|
|
37
41
|
JSON.parse yield
|
38
42
|
rescue RestClient::BadRequest, RestClient::Unauthorized, RestClient::ResourceNotFound => e
|
39
43
|
result = (JSON.parse(e.response) rescue {})
|
40
|
-
raise Updown::Error.new(result['error'] || e.
|
44
|
+
raise Updown::Error.new(result['error'] || e.response)
|
41
45
|
end
|
42
46
|
|
43
47
|
end
|
data/lib/updown/check.rb
CHANGED
@@ -2,7 +2,7 @@ require 'time'
|
|
2
2
|
|
3
3
|
module Updown
|
4
4
|
class Check
|
5
|
-
attr_accessor :token, :url, :alias, :last_status, :uptime, :down, :down_since, :error, :period, :apdex_t, :enabled, :published, :last_check_at, :next_check_at, :ssl_tested_at, :ssl_valid, :ssl_error
|
5
|
+
attr_accessor :token, :url, :alias, :last_status, :uptime, :down, :down_since, :error, :period, :apdex_t, :enabled, :published, :last_check_at, :next_check_at, :ssl_tested_at, :ssl_valid, :ssl_error, :metrics
|
6
6
|
|
7
7
|
def self.all
|
8
8
|
Updown::Call.checks.map do |check|
|
@@ -30,6 +30,7 @@ module Updown
|
|
30
30
|
@uptime = json['uptime']
|
31
31
|
@down = json['down']
|
32
32
|
@error = json['error']
|
33
|
+
@metrics = json['metrics']
|
33
34
|
@down_since = Time.parse(json['down_since']) if json['down_since']
|
34
35
|
@last_check_at = Time.parse(json['last_check_at']) if json['last_check_at']
|
35
36
|
@next_check_at = Time.parse(json['next_check_at']) if json['next_check_at']
|
@@ -44,6 +45,10 @@ module Updown
|
|
44
45
|
Downtime.find(@token, page: page)
|
45
46
|
end
|
46
47
|
|
48
|
+
def get_metrics filters = {}
|
49
|
+
Updown::Call.metrics(@token, filters)
|
50
|
+
end
|
51
|
+
|
47
52
|
def update(attributes={})
|
48
53
|
Check.new Updown::Call.update_check(@token, attributes)
|
49
54
|
end
|
data/lib/updown/cli.rb
CHANGED
data/lib/updown/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: updown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aske Hansen
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-06-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -143,3 +143,4 @@ signing_key:
|
|
143
143
|
specification_version: 4
|
144
144
|
summary: updown.io API wrapper
|
145
145
|
test_files: []
|
146
|
+
has_rdoc:
|