puma-cloudwatch 0.4.4 → 0.4.8

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
  SHA256:
3
- metadata.gz: 8e2897967164e24f709d8c976d1fd9a5b741a01d020c2da8dcb191a9d4fe43ab
4
- data.tar.gz: bdb6f674505cd71c8423dd343c77a8521715425de02c2a6b418c1b9575e10d9e
3
+ metadata.gz: b0f5f9757f6fd2ca0da318c57d6e16f05072b2f7e004b7c67e863567e6a21feb
4
+ data.tar.gz: 354658460c267d9a730fd297f3b42e1d5d19b162a9503679d9f5f0ed40776138
5
5
  SHA512:
6
- metadata.gz: '0658266b02fa7ffa618b94bdc956c12b6536cb2eea17dcf2b7a4c39452b7adf1d96bc2e83544568739bc998ee9c76cf90416b9db3d2b174bcf9d759a0b07266a'
7
- data.tar.gz: de176da8000aec589ed539b3f0f6538a602344aab633c5dc7216307e21662f31405361525de134f0169288312af414c79b5065b14ff16a71bf257047ab9bc69d
6
+ metadata.gz: 28412c44a0d354767ef34d855f86560cb6f467d72ac1721897e4302a393f4d05fc3b5d681490008435c105c84c77b4d236662485282cffbb36df7e53fa662d85
7
+ data.tar.gz: 20437ec6faed3244a69f6ff90ba5cd6e4c1da64990509c222275133e588c718bd31dda8accb6c725946b486df474376ca78740bc5ba00cedd39d56c4258532f2
data/CHANGELOG.md CHANGED
@@ -3,6 +3,19 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/).
5
5
 
