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 +4 -4
- data/lib/mn_utils_gem/site_action.rb +11 -10
- data/lib/mn_utils_gem/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12c6e704cbba282538ead6cfb866b2a9c94dd2cfe907de8475a5da6c26b02aa4
|
4
|
+
data.tar.gz: 559c7e24aaadfb5ef9ef21ad6f4386e0ffa0343719f7d9f979acd7dde3893887
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
98
|
-
if
|
99
|
-
|
100
|
-
|
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
|
data/lib/mn_utils_gem/version.rb
CHANGED