dogapi 1.22.0 → 1.23.0
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/.gitignore +1 -0
- data/.rspec +1 -1
- data/.rubocop.yml +13 -0
- data/.travis.yml +3 -1
- data/CHANGELOG.md +16 -1
- data/Gemfile +6 -3
- data/README.rdoc +1 -1
- data/Rakefile +8 -15
- data/lib/capistrano/datadog.rb +12 -12
- data/lib/capistrano/datadog/v2.rb +5 -5
- data/lib/capistrano/datadog/v3.rb +9 -4
- data/lib/dogapi/common.rb +43 -39
- data/lib/dogapi/event.rb +4 -4
- data/lib/dogapi/facade.rb +57 -54
- data/lib/dogapi/metric.rb +2 -2
- data/lib/dogapi/v1/alert.rb +17 -80
- data/lib/dogapi/v1/comment.rb +8 -39
- data/lib/dogapi/v1/dash.rb +20 -67
- data/lib/dogapi/v1/embed.rb +11 -57
- data/lib/dogapi/v1/event.rb +37 -72
- data/lib/dogapi/v1/metric.rb +17 -46
- data/lib/dogapi/v1/monitor.rb +54 -194
- data/lib/dogapi/v1/screenboard.rb +8 -77
- data/lib/dogapi/v1/search.rb +5 -11
- data/lib/dogapi/v1/service_check.rb +6 -15
- data/lib/dogapi/v1/snapshot.rb +10 -15
- data/lib/dogapi/v1/tag.rb +39 -99
- data/lib/dogapi/v1/user.rb +15 -69
- data/lib/dogapi/version.rb +1 -1
- data/spec/integration/alert_spec.rb +48 -0
- data/spec/integration/comment_spec.rb +32 -0
- data/spec/integration/common_spec.rb +32 -0
- data/spec/integration/dash_spec.rb +60 -0
- data/spec/integration/embed_spec.rb +43 -0
- data/spec/integration/event_spec.rb +73 -0
- data/spec/integration/metric_spec.rb +96 -0
- data/spec/integration/monitor_spec.rb +106 -0
- data/spec/integration/screenboard_spec.rb +61 -0
- data/spec/integration/search_spec.rb +11 -0
- data/spec/integration/service_check_spec.rb +12 -0
- data/spec/integration/snapshot_spec.rb +24 -0
- data/spec/integration/tag_spec.rb +66 -0
- data/spec/integration/user_spec.rb +46 -0
- data/spec/spec_helper.rb +85 -16
- data/spec/unit/common_spec.rb +101 -0
- data/spec/unit/facade_spec.rb +79 -0
- metadata +55 -52
- data/spec/alerts_spec.rb +0 -33
- data/spec/common_spec.rb +0 -37
- data/spec/facade_spec.rb +0 -166
- data/spec/support/cassettes/Alerts/create/returns_HTTP_code_200.yml +0 -114
- data/spec/support/cassettes/Alerts/create/returns_a_valid_event_ID.yml +0 -114
- data/spec/support/cassettes/Alerts/create/returns_the_same_query_as_sent.yml +0 -114
- data/spec/support/cassettes/Facade/Events/emits_aggregate_events.yml +0 -193
- data/spec/support/cassettes/Facade/Events/emits_events_and_retrieves_them.yml +0 -100
- data/spec/support/cassettes/Facade/Events/emits_events_with_specified_priority.yml +0 -98
- data/spec/support/cassettes/Facade/Tags/adds_updates_and_detaches_tags.yml +0 -442
- data/tests/test_alerts.rb +0 -38
- data/tests/test_base.rb +0 -30
- data/tests/test_client.rb +0 -23
- data/tests/test_comments.rb +0 -39
- data/tests/test_dashes.rb +0 -85
- data/tests/test_embed.rb +0 -194
- data/tests/test_monitors.rb +0 -192
- data/tests/test_screenboard.rb +0 -90
- data/tests/test_search.rb +0 -20
- data/tests/test_snapshot.rb +0 -28
- data/tests/test_users.rb +0 -65
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d44d23ffcc6ef539b6d85ae691647b700bba462
|
4
|
+
data.tar.gz: 0ea1557fa601f2c90b751ff9770bb53f15e90096
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e2240ad05c8be24a809610af6155df3abbd170fe9e6a8c3ce6e69cefbd7f27272a54b68867ccd87f198ff892acbbfb779574b9212b4b94223c5fe368f89b6fc
|
7
|
+
data.tar.gz: 6606add9a66b617449930b3181e9ee6ca5cb467b7e9e701932630c39484006d0ad75c168fdf2b4886f6b96941cba5f6577ef317dce46e984e4ffaff1cdbcb6d2
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
--color
|
2
|
-
--format documentation
|
2
|
+
--format documentation
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2016-08-15 12:22:34 -0400 using RuboCop version 0.42.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 14
|
10
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
|
11
|
+
# URISchemes: http, https
|
12
|
+
Metrics/LineLength:
|
13
|
+
Max: 111
|
data/.travis.yml
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
sudo: false
|
2
2
|
language: ruby
|
3
3
|
rvm:
|
4
|
+
- 1.9
|
5
|
+
- 2.0
|
4
6
|
- 2.1
|
5
7
|
- 2.2
|
6
|
-
- 2.3.
|
8
|
+
- 2.3.1
|
7
9
|
env:
|
8
10
|
secure: hKn4OWJZ3gKvdGVZd5VTnpRb7GB5eEtF7qc0+zOwusL1bxxSXvuNTLecqvKZpDH5uCnRCx8Dz52hSA5KzNoBoH2dPhyeC8en4/gZWbxndHYg/2qFBeHO4FP/Li3B9DmZt247IkuzK1oI4k5GkFyVw7OVrjxSVb50hjbanddkkmg=
|
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,19 @@
|
|
1
1
|
Changes
|
2
2
|
=======
|
3
3
|
|
4
|
-
# 1.
|
4
|
+
# 1.23.0 / Unreleased
|
5
|
+
|
6
|
+
* [FEATURE] Add Datadog endpoint to configuration. See [#108][]
|
7
|
+
* [FEATURE] Add delete method for events. See [#99][], [#109][]
|
8
|
+
* [IMPROVEMENT] Add Capistrano 3.5+ compatibility. See [#96][]
|
9
|
+
* [OTHER] Code style fixes. See [#106][] (thanks [@nots][])
|
10
|
+
|
11
|
+
# 1.22.0 / 2016-04-14
|
12
|
+
This release breaks compatibility with Ruby 1.8.
|
5
13
|
* [FEATURE] Metric query API. See [#88][], [#90][] (thanks [@blakehilscher][])
|
6
14
|
|
7
15
|
# 1.21.0 / 2015-10-30
|
16
|
+
This is the last release compatible with Ruby 1.8. ([EOL 2013-06-30](https://www.ruby-lang.org/en/news/2013/06/30/we-retire-1-8-7/))
|
8
17
|
* [FEATURE] User CRUD API. See [#82][]
|
9
18
|
* [IMPROVEMENT] Support capistrano SimpleTextFormatter (thanks [@rmoriz][] [#81][])
|
10
19
|
|
@@ -145,12 +154,18 @@ Changes
|
|
145
154
|
[#82]: https://github.com/DataDog/dogapi-rb/issues/82
|
146
155
|
[#88]: https://github.com/DataDog/dogapi-rb/issues/88
|
147
156
|
[#90]: https://github.com/DataDog/dogapi-rb/issues/90
|
157
|
+
[#96]: https://github.com/DataDog/dogapi-rb/issues/96
|
158
|
+
[#99]: https://github.com/DataDog/dogapi-rb/issues/99
|
159
|
+
[#106]: https://github.com/DataDog/dogapi-rb/issues/106
|
160
|
+
[#108]: https://github.com/DataDog/dogapi-rb/issues/108
|
161
|
+
[#109]: https://github.com/DataDog/dogapi-rb/issues/109
|
148
162
|
[@ArjenSchwarz]: https://github.com/ArjenSchwarz
|
149
163
|
[@Kaixiang]: https://github.com/Kaixiang
|
150
164
|
[@ansel1]: https://github.com/ansel1
|
151
165
|
[@arielo]: https://github.com/arielo
|
152
166
|
[@blakehilscher]: https://github.com/blakehilscher
|
153
167
|
[@byroot]: https://github.com/byroot
|
168
|
+
[@nots]: https://github.com/nots
|
154
169
|
[@rmoriz]: https://github.com/rmoriz
|
155
170
|
[@treeder]: https://github.com/treeder
|
156
171
|
[@winebarrel]: https://github.com/winebarrel
|
data/Gemfile
CHANGED
@@ -3,14 +3,17 @@ source 'https://rubygems.org'
|
|
3
3
|
gemspec
|
4
4
|
|
5
5
|
group :test do
|
6
|
-
gem 'minitest'
|
7
6
|
gem 'rake', '>= 2.4.2'
|
8
|
-
gem 'rdoc'
|
9
7
|
gem 'rspec'
|
10
|
-
gem '
|
8
|
+
gem 'rubocop', '~> 0.41.2'
|
9
|
+
gem 'simplecov'
|
11
10
|
gem 'webmock'
|
11
|
+
if RbConfig::CONFIG['ruby_version'].start_with?("1.9")
|
12
|
+
gem 'json', '< 2'
|
13
|
+
end
|
12
14
|
end
|
13
15
|
|
14
16
|
group :quality do
|
15
17
|
gem 'tailor'
|
18
|
+
gem 'tins', '~> 1.6.0'
|
16
19
|
end
|
data/README.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -2,13 +2,12 @@ require 'bundler/gem_tasks'
|
|
2
2
|
require 'rake/testtask'
|
3
3
|
require 'rdoc/task'
|
4
4
|
require 'rspec/core/rake_task'
|
5
|
+
require 'rubocop/rake_task'
|
5
6
|
|
6
|
-
default_tests = [:spec, :
|
7
|
+
default_tests = [:spec, :rubocop]
|
7
8
|
|
8
|
-
|
9
|
-
when -> (version) { version.start_with?("2.3") }
|
9
|
+
if !RbConfig::CONFIG['ruby_version'].start_with?("2.3")
|
10
10
|
# Not compatible with Ruby 2.3.x
|
11
|
-
else
|
12
11
|
require 'tailor/rake_task'
|
13
12
|
default_tests.unshift(:tailor)
|
14
13
|
|
@@ -17,22 +16,11 @@ else
|
|
17
16
|
style.max_line_length 160, :level => :warn
|
18
17
|
style.max_code_lines_in_method 40, :level => :warn
|
19
18
|
end
|
20
|
-
task.file_set 'spec/**/*.rb', :tests do |style|
|
21
|
-
style.max_line_length 160, :level => :warn
|
22
|
-
style.max_code_lines_in_method 40, :level => :warn
|
23
|
-
end
|
24
19
|
end
|
25
|
-
|
26
20
|
end
|
27
21
|
|
28
22
|
task :default => default_tests
|
29
23
|
|
30
|
-
Rake::TestTask.new(:test) do |test|
|
31
|
-
test.libs.push 'lib'
|
32
|
-
test.libs.push 'tests'
|
33
|
-
test.test_files = FileList['tests/test_*.rb']
|
34
|
-
end
|
35
|
-
|
36
24
|
# Doc stuff
|
37
25
|
RDoc::Task.new do |rd|
|
38
26
|
rd.main = 'README.rdoc'
|
@@ -44,6 +32,11 @@ end
|
|
44
32
|
|
45
33
|
RSpec::Core::RakeTask.new(:spec)
|
46
34
|
|
35
|
+
RuboCop::RakeTask.new do |task|
|
36
|
+
task.patterns = ['spec']
|
37
|
+
end
|
38
|
+
|
39
|
+
|
47
40
|
desc "Find notes in code"
|
48
41
|
task :notes do
|
49
42
|
puts `grep --exclude=Rakefile -r 'OPTIMIZE:\\|FIXME:\\|TODO:' .`
|
data/lib/capistrano/datadog.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require 'etc'
|
2
|
+
require 'digest/md5'
|
3
|
+
require 'timeout'
|
4
4
|
|
5
|
-
require
|
5
|
+
require 'dogapi'
|
6
6
|
|
7
7
|
module Capistrano
|
8
8
|
module Datadog
|
@@ -30,10 +30,10 @@ module Capistrano
|
|
30
30
|
dog.emit_event event
|
31
31
|
end
|
32
32
|
else
|
33
|
-
puts
|
33
|
+
puts 'No api key set, not submitting to Datadog'
|
34
34
|
end
|
35
35
|
rescue Timeout::Error => e
|
36
|
-
puts
|
36
|
+
puts 'Could not submit to Datadog, request timed out.'
|
37
37
|
rescue => e
|
38
38
|
puts "Could not submit to Datadog: #{e.inspect}\n#{e.backtrace.join("\n")}"
|
39
39
|
end
|
@@ -77,7 +77,7 @@ module Capistrano
|
|
77
77
|
@tasks.map do |task|
|
78
78
|
name = task[:name]
|
79
79
|
roles = Array(task[:roles]).map(&:to_s).sort
|
80
|
-
tags = [
|
80
|
+
tags = ['#capistrano'] + (roles.map { |t| '#role:' + t })
|
81
81
|
if !task[:stage].nil? and !task[:stage].empty? then
|
82
82
|
tags << "#stage:#{task[:stage]}"
|
83
83
|
end
|
@@ -85,15 +85,15 @@ module Capistrano
|
|
85
85
|
if !task[:application].nil? and !task[:application].empty? then
|
86
86
|
application = ' for ' + task[:application]
|
87
87
|
end
|
88
|
-
title =
|
89
|
-
type =
|
90
|
-
alert_type =
|
91
|
-
source_type =
|
88
|
+
title = '%s@%s ran %s%s on %s with capistrano in %.2f secs' % [user, hostname, name, application, roles.join(', '), task[:timing]]
|
89
|
+
type = 'deploy'
|
90
|
+
alert_type = 'success'
|
91
|
+
source_type = 'capistrano'
|
92
92
|
message_content = (@logging_output[name] || []).join('')
|
93
93
|
message = if !message_content.empty? then
|
94
94
|
# Strip out color control characters
|
95
95
|
message_content = sanitize_encoding(message_content).gsub(/\e\[(\d+)m/, '')
|
96
|
-
"@@@\n#{message_content}@@@" else
|
96
|
+
"@@@\n#{message_content}@@@" else '' end
|
97
97
|
|
98
98
|
Dogapi::Event.new(message,
|
99
99
|
:msg_title => title,
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'benchmark'
|
2
|
+
require 'delegate'
|
3
3
|
|
4
4
|
# Capistrano v2
|
5
5
|
|
@@ -12,7 +12,7 @@ module Capistrano
|
|
12
12
|
# will be raised.
|
13
13
|
# Also, capture the time the task took to execute, and the logs it
|
14
14
|
# outputted for submission to Datadog
|
15
|
-
def find_and_execute_task(path, hooks
|
15
|
+
def find_and_execute_task(path, hooks= {})
|
16
16
|
task = find_task(path) or raise NoSuchTaskError, "the task `#{path}' does not exist"
|
17
17
|
result = nil
|
18
18
|
reporter = Capistrano::Datadog.reporter
|
@@ -62,9 +62,9 @@ module Capistrano
|
|
62
62
|
logger.device = Datadog::LogCapture.new logger.device
|
63
63
|
|
64
64
|
# Trigger the Datadog submission once all the tasks have run
|
65
|
-
on :exit,
|
65
|
+
on :exit, 'datadog:submit'
|
66
66
|
namespace :datadog do
|
67
|
-
desc
|
67
|
+
desc 'Submit the tasks that have run to Datadog as events'
|
68
68
|
task :submit do |ns|
|
69
69
|
Capistrano::Datadog.submit variables[:datadog_api_key]
|
70
70
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require 'benchmark'
|
2
|
+
require 'sshkit/formatters/pretty'
|
3
|
+
require 'sshkit/formatters/simple_text'
|
4
4
|
|
5
5
|
# Capistrano v3 uses Rake's DSL instead of its own
|
6
6
|
|
@@ -30,7 +30,12 @@ module Capistrano
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def write(*args)
|
33
|
-
|
33
|
+
# Check if Capistrano version >= 3.5.0
|
34
|
+
if Gem::Version.new(VERSION) >= Gem::Version.new('3.5.0')
|
35
|
+
@wrapped << args
|
36
|
+
else
|
37
|
+
@wrapped.write(*args)
|
38
|
+
end
|
34
39
|
args.each { |arg| Capistrano::Datadog.reporter.record_log(arg) }
|
35
40
|
end
|
36
41
|
alias :<< :write
|
data/lib/dogapi/common.rb
CHANGED
@@ -28,7 +28,7 @@ module Dogapi
|
|
28
28
|
|
29
29
|
# <b>DEPRECATED:</b> Going forward, use the newer APIService.
|
30
30
|
def connect
|
31
|
-
warn
|
31
|
+
warn '[DEPRECATION] Dogapi::Service has been deprecated in favor of the newer V1 services'
|
32
32
|
uri = URI.parse(@host)
|
33
33
|
session = Net::HTTP.new(uri.host, uri.port)
|
34
34
|
if 'https' == uri.scheme
|
@@ -41,7 +41,7 @@ module Dogapi
|
|
41
41
|
|
42
42
|
# <b>DEPRECATED:</b> Going forward, use the newer APIService.
|
43
43
|
def request(method, url, params)
|
44
|
-
warn
|
44
|
+
warn '[DEPRECATION] Dogapi::Service has been deprecated in favor of the newer V1 services'
|
45
45
|
if !params.has_key? :api_key
|
46
46
|
params[:api_key] = @api_key
|
47
47
|
end
|
@@ -69,10 +69,10 @@ module Dogapi
|
|
69
69
|
|
70
70
|
# Superclass that deals with the details of communicating with the DataDog API
|
71
71
|
class APIService
|
72
|
-
def initialize(api_key, application_key, silent=true, timeout=nil)
|
72
|
+
def initialize(api_key, application_key, silent=true, timeout=nil, endpoint=nil)
|
73
73
|
@api_key = api_key
|
74
74
|
@application_key = application_key
|
75
|
-
@api_host = Dogapi.find_datadog_host()
|
75
|
+
@api_host = endpoint || Dogapi.find_datadog_host()
|
76
76
|
@silent = silent
|
77
77
|
@timeout = timeout || 5
|
78
78
|
end
|
@@ -82,8 +82,8 @@ module Dogapi
|
|
82
82
|
connection = Net::HTTP
|
83
83
|
|
84
84
|
# After ruby 2.0 Net::HTTP looks for the env variable but not ruby 1.9
|
85
|
-
if RUBY_VERSION <
|
86
|
-
proxy = ENV[
|
85
|
+
if RUBY_VERSION < '2.0.0'
|
86
|
+
proxy = ENV['HTTPS_PROXY'] || ENV['https_proxy'] || ENV['HTTP_PROXY'] || ENV['http_proxy']
|
87
87
|
if proxy
|
88
88
|
proxy_uri = URI.parse(proxy)
|
89
89
|
connection = Net::HTTP::Proxy(proxy_uri.host, proxy_uri.port, proxy_uri.user, proxy_uri.password)
|
@@ -96,17 +96,15 @@ module Dogapi
|
|
96
96
|
session.use_ssl = uri.scheme == 'https'
|
97
97
|
session.start do |conn|
|
98
98
|
conn.read_timeout = @timeout
|
99
|
-
yield
|
99
|
+
yield conn
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
103
|
def suppress_error_if_silent(e)
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
raise e
|
109
|
-
end
|
104
|
+
raise e unless @silent
|
105
|
+
|
106
|
+
warn e
|
107
|
+
return -1, {}
|
110
108
|
end
|
111
109
|
|
112
110
|
# Prepares the request and handles the response
|
@@ -114,43 +112,50 @@ module Dogapi
|
|
114
112
|
# +method+ is an implementation of Net::HTTP::Request (e.g. Net::HTTP::Post)
|
115
113
|
#
|
116
114
|
# +params+ is a Hash that will be converted to request parameters
|
117
|
-
def request(method, url,
|
118
|
-
resp_obj = nil
|
115
|
+
def request(method, url, extra_params, body, send_json, with_app_key=true)
|
119
116
|
resp = nil
|
120
117
|
connect do |conn|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
url = url + qs
|
125
|
-
end
|
118
|
+
begin
|
119
|
+
current_url = url + prepare_params(extra_params, with_app_key)
|
120
|
+
req = method.new(current_url)
|
126
121
|
|
127
|
-
|
122
|
+
if send_json
|
123
|
+
req.content_type = 'application/json'
|
124
|
+
req.body = MultiJson.dump(body)
|
125
|
+
end
|
128
126
|
|
129
|
-
|
130
|
-
|
131
|
-
|
127
|
+
resp = conn.request(req)
|
128
|
+
return handle_response(resp)
|
129
|
+
rescue Exception => e
|
130
|
+
suppress_error_if_silent e
|
132
131
|
end
|
132
|
+
end
|
133
|
+
end
|
133
134
|
|
134
|
-
|
135
|
-
|
135
|
+
def prepare_params(extra_params, with_app_key)
|
136
|
+
params = { api_key: @api_key }
|
137
|
+
params[:application_key] = @application_key if with_app_key
|
138
|
+
params = extra_params.merge params unless extra_params.nil?
|
139
|
+
qs_params = params.map { |k, v| k.to_s + '=' + v.to_s }
|
140
|
+
qs = '?' + qs_params.join('&')
|
141
|
+
qs
|
142
|
+
end
|
136
143
|
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
end
|
144
|
+
def handle_response(resp)
|
145
|
+
if resp.code == 204 || resp.body == '' || resp.body == 'null' || resp.body.nil?
|
146
|
+
return resp.code, {}
|
147
|
+
end
|
148
|
+
begin
|
149
|
+
return resp.code, MultiJson.load(resp.body)
|
150
|
+
rescue
|
151
|
+
raise 'Invalid JSON Response: ' + resp.body
|
146
152
|
end
|
147
|
-
return resp.code, resp_obj
|
148
153
|
end
|
149
154
|
end
|
150
155
|
|
151
156
|
def Dogapi.find_datadog_host
|
152
157
|
# allow env-based overriding, useful for tests
|
153
|
-
ENV[
|
158
|
+
ENV['DATADOG_HOST'] || 'https://app.datadoghq.com'
|
154
159
|
end
|
155
160
|
|
156
161
|
# Memoize the hostname as a module variable
|
@@ -161,8 +166,7 @@ module Dogapi
|
|
161
166
|
# prefer hostname -f over Socket.gethostname
|
162
167
|
@@hostname ||= %x[hostname -f].strip
|
163
168
|
rescue
|
164
|
-
raise
|
169
|
+
raise 'Cannot determine local hostname via hostname -f'
|
165
170
|
end
|
166
171
|
end
|
167
|
-
|
168
172
|
end
|
data/lib/dogapi/event.rb
CHANGED
@@ -26,7 +26,7 @@ module Dogapi
|
|
26
26
|
# :event_type => String
|
27
27
|
# :source_type_name => String
|
28
28
|
# :aggregation_key => String
|
29
|
-
def initialize(msg_text, options
|
29
|
+
def initialize(msg_text, options= {})
|
30
30
|
defaults = {
|
31
31
|
:date_happened => Time.now.to_i,
|
32
32
|
:msg_title => '',
|
@@ -62,14 +62,14 @@ module Dogapi
|
|
62
62
|
# removed in an upcoming release.
|
63
63
|
class EventService < Dogapi::Service
|
64
64
|
|
65
|
-
API_VERSION =
|
65
|
+
API_VERSION = '1.0.0'
|
66
66
|
MAX_BODY_LENGTH = 4000
|
67
67
|
MAX_TITLE_LENGTH = 100
|
68
68
|
|
69
69
|
# <b>DEPRECATED:</b> Going forward, use the V1 services. This legacy service will be
|
70
70
|
# removed in an upcoming release.
|
71
71
|
def submit(api_key, event, scope=nil, source_type=nil)
|
72
|
-
warn
|
72
|
+
warn '[DEPRECATION] Dogapi::EventService.submit() has been deprecated in favor of the newer V1 services'
|
73
73
|
scope = scope || Dogapi::Scope.new()
|
74
74
|
params = {
|
75
75
|
:api_key => api_key,
|
@@ -99,7 +99,7 @@ module Dogapi
|
|
99
99
|
# <b>DEPRECATED:</b> Going forward, use the V1 services. This legacy service will be
|
100
100
|
# removed in an upcoming release.
|
101
101
|
def start(api_key, event, scope, source_type=nil)
|
102
|
-
warn
|
102
|
+
warn '[DEPRECATION] Dogapi::EventService.start() has been deprecated in favor of the newer V1 services'
|
103
103
|
response = submit api_key, event, scope, source_type
|
104
104
|
success = nil
|
105
105
|
|