passenger-metrics 0.0.1 → 0.0.5

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
- SHA1:
3
- metadata.gz: 4253eefcd53799123022aeee6e5f0f60df2685c7
4
- data.tar.gz: f51be74d6c4503a6c48c71ee64d775feb5523d6d
2
+ SHA256:
3
+ metadata.gz: a0ece3183790878ef70152c7ffd4c33119c9e126fd0cc4a0f0034fd164ff1a80
4
+ data.tar.gz: 8d14dc5b1879632605400d877906d3bbc64f4f19e42307d9120c6836f78af377
5
5
  SHA512:
6
- metadata.gz: a7a0cff0a03d344f4af6fe120f6137b34cdd7dec29bc6e9f0c3fa834428c6c96fc3912814a9918095b1259b17b72a5415204c9a9f71eabf054d057cde34bd276
7
- data.tar.gz: f5e410c4f676b368885f2c81b33ae7f4f18c3fd55c28ece11f1f6c78801bb2eabc2df8c06188e45f2cb93f642eaf3c64839e7c2b9ce617552cf8e665a6d590de
6
+ metadata.gz: cce9a96901b6aa622ae60bc1d3606baf245143bb96f45bb774165902945b3166a7cee3c0215b4ea6e3a64e299069b2af2f2c32494d1be0f7f807a362e3577109
7
+ data.tar.gz: 0a87aa5880719787514a62a18c9792e327a4dc10771cc4b79bb8cc5519c41f0789ce8a48c5586035be049f0034f2720edf9610a3f0f939e6e31f11edd58f02b8
@@ -0,0 +1,14 @@
1
+ name: CI
2
+ on: [push]
3
+
4
+ jobs:
5
+ test:
6
+ runs-on: ubuntu-latest
7
+ steps:
8
+ - uses: actions/checkout@v2
9
+ - uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6
10
+ with:
11
+ ruby-version: 2.7
12
+ bundler-cache: true
13
+ - run: bundle install
14
+ - run: bundle exec rspec
data/Gemfile CHANGED
@@ -1,15 +1,12 @@
1
1
  source "http://rubygems.org"
2
- # Add dependencies required to use your gem here.
3
- gem 'crack'
4
- gem 'aws-sdk'
5
2
 
6
- # Add dependencies to develop your gem here.
7
- # Include everything needed to run rake, tests, features, etc.
3
+ gem 'crack', '~> 0.4.3'
4
+ gem 'aws-sdk-cloudwatch'
5
+
8
6
  group :development do
9
- gem "rspec", ">= 0"
10
- gem "bundler", "~> 1.0"
11
- gem "jeweler", "~> 2.0.1"
12
- gem 'guard'
7
+ gem 'rspec', '>= 0'
8
+ gem 'jeweler', '~> 2.1', '>= 2.1.2'
9
+ gem 'guard', '~> 2.13'
13
10
  gem 'guard-rspec', require: false
14
11
  gem 'byebug'
15
12
  end
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
1
  # passenger-metrics
2
2
  A ruby gem for reading metrics from the passenger-status command.
3
3
 
