dogapi 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/dogapi/event.rb +3 -27
- data/lib/dogapi/v1/event.rb +2 -0
- metadata +4 -4
data/lib/dogapi/event.rb
CHANGED
@@ -7,59 +7,35 @@ module Dogapi
|
|
7
7
|
|
8
8
|
# Metadata class for storing the details of an event
|
9
9
|
class Event
|
10
|
-
attr_reader :
|
11
|
-
:date_detected,
|
12
|
-
:date_happened,
|
13
|
-
:alert_type,
|
14
|
-
:event_type,
|
15
|
-
:event_object,
|
10
|
+
attr_reader :date_happened,
|
16
11
|
:msg_title,
|
17
12
|
:msg_text,
|
18
13
|
:priority,
|
19
14
|
:parent,
|
20
|
-
:tags
|
21
|
-
:json_payload
|
15
|
+
:tags
|
22
16
|
|
23
17
|
# Optional arguments:
|
24
|
-
# :metric => String
|
25
|
-
# :date_detected => time in seconds since the epoch (defaults to now)
|
26
18
|
# :date_happened => time in seconds since the epoch (defaults to now)
|
27
|
-
# :alert_type => String
|
28
|
-
# :event_type => String
|
29
|
-
# :event_object => String
|
30
19
|
# :msg_title => String
|
31
20
|
# :priority => String
|
32
21
|
# :parent => event ID (integer)
|
33
22
|
# :tags => array of Strings
|
34
|
-
# :json_payload => String
|
35
23
|
def initialize(msg_text, options={})
|
36
24
|
defaults = {
|
37
|
-
:metric => '',
|
38
|
-
:date_detected => Time.now.to_i,
|
39
25
|
:date_happened => Time.now.to_i,
|
40
|
-
:alert_type => '',
|
41
|
-
:event_type => '',
|
42
|
-
:event_object => '',
|
43
26
|
:msg_title => '',
|
44
27
|
:priority => "normal",
|
45
28
|
:parent => nil,
|
46
|
-
:tags => []
|
47
|
-
:json_payload => ''
|
29
|
+
:tags => []
|
48
30
|
}
|
49
31
|
options = defaults.merge(options)
|
50
32
|
|
51
33
|
@msg_text = msg_text
|
52
|
-
@metric = options[:metric]
|
53
|
-
@date_detected = options[:date_detected]
|
54
34
|
@date_happened = options[:date_happened]
|
55
|
-
@alert_type = options[:alert_type]
|
56
|
-
@event_type = options[:event_type]
|
57
|
-
@event_object = options[:event_object]
|
58
35
|
@msg_title = options[:msg_title]
|
59
36
|
@priority = options[:priority]
|
60
37
|
@parent = options[:parent]
|
61
38
|
@tags = options[:tags]
|
62
|
-
@json_payload = options[:json_payload]
|
63
39
|
end
|
64
40
|
end
|
65
41
|
|
data/lib/dogapi/v1/event.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dogapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 1.2.
|
9
|
+
- 2
|
10
|
+
version: 1.2.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Datadog, Inc.
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-10-
|
18
|
+
date: 2011-10-31 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: json
|