interferon 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/interferon/destinations/datadog.rb +33 -35
- data/lib/interferon/version.rb +1 -1
- metadata +2 -2
@@ -103,41 +103,39 @@ module Interferon::Destinations
|
|
103
103
|
end
|
104
104
|
|
105
105
|
# log whenever we've encountered errors
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
@stats[:alerts_silenced] += 1 if alert_opts[:silenced]
|
140
|
-
end
|
106
|
+
code = @dry_run ? 200 : resp[0].to_i
|
107
|
+
|
108
|
+
# client error
|
109
|
+
if code == 400
|
110
|
+
statsd.gauge('datadog.api.unknown_error', 0, :tags => ["alert:#{alert}"])
|
111
|
+
statsd.gauge('datadog.api.client_error', 1, :tags => ["alert:#{alert}"])
|
112
|
+
statsd.gauge('datadog.api.success', 0, :tags => ["alert:#{alert}"])
|
113
|
+
|
114
|
+
@stats[:api_client_errors] += 1
|
115
|
+
log.error("client error while #{action} alert '#{alert['name']}';" \
|
116
|
+
" query was '#{alert['metric']['datadog_query'].strip}'")
|
117
|
+
|
118
|
+
# unknown (prob. datadog) error:
|
119
|
+
elsif code >= 400 || code == -1
|
120
|
+
statsd.gauge('datadog.api.unknown_error', 1, :tags => ["alert:#{alert}"])
|
121
|
+
statsd.gauge('datadog.api.client_error', 0, :tags => ["alert:#{alert}"])
|
122
|
+
statsd.gauge('datadog.api.success', 0, :tags => ["alert:#{alert}"])
|
123
|
+
|
124
|
+
@stats[:api_unknown_errors] += 1
|
125
|
+
log.error("unknown error while #{action} alert '#{alert['name']}':" \
|
126
|
+
" query was '#{alert['metric']['datadog_query'].strip}'" \
|
127
|
+
" response was #{resp[0]}:'#{resp[1].inspect}'")
|
128
|
+
|
129
|
+
# assume this was a success
|
130
|
+
else
|
131
|
+
statsd.gauge('datadog.api.unknown_error', 0, :tags => ["alert:#{alert}"])
|
132
|
+
statsd.gauge('datadog.api.client_error', 0, :tags => ["alert:#{alert}"])
|
133
|
+
statsd.gauge('datadog.api.success', 1, :tags => ["alert:#{alert}"])
|
134
|
+
|
135
|
+
@stats[:api_successes] += 1
|
136
|
+
@stats[:alerts_created] += 1 if action == :creating
|
137
|
+
@stats[:alerts_updated] += 1 if action == :updating
|
138
|
+
@stats[:alerts_silenced] += 1 if alert_opts[:silenced]
|
141
139
|
end
|
142
140
|
|
143
141
|
# lets key alerts by their name
|
data/lib/interferon/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: interferon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-05-
|
12
|
+
date: 2015-05-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: dogapi
|