4
-
4
+ [![CI Status](https://github.com/controlshift/passenger-metrics/actions/workflows/ci.yml/badge.svg)](https://github.com/controlshift/passenger-metrics/actions/workflows/ci.yml)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.4
@@ -1,13 +1,18 @@
1
- require 'aws-sdk'
1
+ require 'aws-sdk-cloudwatch'
2
2
  require 'crack'
3
3
 
4
4
  module PassengerMetrics
5
5
  def self.status
6
6
  @status ||= PassengerMetrics::Status.new
7
7
  end
8
+
9
+ def self.instance_id
10
+ @instance_id ||= Net::HTTP.get( URI.parse('http://169.254.169.254/latest/meta-data/instance-id' ) )
11
+ end
8
12
  end
9
13
 
10
14
  require 'passenger-metrics/metrics/base'
11
15
  require 'passenger-metrics/metrics/queue_length'
16
+ require 'passenger-metrics/metrics/process_count'
12
17
  require 'passenger-metrics/status'
13
18
  require 'passenger-metrics/cloudwatch'
@@ -1,3 +1,5 @@
1
+ require 'net/http'
2
+
1
3
  module PassengerMetrics
2
4
  class Cloudwatch
3
5
  DEFAULT_NAMESPACE = "Passenger"
@@ -43,7 +45,7 @@ module PassengerMetrics
43
45
  end
44
46
 
45
47
  def metric_name
46
- ENV["AWS_CLOUDWATCH_METRIC_NAME"] || DEFAULT_METRIC_NAME
48
+ metric.metric_name || ENV["AWS_CLOUDWATCH_METRIC_NAME"] || DEFAULT_METRIC_NAME
47
49
  end
48
50
 
49
51
  def dimension_name
@@ -51,7 +53,7 @@ module PassengerMetrics
51
53
  end
52
54
 
53
55
  def dimension_value
54
- ENV["AWS_CLOUDWATCH_DIMENSION_VALUE"] || DEFAULT_DIMENSION_VALUE
56
+ ENV["AWS_CLOUDWATCH_DIMENSION_VALUE"] || instance_id || DEFAULT_DIMENSION_VALUE
55
57
  end
56
58
 
57
59
  def dimensions
@@ -77,5 +79,9 @@ module PassengerMetrics
77
79
  def client
78
80
  @client ||= ::Aws::CloudWatch::Client.new region: 'us-east-1'
79
81
  end
82
+
83
+ def instance_id
84
+ PassengerMetrics.instance_id
85
+ end
80
86
  end
81
87
  end
@@ -0,0 +1,18 @@
1
+ module PassengerMetrics
2
+ module Metrics
3
+ class ProcessCount < PassengerMetrics::Metrics::Base
4
+ def unit
5
+ :count
6
+ end
7
+
8
+ def value
9
+ PassengerMetrics.status.info['process_count']
10
+ end
11
+
12
+ def metric_name
13
+ 'PassengerProcessCount'
14
+ end
15
+
16
+ end
17
+ end
18
+ end
@@ -8,6 +8,10 @@ module PassengerMetrics
8
8
  def value
9
9
  PassengerMetrics.status.info['get_wait_list_size']
10
10
  end
11
+
12
+ def metric_name
13
+ 'PassengerQueueLenght'
14
+ end
11
15
  end
12
16
  end
13
17
  end
@@ -2,27 +2,27 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: passenger-metrics 0.0.1 ruby lib
5
+ # stub: passenger-metrics 0.0.4 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
- s.name = "passenger-metrics"
9
- s.version = "0.0.1"
8
+ s.name = "passenger-metrics".freeze
9
+ s.version = "0.0.5"
10
10
 
11
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
- s.require_paths = ["lib"]
13
- s.authors = ["Nathan Woodhull"]
14
- s.date = "2016-03-09"
15
- s.description = "Get passenger metrics from passenger-status into the analytics tool of your choice."
16
- s.email = "nathan@gcontrolshiftlabs.com"
17
- s.executables = ["passenger-metrics-cloudwatch"]
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib".freeze]
13
+ s.authors = ["Nathan Woodhull".freeze]
14
+ s.date = "2021-08-04"
15
+ s.description = "Get passenger metrics from passenger-status into the analytics tool of your choice.".freeze
16
+ s.email = "nathan@gcontrolshiftlabs.com".freeze
17
+ s.executables = ["passenger-metrics-cloudwatch".freeze]
18
18
  s.extra_rdoc_files = [
19
19
  "LICENSE",
20
20
  "README.md"
21
21
  ]
22
22
  s.files = [
23
+ ".github/workflows/ci.yml",
23
24
  ".rspec",
24
25
  "Gemfile",
25
- "Gemfile.lock",
26
26
  "Guardfile",
27
27
  "LICENSE",
28
28
  "README.md",
@@ -34,52 +34,43 @@ Gem::Specification.new do |s|
34
34
  "lib/passenger-metrics.rb",
35
35
  "lib/passenger-metrics/cloudwatch.rb",
36
36
  "lib/passenger-metrics/metrics/base.rb",
37
+ "lib/passenger-metrics/metrics/process_count.rb",
37
38
  "lib/passenger-metrics/metrics/queue_length.rb",
38
39
  "lib/passenger-metrics/status.rb",
39
40
  "passenger-metrics.gemspec",
40
41
  "spec/fixtures/status.xml",
41
42
  "spec/passenger-metrics/cloudwatch_spec.rb",
43
+ "spec/passenger-metrics/metrics/process_count_spec.rb",
42
44
  "spec/passenger-metrics/status_spec.rb",
43
45
  "spec/passenger_metrics_spec.rb",
44
46
  "spec/spec_helper.rb",
45
47
  "spec/status_spec.rb"
46
48
  ]
47
- s.homepage = "http://github.com/controlshift/passenger-metrics"
48
- s.licenses = ["MIT"]
49
- s.rubygems_version = "2.4.8"
50
- s.summary = "ruby interface to passenger-status"
49
+ s.homepage = "http://github.com/controlshift/passenger-metrics".freeze
50
+ s.licenses = ["MIT".freeze]
51
+ s.rubygems_version = "3.1.6".freeze
52
+ s.summary = "ruby interface to passenger-status".freeze
51
53
 
52
54
  if s.respond_to? :specification_version then
53
55
  s.specification_version = 4
56
+ end
54
57
 
55
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
56
- s.add_runtime_dependency(%q<crack>, [">= 0"])
57
- s.add_runtime_dependency(%q<aws-sdk>, [">= 0"])
58
- s.add_development_dependency(%q<rspec>, [">= 0"])
59
- s.add_development_dependency(%q<bundler>, ["~> 1.0"])
60
- s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
61
- s.add_development_dependency(%q<guard>, [">= 0"])
62
- s.add_development_dependency(%q<guard-rspec>, [">= 0"])
63
- s.add_development_dependency(%q<byebug>, [">= 0"])
64
- else
65
- s.add_dependency(%q<crack>, [">= 0"])
66
- s.add_dependency(%q<aws-sdk>, [">= 0"])
67
- s.add_dependency(%q<rspec>, [">= 0"])
68
- s.add_dependency(%q<bundler>, ["~> 1.0"])
69
- s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
70
- s.add_dependency(%q<guard>, [">= 0"])
71
- s.add_dependency(%q<guard-rspec>, [">= 0"])
72
- s.add_dependency(%q<byebug>, [">= 0"])
73
- end
58
+ if s.respond_to? :add_runtime_dependency then
59
+ s.add_runtime_dependency(%q<crack>.freeze, ["~> 0.4.3"])
60
+ s.add_runtime_dependency(%q<aws-sdk-cloudwatch>.freeze, [">= 0"])
61
+ s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
62
+ s.add_development_dependency(%q<jeweler>.freeze, ["~> 2.1", ">= 2.1.2"])
63
+ s.add_development_dependency(%q<guard>.freeze, ["~> 2.13"])
64
+ s.add_development_dependency(%q<guard-rspec>.freeze, [">= 0"])
65
+ s.add_development_dependency(%q<byebug>.freeze, [">= 0"])
74
66
  else
75
- s.add_dependency(%q<crack>, [">= 0"])
76
- s.add_dependency(%q<aws-sdk>, [">= 0"])
77
- s.add_dependency(%q<rspec>, [">= 0"])
78
- s.add_dependency(%q<bundler>, ["~> 1.0"])
79
- s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
80
- s.add_dependency(%q<guard>, [">= 0"])
81
- s.add_dependency(%q<guard-rspec>, [">= 0"])
82
- s.add_dependency(%q<byebug>, [">= 0"])
67
+ s.add_dependency(%q<crack>.freeze, ["~> 0.4.3"])
68
+ s.add_dependency(%q<aws-sdk-cloudwatch>.freeze, [">= 0"])
69
+ s.add_dependency(%q<rspec>.freeze, [">= 0"])
70
+ s.add_dependency(%q<jeweler>.freeze, ["~> 2.1", ">= 2.1.2"])
71
+ s.add_dependency(%q<guard>.freeze, ["~> 2.13"])
72
+ s.add_dependency(%q<guard-rspec>.freeze, [">= 0"])
73
+ s.add_dependency(%q<byebug>.freeze, [">= 0"])
83
74
  end
84
75
  end
85
76
 
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe PassengerMetrics::Metrics::ProcessCount do
4
+ it 'should have a metric name' do
5
+ expect(subject.metric_name).to eq('PassengerProcessCount')
6
+ end
7
+ end
metadata CHANGED
@@ -1,31 +1,31 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: passenger-metrics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Woodhull
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-09 00:00:00.000000000 Z
11
+ date: 2021-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: crack
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 0.4.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 0.4.3
27
27
  - !ruby/object:Gem::Dependency
28
- name: aws-sdk
28
+ name: aws-sdk-cloudwatch
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -52,48 +52,40 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: bundler
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '1.0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '1.0'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: jeweler
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
59
  - - "~>"
74
60
  - !ruby/object:Gem::Version
75
- version: 2.0.1
61
+ version: '2.1'
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: 2.1.2
76
65
  type: :development
77
66
  prerelease: false
78
67
  version_requirements: !ruby/object:Gem::Requirement
79
68
  requirements:
80
69
  - - "~>"
81
70
  - !ruby/object:Gem::Version
82
- version: 2.0.1
71
+ version: '2.1'
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 2.1.2
83
75
  - !ruby/object:Gem::Dependency
84
76
  name: guard
85
77
  requirement: !ruby/object:Gem::Requirement
86
78
  requirements:
87
- - - ">="
79
+ - - "~>"
88
80
  - !ruby/object:Gem::Version
89
- version: '0'
81
+ version: '2.13'
90
82
  type: :development
91
83
  prerelease: false
92
84
  version_requirements: !ruby/object:Gem::Requirement
93
85
  requirements:
94
- - - ">="
86
+ - - "~>"
95
87
  - !ruby/object:Gem::Version
96
- version: '0'
88
+ version: '2.13'
97
89
  - !ruby/object:Gem::Dependency
98
90
  name: guard-rspec
99
91
  requirement: !ruby/object:Gem::Requirement
@@ -132,9 +124,9 @@ extra_rdoc_files:
132
124
  - LICENSE
133
125
  - README.md
134
126
  files:
127
+ - ".github/workflows/ci.yml"
135
128
  - ".rspec"
136
129
  - Gemfile
137
- - Gemfile.lock
138
130
  - Guardfile
139
131
  - LICENSE
140
132
  - README.md
@@ -146,11 +138,13 @@ files:
146
138
  - lib/passenger-metrics.rb
147
139
  - lib/passenger-metrics/cloudwatch.rb
148
140
  - lib/passenger-metrics/metrics/base.rb
141
+ - lib/passenger-metrics/metrics/process_count.rb
149
142
  - lib/passenger-metrics/metrics/queue_length.rb
150
143
  - lib/passenger-metrics/status.rb
151
144
  - passenger-metrics.gemspec
152
145
  - spec/fixtures/status.xml
153
146
  - spec/passenger-metrics/cloudwatch_spec.rb
147
+ - spec/passenger-metrics/metrics/process_count_spec.rb
154
148
  - spec/passenger-metrics/status_spec.rb
155
149
  - spec/passenger_metrics_spec.rb
156
150
  - spec/spec_helper.rb
@@ -174,8 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
168
  - !ruby/object:Gem::Version
175
169
  version: '0'
176
170
  requirements: []
177
- rubyforge_project:
178
- rubygems_version: 2.4.8
171
+ rubygems_version: 3.1.6
179
172
  signing_key:
180
173
  specification_version: 4
181
174
  summary: ruby interface to passenger-status
data/Gemfile.lock DELETED
@@ -1,124 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- addressable (2.4.0)
5
- aws-sdk (2.2.24)
6
- aws-sdk-resources (= 2.2.24)
7
- aws-sdk-core (2.2.24)
8
- jmespath (~> 1.0)
9
- aws-sdk-resources (2.2.24)
10
- aws-sdk-core (= 2.2.24)
11
- builder (3.2.2)
12
- byebug (8.2.2)
13
- coderay (1.1.1)
14
- crack (0.4.3)
15
- safe_yaml (~> 1.0.0)
16
- descendants_tracker (0.0.4)
17
- thread_safe (~> 0.3, >= 0.3.1)
18
- diff-lcs (1.2.5)
19
- faraday (0.9.2)
20
- multipart-post (>= 1.2, < 3)
21
- ffi (1.9.10)
22
- formatador (0.2.5)
23
- git (1.3.0)
24
- github_api (0.13.1)
25
- addressable (~> 2.4.0)
26
- descendants_tracker (~> 0.0.4)
27
- faraday (~> 0.8, < 0.10)
28
- hashie (>= 3.4)
29
- multi_json (>= 1.7.5, < 2.0)
30
- oauth2
31
- guard (2.13.0)
32
- formatador (>= 0.2.4)
33
- listen (>= 2.7, <= 4.0)
34
- lumberjack (~> 1.0)
35
- nenv (~> 0.1)
36
- notiffany (~> 0.0)
37
- pry (>= 0.9.12)
38
- shellany (~> 0.0)
39
- thor (>= 0.18.1)
40
- guard-compat (1.2.1)
41
- guard-rspec (4.6.4)
42
- guard (~> 2.1)
43
- guard-compat (~> 1.1)
44
- rspec (>= 2.99.0, < 4.0)
45
- hashie (3.4.3)
46
- highline (1.7.8)
47
- jeweler (2.0.1)
48
- builder
49
- bundler (>= 1.0)
50
- git (>= 1.2.5)
51
- github_api
52
- highline (>= 1.6.15)
53
- nokogiri (>= 1.5.10)
54
- rake
55
- rdoc
56
- jmespath (1.1.3)
57
- json (1.8.3)
58
- jwt (1.5.1)
59
- listen (3.0.6)
60
- rb-fsevent (>= 0.9.3)
61
- rb-inotify (>= 0.9.7)
62
- lumberjack (1.0.10)
63
- method_source (0.8.2)
64
- mini_portile2 (2.0.0)
65
- multi_json (1.11.2)
66
- multi_xml (0.5.5)
67
- multipart-post (2.0.0)
68
- nenv (0.3.0)
69
- nokogiri (1.6.7.2)
70
- mini_portile2 (~> 2.0.0.rc2)
71
- notiffany (0.0.8)
72
- nenv (~> 0.1)
73
- shellany (~> 0.0)
74
- oauth2 (1.1.0)
75
- faraday (>= 0.8, < 0.10)
76
- jwt (~> 1.0, < 1.5.2)
77
- multi_json (~> 1.3)
78
- multi_xml (~> 0.5)
79
- rack (>= 1.2, < 3)
80
- pry (0.10.3)
81
- coderay (~> 1.1.0)
82
- method_source (~> 0.8.1)
83
- slop (~> 3.4)
84
- rack (1.6.4)
85
- rake (10.5.0)
86
- rb-fsevent (0.9.7)
87
- rb-inotify (0.9.7)
88
- ffi (>= 0.5.0)
89
- rdoc (4.2.2)
90
- json (~> 1.4)
91
- rspec (3.4.0)
92
- rspec-core (~> 3.4.0)
93
- rspec-expectations (~> 3.4.0)
94
- rspec-mocks (~> 3.4.0)
95
- rspec-core (3.4.3)
96
- rspec-support (~> 3.4.0)
97
- rspec-expectations (3.4.0)
98
- diff-lcs (>= 1.2.0, < 2.0)
99
- rspec-support (~> 3.4.0)
100
- rspec-mocks (3.4.1)
101
- diff-lcs (>= 1.2.0, < 2.0)
102
- rspec-support (~> 3.4.0)
103
- rspec-support (3.4.1)
104
- safe_yaml (1.0.4)
105
- shellany (0.0.1)
106
- slop (3.6.0)
107
- thor (0.19.1)
108
- thread_safe (0.3.5)
109
-
110
- PLATFORMS
111
- ruby
112
-
113
- DEPENDENCIES
114
- aws-sdk
115
- bundler (~> 1.0)
116
- byebug
117
- crack
118
- guard
119
- guard-rspec
120
- jeweler (~> 2.0.1)
121
- rspec
122
-
123
- BUNDLED WITH
124
- 1.11.2