mn_utils_gem 0.4.0 → 1.1.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
  SHA256:
3
- metadata.gz: 70ae8ad27e749906b14ea11635f92fb244ced2c217b1822324451a825d765545
4
- data.tar.gz: 5154105cc37031f73afe04ecb954c244f524c79279c2e29ddf60c1fd23e68cd9
3
+ metadata.gz: 12c6e704cbba282538ead6cfb866b2a9c94dd2cfe907de8475a5da6c26b02aa4
4
+ data.tar.gz: 559c7e24aaadfb5ef9ef21ad6f4386e0ffa0343719f7d9f979acd7dde3893887
5
5
  SHA512:
6
- metadata.gz: 6b93c8badd0cb3c373be3418645654a43a641a2d6af90d550b8edca06ab65538b355c2f610f983e648edad43f6f41430c9a91589b7293d75d2d172892b92f54d
7
- data.tar.gz: 593601ff2eccbf62105eb83418bdc1628987213e5b89484ef840a64895cd7a4b458044a1ff40906846a349bcdc6e542810f71ebc8f8df52f8cfd73b39a9c98f3
6
+ metadata.gz: a5541301eef6d03c5007545ea9caa38fcecac11c18fdb52c460cd26982608a6ed05cd00fc00a5f353a5ad47c9bf5458adaa760f45c522b48f4b8bb72c1ded66f
7
+ data.tar.gz: 326e3d390324ccab7fc784044b87a5732815d0c77fd489a0bfa00cdf654dc959a312156a4a4d59ab065e40d3fdcce31b8ca44485ed5a1019e4634cbcc732d87f
@@ -83,21 +83,17 @@ module MnUtils
83
83
  unless value.is_a?(String)
84
84
  end
85
85
 
86
- # validate the environment variables we need
87
- raise ArgumentError, "ENV['SRV_CODE'] cannot be blank" \
88
- unless ENV.key? 'SRV_CODE'
89
-
90
86
  # setup the full payload
91
87
  full_payload = payload.dup
92
88
  full_payload[:short_message] = message
93
89
  full_payload[:_site_action_group] = @_site_action_group_map[site_action]
94
90
  full_payload[:_site_action] = site_action
95
- full_payload[:_srv_code] = ENV['SRV_CODE']
96
91
 
97
- # add the request ID if available
98
- if RequestStore.store[:request_id]
99
- full_payload[:_request_id] = RequestStore.store[:request_id]
100
- end
92
+ # add other data to the payload if available
93
+ full_payload[:_srv_code] = ENV['SRV_CODE'] if ENV.key? 'SRV_CODE'
94
+ full_payload[:_site_hostname] = ENV['SITE_HOSTNAME'] if ENV.key? 'SITE_HOSTNAME'
95
+ full_payload[:_request_id] = RequestStore.store[:request_id] if RequestStore.store[:request_id]
96
+ full_payload[:_remote_ip] = RequestStore.store[:remote_ip] if RequestStore.store[:remote_ip]
101
97
 
102
98
  # send it off
103
99
  send_to_graylog full_payload
@@ -124,13 +120,18 @@ module MnUtils
124
120
  value: 1,
125
121
  unit: "Count"
126
122
  }]
127
- if ENV.key? 'CLOUDWATCH_ROOT_NAMESPACE'
123
+ if ENV.key? ('CLOUDWATCH_ROOT_NAMESPACE')
128
124
  root_namespace = ENV['CLOUDWATCH_ROOT_NAMESPACE']
129
125
  second_namespace = payload[:_site_action_group]
130
126
  namespace = "#{root_namespace}/#{second_namespace}"
127
+ dimension_value = payload[:_site_hostname]
131
128
  cw = Aws::CloudWatch::Client.new
132
129
  cw.put_metric_data({
133
130
  namespace: namespace,
131
+ dimensions: [{
132
+ name: "site_hostname",
133
+ value: dimension_value
134
+ }],
134
135
  metric_data: metric_data
135
136
  })
136
137
  else
@@ -1,3 +1,3 @@
1
1
  module MnUtilsGem
2
- VERSION = "0.4.0"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mn_utils_gem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shamim Mirzai