wellness 0.1.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 92603932dbccf29905140576d88df9122d0f6b5b
4
- data.tar.gz: 67903699abe0a4d32ec6a59110c51dfea511273b
3
+ metadata.gz: 76f9b1fdc9a32250719692af2a9edee4def359f8
4
+ data.tar.gz: d3bbe4583ca4819d3384c6393cba810f50fe38d4
5
5
  SHA512:
6
- metadata.gz: 055987a1113450d41b444c847a86ae88302873be09728810cff488d53e43abdb30081b2fc92505c8cdb71c8d0ff70433305169f9f16077a6920d6c9c15ed423b
7
- data.tar.gz: 6d568347a584ed37b388593e16442e23f2dd4574a0b383290a6820d4958de20115cdc02480e4d0f75866fe83bd93b2c576c0bf1cd7d06047e6347ca69db99be6
6
+ metadata.gz: 2797c1c8566fcd651ea5e0700b702ac0527f364cc446e356a881d98f623369420e38b9dd3842a2bc66d8542a73ddad1c4e37d80103f006c00ac3876f157e1a54
7
+ data.tar.gz: e5d938acabfa64b940ae2c37fdee7b8a07c87b6649fce5b58cb075f7915285be1f4ee943c42210ec95ac126e3dfc5c4434087ae43f577981ef80ac132df8ecf4
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 1.9.3
5
+ notifications:
6
+ irc: "chat.freenode.net#warmwaffles"
7
+ env:
8
+ - CODECLIMATE_REPO_TOKEN=6212f00d1b8f97c85cf1e6478e12dafbb7325b3b51c6a3979aea7ea55e619c03
9
+ - CODECLIMATE_REPO_TOKEN=6212f00d1b8f97c85cf1e6478e12dafbb7325b3b51c6a3979aea7ea55e619c03
data/DOCUMENTATION.md ADDED
@@ -0,0 +1,78 @@
1
+ # HTTP Applications
2
+
3
+ Services **MUST** supply an endpoint for determining their health. Health and
4
+ status information **MUST** be supplied under the `/health` path. Responses for
5
+ health and status information **MUST** be valid json by default. Services
6
+ **MAY** be provided in other formats by supplying a `format` parameter with
7
+ appropriate values such as `xml`.
8
+
9
+ ## Status
10
+
11
+ A summarized status for a given application **MUST** be available from the
12
+ route `/health/status`. The response **MUST** be one of the following:
13
+
14
+ - `{ "status": "HEALTHY" }` with HTTP status code `200`
15
+ - `{ "status": "UNHEALTHY" }` with HTTP status code `500`
16
+
17
+ ## Details
18
+
19
+ Detailed status for a given application **MUST** be available from the route
20
+ `/health/details`. The response **MUST** be returned with in the following
21
+ format:
22
+
23
+ ```json
24
+ {
25
+ "status": "HEALTHY",
26
+ "details": {
27
+ "requests": {
28
+ "last_hour": 512,
29
+ "last_day": 12288
30
+ },
31
+ "top_consumers": {
32
+ "last_hour": {
33
+ "foo": 128,
34
+ "bar": 64,
35
+ "baz": 32
36
+ },
37
+ "last_day": {
38
+ "foo": 3072,
39
+ "bar": 1536,
40
+ "baz": 768
41
+ }
42
+ }
43
+ },
44
+ "dependencies": {
45
+ "cache": {
46
+ "status": "HEALTHY"
47
+ },
48
+ "database": {
49
+ "status": "HEALTHY",
50
+ "details": {
51
+ "connection": "read_write",
52
+ "reads": {
53
+ "last_hour": 1234,
54
+ "last_day": 29616
55
+ }
56
+ }
57
+ }
58
+ }
59
+ }
60
+ ```
61
+
62
+ ## Requirements
63
+
64
+ Top level keys, `status` and `dependencies` are **REQUIRED**.
65
+
66
+ * The `status` key **MUST** have one of the values listed in the specification
67
+ for the `/health/status` response
68
+ * A `details` key is **RECOMMENDED** to be included which contains a dictionary
69
+ of any metrics the service has.
70
+ * The `dependencies` key **MUST** contain a dictionary of all services on which
71
+ your service depends on.
72
+ * Keys **MUST** be unique for each service.
73
+ * Values **MUST** be a dictionary containing at least the key `status`
74
+ * Valid values for `status`:
75
+ * `HEALTHY`
76
+ *`UNHEALTHY`
77
+ * A `details` key **MAY** be added with any additional information to report
78
+ on the service.
data/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Wellness
2
2
 
3
+ [![Build Status](https://travis-ci.org/warmwaffles/wellness.png?branch=master)](https://travis-ci.org/warmwaffles/wellness)
4
+ [![Code Climate](https://codeclimate.com/repos/52d700d0e30ba038a9003919/badges/057ded44ac30dfe1950e/gpa.png)](https://codeclimate.com/repos/52d700d0e30ba038a9003919/feed)
5
+
6
+
3
7
  A rack middleware library that adds a health check to your service. It comes
4
8
  with pre made services and has the option and flexibility for you to make your
5
9
  own.
data/Rakefile CHANGED
@@ -1 +1,5 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+ task :default => :spec
data/lib/wellness.rb CHANGED
@@ -5,4 +5,3 @@ require 'wellness/version'
5
5
  require 'wellness/services/base'
6
6
  require 'wellness/system'
7
7
  require 'wellness/middleware'
8
- require 'wellness/checker'
@@ -8,7 +8,7 @@ module Wellness
8
8
  def check
9
9
  sidekiq_stats = Sidekiq::Stats.new
10
10
  queue = Sidekiq::Queue.new
11
- redis = Redis.new(host: params[:redis_host])
11
+ redis = Redis.new(self.params.fetch(:redis))
12
12
  redis_stats = redis.info.select { |k, _| KEYS.include?(k) }
13
13
  workers_size = redis.scard("workers").to_i
14
14
 
@@ -1,3 +1,3 @@
1
1
  module Wellness
2
- VERSION = '0.1.3'
2
+ VERSION = '0.2.0'
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,6 @@
1
+ require "codeclimate-test-reporter"
2
+ CodeClimate::TestReporter.start
3
+
1
4
  require 'rspec'
2
5
  require 'wellness'
3
6
 
data/wellness.gemspec CHANGED
@@ -21,4 +21,5 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency('bundler', '~> 1.3')
22
22
  spec.add_development_dependency('rake')
23
23
  spec.add_development_dependency('rspec')
24
+ spec.add_development_dependency('codeclimate-test-reporter')
24
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wellness
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Johnston
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: codeclimate-test-reporter
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  description: A rack middleware health check
56
70
  email:
57
71
  - warmwaffles@gmail.com
@@ -63,12 +77,13 @@ files:
63
77
  - .rspec
64
78
  - .ruby-gemset
65
79
  - .ruby-version
80
+ - .travis.yml
81
+ - DOCUMENTATION.md
66
82
  - Gemfile
67
83
  - LICENSE.txt
68
84
  - README.md
69
85
  - Rakefile
70
86
  - lib/wellness.rb
71
- - lib/wellness/checker.rb
72
87
  - lib/wellness/middleware.rb
73
88
  - lib/wellness/services/base.rb
74
89
  - lib/wellness/services/postgres_service.rb
@@ -1,7 +0,0 @@
1
- require 'wellness/middleware'
2
-
3
- module Wellness
4
- # Backwards compatibility. This isn't a proper name for something that is
5
- # supposed to be in the middleware.
6
- Checker = Wellness::Middleware
7
- end