routes_alerts 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/routes_alerts/configuration.rb +6 -3
- data/lib/routes_alerts/metrics/base.rb +8 -0
- data/lib/routes_alerts/metrics/count.rb +1 -1
- data/lib/routes_alerts/metrics/duration.rb +1 -1
- data/lib/routes_alerts/metrics/success_rate.rb +1 -1
- data/lib/routes_alerts/route_info.rb +3 -2
- 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: 507916212fa50b3f50d12971679eb82284846784e43ff9d42f45a424ed540872
|
|
4
|
+
data.tar.gz: 3c8dd268b44a2e2edcdd66dbe6a8cfcd3d9882e40e0613a8901a1c8036b2851b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 716989e6b4be6e7b78ed39ccf87308e516f49b310e9e52cb6b17dde1f53112eb941ce4da130d862c4de093fb078bd2f06bda6379d361dc677b955cba20fbfd97
|
|
7
|
+
data.tar.gz: 6d112924ece3d3c1c71470fd536641631b7565c78be35090b2ce6f926dd763d815df995b2ee1e548f645cd9aec4ae848ffdb5d1d83babb421658f1f5933140a4
|
|
@@ -20,7 +20,8 @@ module RoutesAlerts
|
|
|
20
20
|
:default_log_group_name,
|
|
21
21
|
:default_namespace,
|
|
22
22
|
:cloudwatch_logs,
|
|
23
|
-
:default_actions
|
|
23
|
+
:default_actions,
|
|
24
|
+
:prefix
|
|
24
25
|
|
|
25
26
|
def initialize
|
|
26
27
|
@cloudwatch_logs = Aws::CloudWatchLogs::Client.new(region: "us-west-2")
|
|
@@ -32,9 +33,10 @@ module RoutesAlerts
|
|
|
32
33
|
@default_metrics = RoutesAlerts::Metrics::DEFAULT_METRICS
|
|
33
34
|
@routes = []
|
|
34
35
|
@default_actions = []
|
|
36
|
+
@prefix = ""
|
|
35
37
|
end
|
|
36
38
|
|
|
37
|
-
def add_route(path:, method:, max_duration
|
|
39
|
+
def add_route(path:, method:, max_duration: nil, min_count: nil, success_rate: nil, alarm_period: nil, number_of_datapoints: nil, metrics: nil, namespace: nil, log_group_name: nil, actions: nil)
|
|
38
40
|
route_info = RoutesAlerts::RouteInfo.new(
|
|
39
41
|
path: path.to_s,
|
|
40
42
|
method: method.to_s.upcase,
|
|
@@ -46,7 +48,8 @@ module RoutesAlerts
|
|
|
46
48
|
log_group_name: (log_group_name || default_log_group_name),
|
|
47
49
|
namespace: (namespace || default_namespace),
|
|
48
50
|
actions: (actions || default_actions),
|
|
49
|
-
metrics: (metrics || default_metrics)
|
|
51
|
+
metrics: (metrics || default_metrics),
|
|
52
|
+
prefix: prefix
|
|
50
53
|
)
|
|
51
54
|
self.routes << route_info
|
|
52
55
|
end
|
|
@@ -24,7 +24,7 @@ class RoutesAlerts::Count < RoutesAlerts::Base
|
|
|
24
24
|
|
|
25
25
|
def alarm_params
|
|
26
26
|
{
|
|
27
|
-
alarm_name: "Alarm-#{RoutesAlerts::Metrics::COUNT_METRIC_NAME}-#{route_name}",
|
|
27
|
+
alarm_name: "#{prefix}Alarm-#{RoutesAlerts::Metrics::COUNT_METRIC_NAME}-#{route_name}",
|
|
28
28
|
actions_enabled: !!actions&.any?,
|
|
29
29
|
ok_actions: actions,
|
|
30
30
|
alarm_actions: actions,
|
|
@@ -24,7 +24,7 @@ class RoutesAlerts::Duration < RoutesAlerts::Base
|
|
|
24
24
|
|
|
25
25
|
def alarm_params
|
|
26
26
|
{
|
|
27
|
-
alarm_name: "Alarm-#{RoutesAlerts::Metrics::DURATION_METRIC_NAME}-#{route_name}",
|
|
27
|
+
alarm_name: "#{prefix}Alarm-#{RoutesAlerts::Metrics::DURATION_METRIC_NAME}-#{route_name}",
|
|
28
28
|
actions_enabled: !!actions&.any?,
|
|
29
29
|
ok_actions: actions,
|
|
30
30
|
alarm_actions: actions,
|
|
@@ -24,7 +24,7 @@ class RoutesAlerts::SuccessRate < RoutesAlerts::Base
|
|
|
24
24
|
|
|
25
25
|
def alarm_params
|
|
26
26
|
{
|
|
27
|
-
alarm_name: "Alarm-#{RoutesAlerts::Metrics::SUCCESS_METRIC_NAME}-#{route_name}",
|
|
27
|
+
alarm_name: "#{prefix}Alarm-#{RoutesAlerts::Metrics::SUCCESS_METRIC_NAME}-#{route_name}",
|
|
28
28
|
actions_enabled: !!actions&.any?,
|
|
29
29
|
ok_actions: actions,
|
|
30
30
|
alarm_actions: actions,
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
class RoutesAlerts::RouteInfo
|
|
3
3
|
attr_reader :path, :method, :max_duration, :min_count, :success_rate,
|
|
4
4
|
:alarm_period, :number_of_datapoints, :metrics, :namespace,
|
|
5
|
-
:log_group_name, :actions
|
|
5
|
+
:log_group_name, :actions, :prefix
|
|
6
6
|
|
|
7
|
-
def initialize(path:, method:, max_duration:, min_count:, success_rate:, alarm_period:, number_of_datapoints:, metrics:, namespace:, log_group_name:, actions:)
|
|
7
|
+
def initialize(path:, method:, max_duration:, min_count:, success_rate:, alarm_period:, number_of_datapoints:, metrics:, namespace:, log_group_name:, actions:, prefix: "")
|
|
8
8
|
@path = path.to_s
|
|
9
9
|
@method = method.to_s.upcase
|
|
10
10
|
@max_duration = max_duration.to_f
|
|
@@ -16,5 +16,6 @@ class RoutesAlerts::RouteInfo
|
|
|
16
16
|
@namespace = namespace.to_s
|
|
17
17
|
@log_group_name = log_group_name.to_s
|
|
18
18
|
@actions = actions || []
|
|
19
|
+
@prefix = prefix.to_s
|
|
19
20
|
end
|
|
20
21
|
end
|