6
+ ## [0.4.8] - 2023-02-24
7
+ - [#10](https://github.com/tongueroo/puma-cloudwatch/pull/10) fix region if check
8
+ - loosen development dependencies
9
+
10
+ ## [0.4.7] - 2023-02-24
11
+ - [#9](https://github.com/tongueroo/puma-cloudwatch/pull/9) fix region if check
12
+
13
+ ## [0.4.6] - 2023-01-05
14
+ - [#7](https://github.com/tongueroo/puma-cloudwatch/pull/7) Add PUMA_CLOUDWATCH_AWS_REGION
15
+
16
+ ## [0.4.5] - 2021-11-09
17
+ - [#5](https://github.com/boltops-tools/puma-cloudwatch/pull/5) Enabling high-resolution Cloudwatch metrics if frequency is lower tha…
18
+
6
19
  ## [0.4.4]
7
20
  - #4 fix syntax error in older versions of ruby
8
21
 
data/README.md CHANGED
@@ -37,6 +37,7 @@ PUMA\_CLOUDWATCH\_DIMENSION\_VALUE | CloudWatch metric dimension value | puma
37
37
  PUMA\_CLOUDWATCH\_ENABLED | Enables sending of the data to CloudWatch. | (unset)
38
38
  PUMA\_CLOUDWATCH\_FREQUENCY | How often to send data to CloudWatch in seconds. | 60
39
39
  PUMA\_CLOUDWATCH\_NAMESPACE | CloudWatch metric namespace | WebServer
40
+ PUMA\_CLOUDWATCH\_AWS\_REGION | CloudWatch metric AWS region | (unset)
40
41
  PUMA\_CLOUDWATCH\_MUTE\_START\_MESSAGE | Mutes the "puma-cloudwatch plugin" startup message | (unset)
41
42
 
42
43
  ### Sum and Frequency Normalization
@@ -80,4 +81,4 @@ If are you using ECS awsvpc, make sure you have the task running on private subn
80
81
 
81
82
  ## Contributing
82
83
 
83
- Bug reports and pull requests are welcome on GitHub at https://github.com/tongueroo/puma-cloudwatch
84
+ Bug reports and pull requests are welcome on GitHub at https://github.com/boltops-tools/puma-cloudwatch
@@ -16,7 +16,9 @@ class PumaCloudwatch::Metrics
16
16
  @namespace = ENV['PUMA_CLOUDWATCH_NAMESPACE'] || "WebServer"
17
17
  @dimension_name = ENV['PUMA_CLOUDWATCH_DIMENSION_NAME'] || "App"
18
18
  @dimension_value = ENV['PUMA_CLOUDWATCH_DIMENSION_VALUE'] || "puma"
19
+ @frequency = Integer(ENV['PUMA_CLOUDWATCH_FREQUENCY'] || 60)
19
20
  @enabled = ENV['PUMA_CLOUDWATCH_ENABLED'] || false
21
+ @region = ENV['PUMA_CLOUDWATCH_AWS_REGION']
20
22
  end
21
23
 
22
24
  def call
@@ -55,6 +57,7 @@ class PumaCloudwatch::Metrics
55
57
  data << {
56
58
  metric_name: name.to_s,
57
59
  dimensions: dimensions,
60
+ storage_resolution: @frequency < 60 ? 1 : 60,
58
61
  statistic_values: {
59
62
  sample_count: values.length,
60
63
  sum: values.inject(0) { |sum, el| sum += el },
@@ -101,7 +104,12 @@ class PumaCloudwatch::Metrics
101
104
  end
102
105
 
103
106
  def cloudwatch
104
- @cloudwatch ||= Aws::CloudWatch::Client.new
107
+ @cloudwatch ||= if @region.nil? || @region.empty?
108
+ Aws::CloudWatch::Client.new
109
+ else
110
+ Aws::CloudWatch::Client.new(region: @region)
111
+ end
112
+
105
113
  rescue Aws::Errors::MissingRegionError => e
106
114
  # Happens when:
107
115
  # 1. ~/.aws/config is not also setup locally
@@ -1,3 +1,3 @@
1
1
  module PumaCloudwatch
2
- VERSION = "0.4.4"
2
+ VERSION = "0.4.8"
3
3
  end
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.email = ["tongueroo@gmail.com"]
10
10
 
11
11
  spec.summary = "Puma plugin sends puma stats to CloudWatch"
12
- spec.homepage = "https://github.com/tongueroo/puma-cloudwatch"
12
+ spec.homepage = "https://github.com/boltops-tools/puma-cloudwatch"
13
13
  spec.license = "MIT"
14
14
 
15
15
  # Specify which files should be added to the gem when it is released.
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  spec.add_dependency "aws-sdk-cloudwatch"
25
25
 
26
- spec.add_development_dependency "bundler", "~> 2.0"
27
- spec.add_development_dependency "rake", "~> 10.0"
28
- spec.add_development_dependency "rspec", "~> 3.0"
26
+ spec.add_development_dependency "bundler"
27
+ spec.add_development_dependency "rake"
28
+ spec.add_development_dependency "rspec"
29
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puma-cloudwatch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-26 00:00:00.000000000 Z
11
+ date: 2023-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-cloudwatch
@@ -28,45 +28,45 @@ dependencies:
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '2.0'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '2.0'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '10.0'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '3.0'
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '3.0'
69
- description:
68
+ version: '0'
69
+ description:
70
70
  email:
71
71
  - tongueroo@gmail.com
72
72
  executables: []
@@ -95,11 +95,11 @@ files:
95
95
  - lib/puma_cloudwatch/metrics/sender.rb
96
96
  - lib/puma_cloudwatch/version.rb
97
97
  - puma-cloudwatch.gemspec
98
- homepage: https://github.com/tongueroo/puma-cloudwatch
98
+ homepage: https://github.com/boltops-tools/puma-cloudwatch
99
99
  licenses:
100
100
  - MIT
101
101
  metadata: {}
102
- post_install_message:
102
+ post_install_message:
103
103
  rdoc_options: []
104
104
  require_paths:
105
105
  - lib
@@ -114,8 +114,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
114
  - !ruby/object:Gem::Version
115
115
  version: '0'
116
116
  requirements: []
117
- rubygems_version: 3.1.2
118
- signing_key:
117
+ rubygems_version: 3.3.26
118
+ signing_key:
119
119
  specification_version: 4
120
120
  summary: Puma plugin sends puma stats to CloudWatch
121
121
  test_files: []